Class: EverSdk::Abi::Signer
- Inherits:
-
Object
- Object
- EverSdk::Abi::Signer
- Defined in:
- lib/ever_sdk_client/abi.rb
Constant Summary collapse
- TYPES =
[:none, :external, :keys, :signing_box]
Instance Attribute Summary collapse
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
-
#public_key ⇒ Object
readonly
Returns the value of attribute public_key.
-
#type_ ⇒ Object
readonly
Returns the value of attribute type_.
Instance Method Summary collapse
-
#initialize(type_:, public_key: nil, keys: nil, handle: nil) ⇒ Signer
constructor
A new instance of Signer.
- #to_h ⇒ Object
Constructor Details
#initialize(type_:, public_key: nil, keys: nil, handle: nil) ⇒ Signer
Returns a new instance of Signer.
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/ever_sdk_client/abi.rb', line 86 def initialize(type_:, public_key: nil, keys: nil, handle: nil) unless TYPES.include?(type_) raise ArgumentError.new("type #{type_} is unknown; known types: #{TYPES}") end @type_ = type_ @public_key = public_key @keys = keys @handle = handle end |
Instance Attribute Details
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
84 85 86 |
# File 'lib/ever_sdk_client/abi.rb', line 84 def handle @handle end |
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
84 85 86 |
# File 'lib/ever_sdk_client/abi.rb', line 84 def keys @keys end |
#public_key ⇒ Object (readonly)
Returns the value of attribute public_key.
84 85 86 |
# File 'lib/ever_sdk_client/abi.rb', line 84 def public_key @public_key end |
#type_ ⇒ Object (readonly)
Returns the value of attribute type_.
84 85 86 |
# File 'lib/ever_sdk_client/abi.rb', line 84 def type_ @type_ end |
Instance Method Details
#to_h ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/ever_sdk_client/abi.rb', line 97 def to_h h1 = { type: Helper.sym_to_capitalized_case_str(@type_) } h2 = case @type_ when :none { } when :external { public_key: @public_key } when :keys { keys: @keys.to_h } when :signing_box { handle: @handle } end h1.merge(h2) end |