Sha256: b43fcc5a264e6d5de830369cf4228529d36897b2daf06af30523344439c990f1

Contents?: true

Size: 642 Bytes

Versions: 5

Compression:

Stored size: 642 Bytes

Contents

module Postmark
  module SharedMessageExtensions

    def tag
      self['TAG']
    end

    def tag=(value)
      self['TAG'] = value
    end

    def postmark_attachments=(value)
      @_attachments = Array.wrap(value)
    end

    def postmark_attachments
      return if @_attachments.nil?

      @_attachments.map do |item|
        if item.is_a?(Hash)
          item
        elsif item.is_a?(File)
          {
            "Name"        => item.path.split("/")[-1],
            "Content"     => [ IO.read(item.path) ].pack("m"),
            "ContentType" => "application/octet-stream"
          }
        end
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
postmark-0.9.15 lib/postmark/message_extensions/shared.rb
postmark-0.9.14 lib/postmark/message_extensions/shared.rb
postmark-0.9.13 lib/postmark/message_extensions/shared.rb
postmark-0.9.12 lib/postmark/message_extensions/shared.rb
postmark-0.9.11 lib/postmark/message_extensions/shared.rb