Class: EverSdk::Abi::AbiFunction
- Inherits:
-
Object
- Object
- EverSdk::Abi::AbiFunction
- Defined in:
- lib/ever_sdk_client/abi.rb
Instance Attribute Summary collapse
-
#id_ ⇒ Object
readonly
Returns the value of attribute id_.
-
#inputs ⇒ Object
readonly
Returns the value of attribute inputs.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#outputs ⇒ Object
readonly
Returns the value of attribute outputs.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, inputs:, outputs:, id_: nil) ⇒ AbiFunction
constructor
A new instance of AbiFunction.
- #to_h ⇒ Object
Constructor Details
#initialize(name:, inputs:, outputs:, id_: nil) ⇒ AbiFunction
Returns a new instance of AbiFunction.
585 586 587 588 589 590 |
# File 'lib/ever_sdk_client/abi.rb', line 585 def initialize(name:, inputs:, outputs:, id_: nil) @name = name @inputs = inputs @outputs = outputs @id_ = id_ end |
Instance Attribute Details
#id_ ⇒ Object (readonly)
Returns the value of attribute id_.
583 584 585 |
# File 'lib/ever_sdk_client/abi.rb', line 583 def id_ @id_ end |
#inputs ⇒ Object (readonly)
Returns the value of attribute inputs.
583 584 585 |
# File 'lib/ever_sdk_client/abi.rb', line 583 def inputs @inputs end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
583 584 585 |
# File 'lib/ever_sdk_client/abi.rb', line 583 def name @name end |
#outputs ⇒ Object (readonly)
Returns the value of attribute outputs.
583 584 585 |
# File 'lib/ever_sdk_client/abi.rb', line 583 def outputs @outputs end |
Class Method Details
.from_json(j) ⇒ Object
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 |
# File 'lib/ever_sdk_client/abi.rb', line 613 def self.from_json(j) return nil if j.nil? inp_s = if j["inputs"].nil? [] else j["inputs"].compact.map do |x| # TODO recursive parsing of AbiParam AbiParam.from_json(x) end end out_s = if j["outputs"].nil? [] else j["outputs"].compact.map do |x| # TODO recursive parsing of AbiParam AbiParam.from_json(x) end end self.new( name: j["name"], inputs: inp_s, outputs: out_s, id_: j["id"] ) end |
Instance Method Details
#to_h ⇒ Object
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 |
# File 'lib/ever_sdk_client/abi.rb', line 592 def to_h in_h_s = if !@inputs.nil? @inputs.compact.map(&:to_h) else [] end ou_h_s = if !@outputs.nil? @outputs.compact.map(&:to_h) else [] end { name: @name, inputs: in_h_s, outputs: ou_h_s, id: @id_ } end |