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



1288
1289
1290
1291
1292
1293
1294
1295
# File 'lib/schemas.rb', line 1288

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



1297
1298
1299
# File 'lib/schemas.rb', line 1297

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

Instance Method Details

#to_dynamicObject



1301
1302
1303
1304
1305
1306
1307
# File 'lib/schemas.rb', line 1301

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

#to_json(options = nil) ⇒ Object



1309
1310
1311
# File 'lib/schemas.rb', line 1309

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