Class: EverSdk::Crypto::CryptoBoxSecret
- Inherits:
-
Object
- Object
- EverSdk::Crypto::CryptoBoxSecret
- Defined in:
- lib/ever_sdk_client/crypto.rb
Constant Summary collapse
- TYPES =
%i[random_seed_phrase predefined_seed_phrase encrypted_secret]
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, **args) ⇒ CryptoBoxSecret
constructor
A new instance of CryptoBoxSecret.
- #to_h ⇒ Object
Constructor Details
#initialize(type:, **args) ⇒ CryptoBoxSecret
Returns a new instance of CryptoBoxSecret.
246 247 248 249 250 251 252 |
# File 'lib/ever_sdk_client/crypto.rb', line 246 def initialize(type:, **args) unless TYPES.include?(type) raise ArgumentError.new("type #{type} is unknown; known types: #{TYPES}") end @type = type @args = args end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
244 245 246 |
# File 'lib/ever_sdk_client/crypto.rb', line 244 def args @args end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
244 245 246 |
# File 'lib/ever_sdk_client/crypto.rb', line 244 def type @type end |
Instance Method Details
#to_h ⇒ Object
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/ever_sdk_client/crypto.rb', line 254 def to_h hash = case type when :random_seed_phrase { dictionary: args[:dictionary], wordcount: args[:wordcount] } when :predefined_seed_phrase { phrase: args[:phrase], dictionary: args[:dictionary], wordcount: args[:wordcount] } when :encrypted_secret { encrypted_secret: args[:encrypted_secret] } end { type: Helper.sym_to_capitalized_case_str(type) }.merge(hash) end |