Class: GmailSender::MessageStreamWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/gmail_sender/message_stream_writer.rb

Constant Summary collapse

ATTACHMENT_READ_PORTION =

you may change this, but must be multiply to 3

150360

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sender_email) ⇒ MessageStreamWriter

Returns a new instance of MessageStreamWriter.



7
8
9
10
11
# File 'lib/gmail_sender/message_stream_writer.rb', line 7

def initialize(sender_email)
  @sender_email = sender_email
  @attachments = []
  @boundary = rand(2**256).to_s(16)
end

Instance Attribute Details

#attachmentsObject (readonly)

Returns the value of attribute attachments.



5
6
7
# File 'lib/gmail_sender/message_stream_writer.rb', line 5

def attachments
  @attachments
end

Instance Method Details

#write(msg_stream, to, subject, content, content_type) ⇒ Object



13
14
15
16
17
# File 'lib/gmail_sender/message_stream_writer.rb', line 13

def write(msg_stream, to, subject, content, content_type)
  write_headers(msg_stream, to, subject)
  write_content(msg_stream, content, content_type)
  write_attachments(msg_stream)
end