class Bigbank::Client::Application::ApplicationResult

Attributes

connection[RW]

Public Class Methods

new(result, connection) click to toggle source
Calls superclass method
# File lib/bigbank/client/endpoints/application.rb, line 27
def initialize(result, connection)
  # TODO: Better make the connection statically available?
  @connection = connection
  super(result)
end

Public Instance Methods

contract() click to toggle source

Public: Returns the downloaded contract

Returns a @StringIO with the contract buffer or nil

# File lib/bigbank/client/endpoints/application.rb, line 36
def contract
  @contract ||= download_contract
end

Private Instance Methods

download_contract() click to toggle source

Internal: Downloads the contract

Returns a @StringIO with the contract buffer or nil

# File lib/bigbank/client/endpoints/application.rb, line 45
def download_contract
  return nil unless response.success?

  contract_response = connection.get(response.body["contract_file"])
  if contract_response.success?
    buffer = StringIO.new(contract_response.body)
    buffer.set_encoding("ASCII-8BIT")
  end

  buffer
end