Class: EncryptSymmetricResponse

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/schemas.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



1318
1319
1320
1321
1322
1323
1324
1325
# File 'lib/schemas.rb', line 1318

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    ciphertext: d.fetch("ciphertext"),
    iv:         d.fetch("iv"),
    tag:        d.fetch("tag"),
  )
end

.from_json!(json) ⇒ Object



1327
1328
1329
# File 'lib/schemas.rb', line 1327

def self.from_json!(json)
  from_dynamic!(JSON.parse(json))
end

Instance Method Details

#to_dynamicObject



1331
1332
1333
1334
1335
1336
1337
# File 'lib/schemas.rb', line 1331

def to_dynamic
  {
    "ciphertext" => ciphertext,
    "iv"         => iv,
    "tag"        => tag,
  }
end

#to_json(options = nil) ⇒ Object



1339
1340
1341
# File 'lib/schemas.rb', line 1339

def to_json(options = nil)
  JSON.generate(to_dynamic, options)
end