Class: PostCollectionsForkCollectionIDResponse404Error

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



21932
21933
21934
21935
21936
21937
21938
21939
# File 'lib/schemas.rb', line 21932

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

.from_json!(json) ⇒ Object



21941
21942
21943
# File 'lib/schemas.rb', line 21941

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

Instance Method Details

#to_dynamicObject



21945
21946
21947
21948
21949
21950
21951
# File 'lib/schemas.rb', line 21945

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

#to_json(options = nil) ⇒ Object



21953
21954
21955
# File 'lib/schemas.rb', line 21953

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