Sha256: d0dce6ac27606b64fce1e5cb8f88cc246869d98da313e02643a643b8f899e5c1

Contents?: true

Size: 530 Bytes

Versions: 13

Compression:

Stored size: 530 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)
      settings = self.settings.dup
      api_token = settings.delete(:api_token) || settings.delete(:api_key)
      api_client = ::Postmark::ApiClient.new(api_token, settings)
      response = api_client.deliver_message(mail)

      if settings[:return_response]
        response
      else
        self
      end
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
postmark-1.14.0 lib/postmark/handlers/mail.rb
postmark-1.13.0 lib/postmark/handlers/mail.rb
postmark-1.12.0 lib/postmark/handlers/mail.rb
postmark-1.11.0 lib/postmark/handlers/mail.rb
postmark-1.10.0 lib/postmark/handlers/mail.rb
postmark-1.9.1 lib/postmark/handlers/mail.rb
postmark-1.9.0 lib/postmark/handlers/mail.rb
postmark-1.8.1 lib/postmark/handlers/mail.rb
postmark-1.8.0 lib/postmark/handlers/mail.rb
postmark-1.7.1 lib/postmark/handlers/mail.rb
postmark-1.7.0 lib/postmark/handlers/mail.rb
postmark-1.6.0 lib/postmark/handlers/mail.rb
postmark-1.5.0 lib/postmark/handlers/mail.rb