Sha256: 6656549e3edc0f9298cbda6d802fefcff10d5dc0724293d660caf3d85e04e088

Contents?: true

Size: 549 Bytes

Versions: 1

Compression:

Stored size: 549 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_3
    else
      install_in_rails_2
    end
  end
  
  def install_in_rails_2
    ActionMailer::Base.send(:include, PostmarkDeliveryMethod)
  end
  
  def install_in_rails_3
    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.3.0 lib/postmark-rails.rb