Class: MailRoom::Delivery::Postback
- Inherits:
-
Object
- Object
- MailRoom::Delivery::Postback
- Defined in:
- lib/mail_room/delivery/postback.rb
Overview
Postback Delivery method
Defined Under Namespace
Classes: Options
Instance Method Summary collapse
-
#deliver(message) ⇒ Object
deliver the message using Faraday to the configured delivery_options url.
-
#initialize(delivery_options) ⇒ Postback
constructor
Build a new delivery, hold the delivery options.
Constructor Details
#initialize(delivery_options) ⇒ Postback
Build a new delivery, hold the delivery options
63 64 65 66 |
# File 'lib/mail_room/delivery/postback.rb', line 63 def initialize() puts @delivery_options = end |
Instance Method Details
#deliver(message) ⇒ Object
deliver the message using Faraday to the configured delivery_options url
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/mail_room/delivery/postback.rb', line 70 def deliver() connection = Faraday.new if @delivery_options.token_auth? config_token_auth(connection) elsif @delivery_options.basic_auth? config_basic_auth(connection) end connection.post do |request| request.url @delivery_options.url request.body = config_request_content_type(request) config_request_jwt_auth(request) end @delivery_options.logger.info({ delivery_method: 'Postback', action: 'message pushed', url: @delivery_options.url }) true end |