Class: TonSdk::Abi::DecodedMessageBody
- Inherits:
-
Object
- Object
- TonSdk::Abi::DecodedMessageBody
- Defined in:
- lib/ton_sdk_client/abi.rb
Constant Summary collapse
- MESSAGE_BODY_TYPE_VALUES =
[:input, :output, :internal_output, :event]
Instance Attribute Summary collapse
-
#body_type ⇒ Object
readonly
Returns the value of attribute body_type.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(body_type:, name:, value: nil, header: nil) ⇒ DecodedMessageBody
constructor
A new instance of DecodedMessageBody.
- #to_h ⇒ Object
Constructor Details
#initialize(body_type:, name:, value: nil, header: nil) ⇒ DecodedMessageBody
Returns a new instance of DecodedMessageBody.
336 337 338 339 340 341 342 343 344 345 |
# File 'lib/ton_sdk_client/abi.rb', line 336 def initialize(body_type:, name:, value: nil, header: nil) unless MESSAGE_BODY_TYPE_VALUES.include?(body_type) raise ArgumentError.new("unknown body_type: #{body_type}; known ones: #{MESSAGE_BODY_TYPE_VALUES}") end @body_type = body_type @name = name @value = value @header = header end |
Instance Attribute Details
#body_type ⇒ Object (readonly)
Returns the value of attribute body_type.
334 335 336 |
# File 'lib/ton_sdk_client/abi.rb', line 334 def body_type @body_type end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
334 335 336 |
# File 'lib/ton_sdk_client/abi.rb', line 334 def header @header end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
334 335 336 |
# File 'lib/ton_sdk_client/abi.rb', line 334 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
334 335 336 |
# File 'lib/ton_sdk_client/abi.rb', line 334 def value @value end |
Class Method Details
.from_json(j) ⇒ Object
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/ton_sdk_client/abi.rb', line 356 def self.from_json(j) return nil if j.nil? hdr = if !j["header"].nil? FunctionHeader.new( expire: j["header"]["expire"], time: j["header"]["time"], pubkey: j["header"]["pubkey"] ) else nil end self.new( body_type: self.parse_body_type(j["body_type"]), name: j["name"], value: j["value"], header: hdr ) end |
Instance Method Details
#to_h ⇒ Object
347 348 349 350 351 352 353 354 |
# File 'lib/ton_sdk_client/abi.rb', line 347 def to_h { body_type: Helper.sym_to_capitalized_case_str(@body_type), name: @name, value: @value, header: @header } end |