Sha256: 53eda966b958b4bfd02374efc0e6aab88791d237ed1b2de11d9477ca40d9d135

Contents?: true

Size: 615 Bytes

Versions: 4

Compression:

Stored size: 615 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
    Mail::Message.send(:include, Postmark::AttachmentsFixForMail)
  end
  
end

PostmarkInstaller.auto_detect_and_install

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
postmark-rails-0.4.2 lib/postmark-rails.rb
fishman-postmark-rails-0.4.1 lib/postmark-rails.rb
postmark-rails-0.4.1 lib/postmark-rails.rb
postmark-rails-0.4.0 lib/postmark-rails.rb