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



1949
1950
1951
1952
1953
1954
# File 'lib/schemas.rb', line 1949

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



1956
1957
1958
# File 'lib/schemas.rb', line 1956

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

Instance Method Details

#to_dynamicObject



1960
1961
1962
1963
1964
# File 'lib/schemas.rb', line 1960

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

#to_json(options = nil) ⇒ Object



1966
1967
1968
# File 'lib/schemas.rb', line 1966

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