class MailHandler::Sending::PostmarkBatchAPISender
sending batch email by Postmark API
Public Class Methods
new(api_token = nil)
click to toggle source
Calls superclass method
MailHandler::Sending::PostmarkAPISender::new
# File lib/mailhandler/sending/api_batch.rb, line 10 def initialize(api_token = nil) super(api_token) end
Public Instance Methods
send(emails)
click to toggle source
# File lib/mailhandler/sending/api_batch.rb, line 14 def send(emails) verify_email(emails) init_client response = client.deliver_messages(emails) format_response(response) end
valid_response?(responses)
click to toggle source
Calls superclass method
MailHandler::Sending::PostmarkAPISender#valid_response?
# File lib/mailhandler/sending/api_batch.rb, line 21 def valid_response?(responses) responses.map { |response| super(response) }.all?(true) end
Protected Instance Methods
format_response(response)
click to toggle source
Calls superclass method
MailHandler::Sending::PostmarkAPISender#format_response
# File lib/mailhandler/sending/api_batch.rb, line 27 def format_response(response) response.map { |r| super(r) } end
verify_email(emails)
click to toggle source
# File lib/mailhandler/sending/api_batch.rb, line 31 def verify_email(emails) return if emails.is_a?(Array) && emails.all? { |e| e.is_a? allowed_email_type } raise MailHandler::TypeError, 'Invalid type error, only Array of Mail::Message object types for sending allowed' end