Class: APIResultForEncryptSymmetricResponse

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



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

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

.from_json!(json) ⇒ Object



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

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

Instance Method Details

#to_dynamicObject



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

def to_dynamic
  {
    "data"    => data&.to_dynamic,
    "message" => message,
    "status"  => status,
  }
end

#to_json(options = nil) ⇒ Object



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

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