Class: PostCollectionsMergeResponse404Error

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



22276
22277
22278
22279
22280
22281
22282
22283
# File 'lib/schemas.rb', line 22276

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

.from_json!(json) ⇒ Object



22285
22286
22287
# File 'lib/schemas.rb', line 22285

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

Instance Method Details

#to_dynamicObject



22289
22290
22291
22292
22293
22294
22295
# File 'lib/schemas.rb', line 22289

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

#to_json(options = nil) ⇒ Object



22297
22298
22299
# File 'lib/schemas.rb', line 22297

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