Class: WebhookSystem::Job
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- WebhookSystem::Job
- Defined in:
- lib/webhook_system/job.rb
Overview
This is the ActiveJob in charge of actually sending each event
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.client_for(endpoint) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/webhook_system/job.rb', line 18 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 |
.post(endpoint, payload) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/webhook_system/job.rb', line 11 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 |