Class: PostMocksResponse429

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



24901
24902
24903
24904
24905
24906
24907
# File 'lib/schemas.rb', line 24901

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    error:   d["error"],
    message: d["message"],
  )
end

.from_json!(json) ⇒ Object



24909
24910
24911
# File 'lib/schemas.rb', line 24909

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

Instance Method Details

#to_dynamicObject



24913
24914
24915
24916
24917
24918
# File 'lib/schemas.rb', line 24913

def to_dynamic
  {
    "error"   => error,
    "message" => message,
  }
end

#to_json(options = nil) ⇒ Object



24920
24921
24922
# File 'lib/schemas.rb', line 24920

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