Class: PostApisResponse400

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



20254
20255
20256
20257
20258
20259
20260
20261
# File 'lib/schemas.rb', line 20254

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    detail:                     d["detail"],
    title:                      d["title"],
    post_apis_response400_type: d["type"],
  )
end

.from_json!(json) ⇒ Object



20263
20264
20265
# File 'lib/schemas.rb', line 20263

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

Instance Method Details

#to_dynamicObject



20267
20268
20269
20270
20271
20272
20273
# File 'lib/schemas.rb', line 20267

def to_dynamic
  {
    "detail" => detail,
    "title"  => title,
    "type"   => post_apis_response400_type,
  }
end

#to_json(options = nil) ⇒ Object



20275
20276
20277
# File 'lib/schemas.rb', line 20275

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