Class: VersionExtendedSchemasItem

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



37130
37131
37132
37133
37134
37135
37136
# File 'lib/schemas.rb', line 37130

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

.from_json!(json) ⇒ Object



37138
37139
37140
# File 'lib/schemas.rb', line 37138

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

Instance Method Details

#to_dynamicObject



37142
37143
37144
37145
37146
37147
# File 'lib/schemas.rb', line 37142

def to_dynamic
  {
    "id"   => id,
    "type" => version_extended_schemas_item_type,
  }
end

#to_json(options = nil) ⇒ Object



37149
37150
37151
# File 'lib/schemas.rb', line 37149

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