Class: PostCollectionsResponseCollection

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



22427
22428
22429
22430
22431
22432
22433
22434
# File 'lib/schemas.rb', line 22427

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

.from_json!(json) ⇒ Object



22436
22437
22438
# File 'lib/schemas.rb', line 22436

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

Instance Method Details

#to_dynamicObject



22440
22441
22442
22443
22444
22445
22446
# File 'lib/schemas.rb', line 22440

def to_dynamic
  {
    "id"   => id,
    "name" => post_collections_response_collection_name,
    "uid"  => uid,
  }
end

#to_json(options = nil) ⇒ Object



22448
22449
22450
# File 'lib/schemas.rb', line 22448

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