Sha256: 0572c8b14d9ddc12071add7ecaa34436d260a016e3ea983e3cbef4a6525cc958

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

module Postmark
  module SharedMessageExtensions

    def tag
      self['TAG']
    end

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

    def postmark_attachments=(value)
      @_attachments = Array[*value]
    end

    def postmark_attachments
      return if @_attachments.nil?

      puts @_attachments.inspect

      @_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

1 entries across 1 versions & 1 rubygems

Version Path
postmark-0.9.16 lib/postmark/message_extensions/shared.rb