Module: HasHelpers::Webhook
- Defined in:
- lib/has_helpers/webhook.rb
Overview
typed: false frozen_string_literal: true
Class Method Summary collapse
-
.send(action:, data:, url:, type:) ⇒ Object
Sends a webhook request in a standard format.
Class Method Details
.send(action:, data:, url:, type:) ⇒ Object
Sends a webhook request in a standard format.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/has_helpers/webhook.rb', line 6 def self.send(action:, data:, url:, type:) conn = Faraday.new(url: url) conn.post do |req| req.headers["Content-Type"] = "application/json" req.body = { action: action, type: type, data: data }.to_json end end |