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
41 42 43 44 |
# File 'lib/mail_room/delivery/postback.rb', line 41 def initialize() puts = end |
Instance Method Details
#deliver(message) ⇒ Object
deliver the message using Faraday to the configured delivery_options url
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/mail_room/delivery/postback.rb', line 48 def deliver() connection = Faraday.new if .token_auth? connection.token_auth .token elsif .basic_auth? connection.basic_auth( .username, .password ) end connection.post do |request| request.url .url request.body = # request.options[:timeout] = 3 request.headers['Content-Type'] = .content_type unless .content_type.nil? end .logger.info({ delivery_method: 'Postback', action: 'message pushed', url: .url }) true end |