Class: GetCollectionsCollectionIDResponsesResponseIDResponse

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



8333
8334
8335
8336
8337
8338
8339
8340
# File 'lib/schemas.rb', line 8333

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

.from_json!(json) ⇒ Object



8342
8343
8344
# File 'lib/schemas.rb', line 8342

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

Instance Method Details

#to_dynamicObject



8346
8347
8348
8349
8350
8351
8352
# File 'lib/schemas.rb', line 8346

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

#to_json(options = nil) ⇒ Object



8354
8355
8356
# File 'lib/schemas.rb', line 8354

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