Module: WebhookHandler

Defined in:
lib/webhook_handler.rb,
lib/webhook_handler/version.rb

Constant Summary collapse

VERSION =
'0.1.0'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/webhook_handler.rb', line 6

def self.included(klass)
  klass.extend self
  klass.include Sidekiq::Worker
  klass.extend Sinatra::Delegator
  klass.instance_eval do
    get '/' do
      'Send a POST request to this URL to trigger the webhook'
    end

    post '/' do
      klass.perform_async
      'ok'
    end
  end
end

Instance Method Details

#call(*args) ⇒ Object



22
23
24
# File 'lib/webhook_handler.rb', line 22

def call(*args)
  Sinatra::Application.call(*args)
end