Class: PostNetworkPrivateResponse429

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



26113
26114
26115
26116
26117
26118
26119
# File 'lib/schemas.rb', line 26113

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

.from_json!(json) ⇒ Object



26121
26122
26123
# File 'lib/schemas.rb', line 26121

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

Instance Method Details

#to_dynamicObject



26125
26126
26127
26128
26129
26130
# File 'lib/schemas.rb', line 26125

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

#to_json(options = nil) ⇒ Object



26132
26133
26134
# File 'lib/schemas.rb', line 26132

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