Class: SecretsResponse

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



2096
2097
2098
2099
2100
2101
# File 'lib/schemas.rb', line 2096

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    data: d.fetch("data").map { |x| SecretResponse.from_dynamic!(x) },
  )
end

.from_json!(json) ⇒ Object



2103
2104
2105
# File 'lib/schemas.rb', line 2103

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

Instance Method Details

#to_dynamicObject



2107
2108
2109
2110
2111
# File 'lib/schemas.rb', line 2107

def to_dynamic
  {
    "data" => data.map { |x| x.to_dynamic },
  }
end

#to_json(options = nil) ⇒ Object



2113
2114
2115
# File 'lib/schemas.rb', line 2113

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