class TonClient::TonBinding::Response

Attributes

core[R]
current_response[RW]
custom_response[RW]
error[RW]
finished[RW]
request_id[RW]
result[RW]

Public Class Methods

new(core: TonClient::TonBinding) click to toggle source
# File lib/ton-client-ruby/Binding/binding.rb, line 10
def initialize(core: TonClient::TonBinding)
  @core = core
end

Public Instance Methods

update(request_id, string_data, response_type, finished) click to toggle source
# File lib/ton-client-ruby/Binding/binding.rb, line 14
def update(request_id, string_data, response_type, finished)
  response_hash = core.read_string_to_hash(string_data)
  self.finished = finished
  self.request_id = request_id
  self.current_response = response_hash
  case response_type
  when 0
    # result
    self.result = response_hash
  when 1
    # error
    self.error = response_hash
  else
    # another
    if response_type >= 100
      self.custom_responses = response_hash
    end
  end
end