Class: ResponseForGetSecretResponse

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



1471
1472
1473
1474
1475
1476
1477
1478
# File 'lib/schemas.rb', line 1471

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

.from_json!(json) ⇒ Object



1480
1481
1482
# File 'lib/schemas.rb', line 1480

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

Instance Method Details

#to_dynamicObject



1484
1485
1486
1487
1488
1489
1490
# File 'lib/schemas.rb', line 1484

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

#to_json(options = nil) ⇒ Object



1492
1493
1494
# File 'lib/schemas.rb', line 1492

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