Sha256: 743eb426e38d9f3a4a84f136c1effd2dd790af14596b623094884af018aa92f3

Contents?: true

Size: 785 Bytes

Versions: 4

Compression:

Stored size: 785 Bytes

Contents

#
# This module is only used for Rails 2.
#
module PostmarkDeliveryMethod
  
  module ClassMethods
    
    def postmark_api_key=(value)
      Postmark.api_key = value
    end
    
  end
  
  def self.included(base)
    base.extend(ClassMethods)
    
    base.class_eval do      
      alias_method_chain :create_mail, :postmark_extras
    end
  end
  
  def perform_delivery_postmark(message)
    Postmark.send_through_postmark(message)
  end

  def tag(value)
    @tag = value
  end
  
  def postmark_attachments(value)
    @attachments = value
  end

  def create_mail_with_postmark_extras
    create_mail_without_postmark_extras.tap do |mail|
      mail.tag = @tag                          if @tag
      mail.postmark_attachments = @attachments if @attachments
    end
  end
  
end

Version data entries

4 entries across 4 versions & 2 rubygems

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