Class: PutApisAPIIDResponse

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



28328
28329
28330
28331
28332
28333
28334
28335
28336
28337
28338
28339
28340
# File 'lib/schemas.rb', line 28328

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    created_at:                    d["createdAt"],
    created_by:                    d["createdBy"],
    description:                   d["description"],
    id:                            d["id"],
    put_apis_api_id_response_name: d.fetch("name"),
    summary:                       d["summary"],
    updated_at:                    d["updatedAt"],
    updated_by:                    d["updatedBy"],
  )
end

.from_json!(json) ⇒ Object



28342
28343
28344
# File 'lib/schemas.rb', line 28342

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

Instance Method Details

#to_dynamicObject



28346
28347
28348
28349
28350
28351
28352
28353
28354
28355
28356
28357
# File 'lib/schemas.rb', line 28346

def to_dynamic
  {
    "createdAt"   => created_at,
    "createdBy"   => created_by,
    "description" => description,
    "id"          => id,
    "name"        => put_apis_api_id_response_name,
    "summary"     => summary,
    "updatedAt"   => updated_at,
    "updatedBy"   => updated_by,
  }
end

#to_json(options = nil) ⇒ Object



28359
28360
28361
# File 'lib/schemas.rb', line 28359

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