Class: PostCollectionsResponse

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



22456
22457
22458
22459
22460
22461
# File 'lib/schemas.rb', line 22456

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    collection: d["collection"] ? PostCollectionsResponseCollection.from_dynamic!(d["collection"]) : nil,
  )
end

.from_json!(json) ⇒ Object



22463
22464
22465
# File 'lib/schemas.rb', line 22463

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

Instance Method Details

#to_dynamicObject



22467
22468
22469
22470
22471
# File 'lib/schemas.rb', line 22467

def to_dynamic
  {
    "collection" => collection&.to_dynamic,
  }
end

#to_json(options = nil) ⇒ Object



22473
22474
22475
# File 'lib/schemas.rb', line 22473

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