Sha256: 25881f7d2a9e847da136b13aa2280050416e9f51fcf7be1d5046a14157aa76f8
Contents?: true
Size: 691 Bytes
Versions: 26
Compression:
Stored size: 691 Bytes
Contents
module Mail class Postmark attr_accessor :settings def initialize(values) self.settings = { :api_token => ENV['POSTMARK_API_TOKEN'] }.merge(values) end def deliver!(mail) response = if mail.templated? api_client.deliver_message_with_template(mail) else api_client.deliver_message(mail) end if settings[:return_response] response else self end end def api_client settings = self.settings.dup api_token = settings.delete(:api_token) || settings.delete(:api_key) ::Postmark::ApiClient.new(api_token, settings) end end end
Version data entries
26 entries across 26 versions & 1 rubygems