Class: ProjectDeleteResponse

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



2238
2239
2240
2241
2242
2243
2244
# File 'lib/schemas.rb', line 2238

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

.from_json!(json) ⇒ Object



2246
2247
2248
# File 'lib/schemas.rb', line 2246

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

Instance Method Details

#to_dynamicObject



2250
2251
2252
2253
2254
2255
# File 'lib/schemas.rb', line 2250

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

#to_json(options = nil) ⇒ Object



2257
2258
2259
# File 'lib/schemas.rb', line 2257

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