Class: ResponseForEncryptSymmetricResponse

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



1355
1356
1357
1358
1359
1360
1361
1362
# File 'lib/schemas.rb', line 1355

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    data:          d["data"] ? EncryptSymmetricResponse.from_dynamic!(d["data"]) : nil,
    error_message: d["errorMessage"],
    success:       d.fetch("success"),
  )
end

.from_json!(json) ⇒ Object



1364
1365
1366
# File 'lib/schemas.rb', line 1364

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

Instance Method Details

#to_dynamicObject



1368
1369
1370
1371
1372
1373
1374
# File 'lib/schemas.rb', line 1368

def to_dynamic
  {
    "data"         => data&.to_dynamic,
    "errorMessage" => error_message,
    "success"      => success,
  }
end

#to_json(options = nil) ⇒ Object



1376
1377
1378
# File 'lib/schemas.rb', line 1376

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