Class: PostCollectionsBodyCollectionInfo

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



20446
20447
20448
20449
20450
20451
20452
# File 'lib/schemas.rb', line 20446

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    post_collections_body_collection_info_name: d.fetch("name"),
    schema:                                     d.fetch("schema"),
  )
end

.from_json!(json) ⇒ Object



20454
20455
20456
# File 'lib/schemas.rb', line 20454

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

Instance Method Details

#to_dynamicObject



20458
20459
20460
20461
20462
20463
# File 'lib/schemas.rb', line 20458

def to_dynamic
  {
    "name"   => post_collections_body_collection_info_name,
    "schema" => schema,
  }
end

#to_json(options = nil) ⇒ Object



20465
20466
20467
# File 'lib/schemas.rb', line 20465

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