class Layer::Webhook
@example
webhook = Layer::Webhook.create({ version: '1.0', target_url: 'https://example.com/layer/webhook', events: ['message.sent'], secret: 'my-secret', config: { foo: :bar } })
@see developer.layer.com/docs/webhooks/introduction
@!macro platform-api
Public Class Methods
client()
click to toggle source
@!parse extend Layer::Operations::Find::ClassMethods
@!parse extend Layer::Operations::List::ClassMethods
@!parse extend Layer::Operations::Create::ClassMethods
@!parse extend Layer::Operations::Delete::ClassMethods
# File lib/layer/webhook.rb, line 24 def self.client @client ||= Client::Webhook.new end
Public Instance Methods
activate!()
click to toggle source
Activate this webhook
# File lib/layer/webhook.rb, line 29 def activate! client.post("#{url}/activate") end
active?()
click to toggle source
Check if this webhook is active @return [Boolean] whether the webhook is active
# File lib/layer/webhook.rb, line 46 def active? status == 'active' end
created_at()
click to toggle source
Returns the time the webhook was created at @return [Time] the time the webhook was created at
# File lib/layer/webhook.rb, line 58 def created_at Time.parse(attributes['created_at']) end
deactivate!()
click to toggle source
Deactivate this webhook
# File lib/layer/webhook.rb, line 34 def deactivate! client.post("#{url}/deactivate") end
inactive?()
click to toggle source
Check if this webhook is inactive @return [Boolean] whether the webhook is inactive
# File lib/layer/webhook.rb, line 52 def inactive? status == 'inactive' end
unverified?()
click to toggle source
Check if this webhook is unverified @return [Boolean] whether the webhook is unverified
# File lib/layer/webhook.rb, line 40 def unverified? status == 'unverified' end