Class: PostEnvironmentsBodyEnvironment

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



23108
23109
23110
23111
23112
23113
23114
# File 'lib/schemas.rb', line 23108

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    post_environments_body_environment_name: d.fetch("name"),
    values:                                  d["values"]&.map { |x| x.map { |x| PostEnvironmentsBodyEnvironmentValuesItemItem.from_dynamic!(x) } },
  )
end

.from_json!(json) ⇒ Object



23116
23117
23118
# File 'lib/schemas.rb', line 23116

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

Instance Method Details

#to_dynamicObject



23120
23121
23122
23123
23124
23125
# File 'lib/schemas.rb', line 23120

def to_dynamic
  {
    "name"   => post_environments_body_environment_name,
    "values" => values&.map { |x| x.map { |x| x.to_dynamic } },
  }
end

#to_json(options = nil) ⇒ Object



23127
23128
23129
# File 'lib/schemas.rb', line 23127

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