Class: TonClient::TonBinding::Response
- Defined in:
- lib/ton-client-ruby/Binding/binding.rb
Instance Attribute Summary collapse
-
#core ⇒ Object
readonly
Returns the value of attribute core.
-
#current_response ⇒ Object
Returns the value of attribute current_response.
-
#custom_response ⇒ Object
Returns the value of attribute custom_response.
-
#error ⇒ Object
Returns the value of attribute error.
-
#finished ⇒ Object
Returns the value of attribute finished.
-
#request_id ⇒ Object
Returns the value of attribute request_id.
-
#result ⇒ Object
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(core: TonClient::TonBinding) ⇒ Response
constructor
A new instance of Response.
- #update(request_id, string_data, response_type, finished) ⇒ Object
Constructor Details
#initialize(core: TonClient::TonBinding) ⇒ Response
Returns a new instance of Response.
10 11 12 |
# File 'lib/ton-client-ruby/Binding/binding.rb', line 10 def initialize(core: TonClient::TonBinding) @core = core end |
Instance Attribute Details
#core ⇒ Object (readonly)
Returns the value of attribute core.
7 8 9 |
# File 'lib/ton-client-ruby/Binding/binding.rb', line 7 def core @core end |
#current_response ⇒ Object
Returns the value of attribute current_response.
8 9 10 |
# File 'lib/ton-client-ruby/Binding/binding.rb', line 8 def current_response @current_response end |
#custom_response ⇒ Object
Returns the value of attribute custom_response.
8 9 10 |
# File 'lib/ton-client-ruby/Binding/binding.rb', line 8 def custom_response @custom_response end |
#error ⇒ Object
Returns the value of attribute error.
8 9 10 |
# File 'lib/ton-client-ruby/Binding/binding.rb', line 8 def error @error end |
#finished ⇒ Object
Returns the value of attribute finished.
8 9 10 |
# File 'lib/ton-client-ruby/Binding/binding.rb', line 8 def finished @finished end |
#request_id ⇒ Object
Returns the value of attribute request_id.
8 9 10 |
# File 'lib/ton-client-ruby/Binding/binding.rb', line 8 def request_id @request_id end |
#result ⇒ Object
Returns the value of attribute result.
8 9 10 |
# File 'lib/ton-client-ruby/Binding/binding.rb', line 8 def result @result end |
Instance Method Details
#update(request_id, string_data, response_type, finished) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# 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 |