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



2450
2451
2452
2453
2454
2455
2456
# File 'lib/schemas.rb', line 2450

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

.from_json!(json) ⇒ Object



2458
2459
2460
# File 'lib/schemas.rb', line 2458

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

Instance Method Details

#to_dynamicObject



2462
2463
2464
2465
2466
2467
# File 'lib/schemas.rb', line 2462

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

#to_json(options = nil) ⇒ Object



2469
2470
2471
# File 'lib/schemas.rb', line 2469

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