Sha256: 8d005aa8fb747bc2f24b024d59e9ac6946fc71abb5f932142518f0417b7dc178
Contents?: true
Size: 689 Bytes
Versions: 2
Compression:
Stored size: 689 Bytes
Contents
module WebhookSystem # This is the ActiveJob in charge of actually sending each event class Job < ActiveJob::Base def perform(subscription, event) payload = Encoder.encode(subscription.secret, event) self.class.post(subscription.url, payload) end def self.post(endpoint, payload) client_for(endpoint).post do |req| req.headers['Content-Type'] = 'application/json; base64+aes256' req.body = payload.to_s end end def self.client_for(endpoint) Faraday.new(url: endpoint) do |faraday| faraday.response :logger if ENV['WEBHOOK_DEBUG'] faraday.adapter Faraday.default_adapter end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
webhook_system-0.1.1 | lib/webhook_system/job.rb |
webhook_system-0.1.0 | lib/webhook_system/job.rb |