Class: Waylon::Webhook
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Waylon::Webhook
- Includes:
- BaseComponent
- Defined in:
- lib/waylon/webhook.rb
Overview
Base class for Webhooks
Class Method Summary collapse
-
.config_namespace ⇒ String
Config namespace for config keys.
Instance Method Summary collapse
-
#enqueue(content) ⇒ Object
Places the incoming request body onto the Senses queue for processing by workers.
-
#sense_class ⇒ Class
Provides the Sense class that corresponds to this Webhook, with some sensible assumptions.
-
#verify(_payload, _headers) ⇒ Boolean
This must be implemented on every Webhook to provide a mechanism to ensure received payloads are legit.
Methods included from BaseComponent
Class Method Details
.config_namespace ⇒ String
Config namespace for config keys
10 11 12 |
# File 'lib/waylon/webhook.rb', line 10 def self.config_namespace "webhooks.#{component_namespace}" end |
Instance Method Details
#enqueue(content) ⇒ Object
Places the incoming request body onto the Senses queue for processing by workers
16 17 18 |
# File 'lib/waylon/webhook.rb', line 16 def enqueue(content) Resque.enqueue sense_class, content end |
#sense_class ⇒ Class
Provides the Sense class that corresponds to this Webhook, with some sensible assumptions
22 23 24 25 |
# File 'lib/waylon/webhook.rb', line 22 def sense_class last = self.class.name.split("::").last Module.const_get("Waylon::Senses::#{last}") end |
#verify(_payload, _headers) ⇒ Boolean
This must be implemented on every Webhook to provide a mechanism to ensure received payloads are legit
31 32 33 |
# File 'lib/waylon/webhook.rb', line 31 def verify(_payload, _headers) raise GenericException, "Not Implemented" end |