Class: APIResultForGetSecretResponse

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



1429
1430
1431
1432
1433
1434
1435
1436
# File 'lib/schemas.rb', line 1429

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

.from_json!(json) ⇒ Object



1438
1439
1440
# File 'lib/schemas.rb', line 1438

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

Instance Method Details

#to_dynamicObject



1442
1443
1444
1445
1446
1447
1448
# File 'lib/schemas.rb', line 1442

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

#to_json(options = nil) ⇒ Object



1450
1451
1452
# File 'lib/schemas.rb', line 1450

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