Class: PostWebhooksBody

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



27433
27434
27435
27436
27437
27438
# File 'lib/schemas.rb', line 27433

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    webhook: d["webhook"] ? PostWebhooksBodyWebhook.from_dynamic!(d["webhook"]) : nil,
  )
end

.from_json!(json) ⇒ Object



27440
27441
27442
# File 'lib/schemas.rb', line 27440

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

Instance Method Details

#to_dynamicObject



27444
27445
27446
27447
27448
# File 'lib/schemas.rb', line 27444

def to_dynamic
  {
    "webhook" => webhook&.to_dynamic,
  }
end

#to_json(options = nil) ⇒ Object



27450
27451
27452
# File 'lib/schemas.rb', line 27450

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