Class: CreateUpdateAPI

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



36339
36340
36341
36342
36343
36344
36345
36346
# File 'lib/schemas.rb', line 36339

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    description:            d["description"],
    create_update_api_name: d.fetch("name"),
    summary:                d["summary"],
  )
end

.from_json!(json) ⇒ Object



36348
36349
36350
# File 'lib/schemas.rb', line 36348

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

Instance Method Details

#to_dynamicObject



36352
36353
36354
36355
36356
36357
36358
# File 'lib/schemas.rb', line 36352

def to_dynamic
  {
    "description" => description,
    "name"        => create_update_api_name,
    "summary"     => summary,
  }
end

#to_json(options = nil) ⇒ Object



36360
36361
36362
# File 'lib/schemas.rb', line 36360

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