Class: PusherFake::Webhook
- Inherits:
-
Object
- Object
- PusherFake::Webhook
- Defined in:
- lib/pusher-fake/webhook.rb
Overview
Webhook triggering.
Class Method Summary collapse
Class Method Details
.trigger(name, data = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/pusher-fake/webhook.rb', line 7 def trigger(name, data = {}) payload = MultiJson.dump( events: [data.merge(name: name)], time_ms: Time.now.to_i ) PusherFake.log("HOOK: #{payload}") PusherFake.configuration.webhooks.each do |url| http = EventMachine::HttpRequest.new(url) http.post(body: payload, head: headers_for(payload)) end end |