Class: PostCollectionsCollectionIDResponsesResponse

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



21436
21437
21438
21439
21440
21441
21442
21443
21444
# File 'lib/schemas.rb', line 21436

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    data:                                                   d["data"] ? PostCollectionsCollectionIDResponsesResponseData.from_dynamic!(d["data"]) : nil,
    post_collections_collection_id_responses_response_meta: d["meta"],
    model_id:                                               d["model_id"],
    revision:                                               d["revision"],
  )
end

.from_json!(json) ⇒ Object



21446
21447
21448
# File 'lib/schemas.rb', line 21446

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

Instance Method Details

#to_dynamicObject



21450
21451
21452
21453
21454
21455
21456
21457
# File 'lib/schemas.rb', line 21450

def to_dynamic
  {
    "data"     => data&.to_dynamic,
    "meta"     => post_collections_collection_id_responses_response_meta,
    "model_id" => model_id,
    "revision" => revision,
  }
end

#to_json(options = nil) ⇒ Object



21459
21460
21461
# File 'lib/schemas.rb', line 21459

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