Class: APIDetailsVersionsItem

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



35725
35726
35727
35728
35729
35730
35731
# File 'lib/schemas.rb', line 35725

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    id:                             d["id"],
    api_details_versions_item_name: d["name"],
  )
end

.from_json!(json) ⇒ Object



35733
35734
35735
# File 'lib/schemas.rb', line 35733

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

Instance Method Details

#to_dynamicObject



35737
35738
35739
35740
35741
35742
# File 'lib/schemas.rb', line 35737

def to_dynamic
  {
    "id"   => id,
    "name" => api_details_versions_item_name,
  }
end

#to_json(options = nil) ⇒ Object



35744
35745
35746
# File 'lib/schemas.rb', line 35744

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