class MailRoom::Delivery::Postback
Constants
- Options
Public Class Methods
new(delivery_options)
click to toggle source
Build a new delivery, hold the delivery options @param [MailRoom::Delivery::Postback::Options]
# File lib/mail_room/delivery/postback.rb, line 19 def initialize(delivery_options) @delivery_options = delivery_options end
Public Instance Methods
deliver(message)
click to toggle source
deliver the message using Faraday to the configured delivery_options url @param message [String] the email message as a string, RFC822 format
# File lib/mail_room/delivery/postback.rb, line 25 def deliver(message) connection = Faraday.new connection.token_auth @delivery_options.delivery_token connection.post do |request| request.url @delivery_options.delivery_url request.body = message # request.options[:timeout] = 3 # request.headers['Content-Type'] = 'text/plain' end true end