Class: PostCollectionsCollectionIDResponsesResponse400Error

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



21512
21513
21514
21515
21516
21517
21518
21519
# File 'lib/schemas.rb', line 21512

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    details:                                                         d["details"] ? PostCollectionsCollectionIDResponsesResponse400ErrorDetails.from_dynamic!(d["details"]) : nil,
    message:                                                         d["message"],
    post_collections_collection_id_responses_response400_error_name: d["name"],
  )
end

.from_json!(json) ⇒ Object



21521
21522
21523
# File 'lib/schemas.rb', line 21521

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

Instance Method Details

#to_dynamicObject



21525
21526
21527
21528
21529
21530
21531
# File 'lib/schemas.rb', line 21525

def to_dynamic
  {
    "details" => details&.to_dynamic,
    "message" => message,
    "name"    => post_collections_collection_id_responses_response400_error_name,
  }
end

#to_json(options = nil) ⇒ Object



21533
21534
21535
# File 'lib/schemas.rb', line 21533

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