class Nvlope::Message
Public Instance Methods
==(other)
click to toggle source
# File lib/nvlope/message.rb, line 80 def == other (self.class === other || other.class === self) && self.id == other.id end
created_at()
click to toggle source
# File lib/nvlope/message.rb, line 25 def created_at @created_at ||= Time.at(created) end
delete()
click to toggle source
# File lib/nvlope/message.rb, line 54 def delete nvlope.messages.delete [id] end
files()
click to toggle source
# File lib/nvlope/message.rb, line 43 def files @files ||= Array(raw['files']).map do |raw| Nvlope::File.new(nvlope, raw) end end
header()
click to toggle source
# File lib/nvlope/message.rb, line 29 def header @header ||= Nvlope::Message::Header.new(nvlope, raw['header'] || {}) end
mail_message()
click to toggle source
# File lib/nvlope/message.rb, line 58 def mail_message mail_message = Mail::Message.new mail_message.date = header.date mail_message.from = header.from mail_message.reply_to = header.reply_to mail_message.to = header.to mail_message.message_id = header.message_id mail_message.in_reply_to = header.in_reply_to mail_message.references = references mail_message.subject = subject mail_message.mime_version = header.mime_version mail_message.content_type = header.content_type mail_message.body = text html = self.html mail_message.html_part do content_type "text/html; charset=#{html.encoding.to_s}" body html end unless html.nil? # files.each add attachment mail_message end
recipients()
click to toggle source
# File lib/nvlope/message.rb, line 37 def recipients @recipients ||= Array(raw['recipients']).map do |recipient| Nvlope::EmailAddress.new(recipient['name'], recipient['address']) end end
sender()
click to toggle source
# File lib/nvlope/message.rb, line 33 def sender @sender ||= Nvlope::EmailAddress.new(raw['sender']['name'], raw['sender']['address']) end