Class: ResponseForProjectsDeleteResponse

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



2510
2511
2512
2513
2514
2515
2516
2517
# File 'lib/schemas.rb', line 2510

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    data:          d["data"] ? ProjectsDeleteResponse.from_dynamic!(d["data"]) : nil,
    error_message: d["errorMessage"],
    success:       d.fetch("success"),
  )
end

.from_json!(json) ⇒ Object



2519
2520
2521
# File 'lib/schemas.rb', line 2519

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

Instance Method Details

#to_dynamicObject



2523
2524
2525
2526
2527
2528
2529
# File 'lib/schemas.rb', line 2523

def to_dynamic
  {
    "data"         => data&.to_dynamic,
    "errorMessage" => error_message,
    "success"      => success,
  }
end

#to_json(options = nil) ⇒ Object



2531
2532
2533
# File 'lib/schemas.rb', line 2531

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