Class: RailsWebhookOutbox::Sender
- Inherits:
-
Object
- Object
- RailsWebhookOutbox::Sender
- Defined in:
- lib/rails_webhook_outbox/sender.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(delivery) ⇒ Sender
constructor
A new instance of Sender.
Constructor Details
#initialize(delivery) ⇒ Sender
Returns a new instance of Sender.
12 13 14 |
# File 'lib/rails_webhook_outbox/sender.rb', line 12 def initialize(delivery) @delivery = delivery end |
Class Method Details
.call(delivery) ⇒ Object
8 9 10 |
# File 'lib/rails_webhook_outbox/sender.rb', line 8 def self.call(delivery) new(delivery).call end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/rails_webhook_outbox/sender.rb', line 16 def call uri = URI.parse(@delivery.subscription.url) body = build_body request = build_request(uri, body) response = execute(uri, request) raise DeliveryError.new(response) unless response.is_a?(Net::HTTPSuccess) response end |