Module: Postmark::SharedMessageExtensions

Included in:
Mail::Message, TMail::Mail
Defined in:
lib/postmark/message_extensions/shared.rb

Instance Method Summary collapse

Instance Method Details

#postmark_attachmentsObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/postmark/message_extensions/shared.rb', line 16

def postmark_attachments
  return if @_attachments.nil?
      
  @_attachments.collect 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

#postmark_attachments=(value) ⇒ Object



12
13
14
# File 'lib/postmark/message_extensions/shared.rb', line 12

def postmark_attachments=(value)
  @_attachments = value.is_a?(Array) ? value : [value]
end

#tagObject



4
5
6
# File 'lib/postmark/message_extensions/shared.rb', line 4

def tag
  self['TAG']
end

#tag=(value) ⇒ Object



8
9
10
# File 'lib/postmark/message_extensions/shared.rb', line 8

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