Sha256: 2c14058e1cc673df3d43dcede5031ce35f79ee538236843654ab9f7528ea0104

Contents?: true

Size: 547 Bytes

Versions: 1

Compression:

Stored size: 547 Bytes

Contents

require 'action_mailer'
require 'postmark'
require 'postmark_delivery_method'

module PostmarkInstaller
  extend self

  def auto_detect_and_install
    if ActionMailer::Base.respond_to?(:add_delivery_method)
      install_in_rails
    else
      install_in_legacy_rails
    end
  end

  def install_in_legacy_rails
    ActionMailer::Base.send(:include, PostmarkDeliveryMethod)
  end

  def install_in_rails
    ActionMailer::Base.add_delivery_method :postmark, Mail::Postmark, :api_key => nil
  end

end

PostmarkInstaller.auto_detect_and_install

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
postmark-rails-0.5.1 lib/postmark-rails.rb