Sha256: 93476fa0d06d6547444bf9f7d6cdbae429530a66d2f07deec06271972b1bb8bc

Contents?: true

Size: 501 Bytes

Versions: 1

Compression:

Stored size: 501 Bytes

Contents

lib = File.expand_path('../../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require 'webhook_handler'
require 'json'

# Trigger this with:
# curl -X POST http://localhost:5000 -d '{"message": "bar"}'

class MyApp
  include WebhookHandler

  def handle_webhook
    request.body.rewind
    payload = JSON.parse(request.body.read)
    self.class.perform_async(payload['message'])
  end

  def perform(message)
    puts "Working hard! Message: #{message}"
    sleep 5
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
webhook_handler-0.4.0 example/app.rb