Class: Mailarchiva::Message
- Inherits:
-
Object
- Object
- Mailarchiva::Message
- Defined in:
- lib/mailarchiva/message.rb
Instance Attribute Summary collapse
-
#archivedate ⇒ Object
Returns the value of attribute archivedate.
-
#bcc ⇒ Object
Returns the value of attribute bcc.
-
#blob_id ⇒ Object
Returns the value of attribute blob_id.
-
#cc ⇒ Object
Returns the value of attribute cc.
-
#client ⇒ Object
Returns the value of attribute client.
-
#deliveredto ⇒ Object
Returns the value of attribute deliveredto.
-
#from ⇒ Object
Returns the value of attribute from.
-
#mailfrom ⇒ Object
Returns the value of attribute mailfrom.
-
#messageid ⇒ Object
Returns the value of attribute messageid.
-
#rcptto ⇒ Object
Returns the value of attribute rcptto.
-
#receiveddate ⇒ Object
Returns the value of attribute receiveddate.
-
#sentdate ⇒ Object
Returns the value of attribute sentdate.
-
#size ⇒ Object
Returns the value of attribute size.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#to ⇒ Object
Returns the value of attribute to.
-
#volume_id ⇒ Object
Returns the value of attribute volume_id.
Instance Method Summary collapse
-
#initialize(client, field_values) ⇒ Message
constructor
A new instance of Message.
- #mail_message ⇒ Object
- #raw_from ⇒ Object
- #raw_message ⇒ Object
- #raw_to ⇒ Object
- #undisclosed_recipients? ⇒ Boolean
Constructor Details
#initialize(client, field_values) ⇒ Message
Returns a new instance of Message.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mailarchiva/message.rb', line 9 def initialize(client, field_values) @client = client field_values[:field_values].each do |field| key = field[:field] value = field[:value] case key when /date/ value = DateTime.parse(value) if value when /size/ value = value.to_i if value else value end instance_variable_set("@#{key}", value) if respond_to?(key.to_sym) end @blob_id = field_values[:id][:blob_id] @volume_id = field_values[:id][:volume_id] end |
Instance Attribute Details
#archivedate ⇒ Object
Returns the value of attribute archivedate.
7 8 9 |
# File 'lib/mailarchiva/message.rb', line 7 def archivedate @archivedate end |
#bcc ⇒ Object
Returns the value of attribute bcc.
7 8 9 |
# File 'lib/mailarchiva/message.rb', line 7 def bcc @bcc end |
#blob_id ⇒ Object
Returns the value of attribute blob_id.
7 8 9 |
# File 'lib/mailarchiva/message.rb', line 7 def blob_id @blob_id end |
#cc ⇒ Object
Returns the value of attribute cc.
7 8 9 |
# File 'lib/mailarchiva/message.rb', line 7 def cc @cc end |
#client ⇒ Object
Returns the value of attribute client.
7 8 9 |
# File 'lib/mailarchiva/message.rb', line 7 def client @client end |
#deliveredto ⇒ Object
Returns the value of attribute deliveredto.
7 8 9 |
# File 'lib/mailarchiva/message.rb', line 7 def deliveredto @deliveredto end |
#from ⇒ Object
Returns the value of attribute from.
7 8 9 |
# File 'lib/mailarchiva/message.rb', line 7 def from @from end |
#mailfrom ⇒ Object
Returns the value of attribute mailfrom.
7 8 9 |
# File 'lib/mailarchiva/message.rb', line 7 def mailfrom @mailfrom end |
#messageid ⇒ Object
Returns the value of attribute messageid.
7 8 9 |
# File 'lib/mailarchiva/message.rb', line 7 def @messageid end |
#rcptto ⇒ Object
Returns the value of attribute rcptto.
7 8 9 |
# File 'lib/mailarchiva/message.rb', line 7 def rcptto @rcptto end |
#receiveddate ⇒ Object
Returns the value of attribute receiveddate.
7 8 9 |
# File 'lib/mailarchiva/message.rb', line 7 def receiveddate @receiveddate end |
#sentdate ⇒ Object
Returns the value of attribute sentdate.
7 8 9 |
# File 'lib/mailarchiva/message.rb', line 7 def sentdate @sentdate end |
#size ⇒ Object
Returns the value of attribute size.
7 8 9 |
# File 'lib/mailarchiva/message.rb', line 7 def size @size end |
#subject ⇒ Object
Returns the value of attribute subject.
7 8 9 |
# File 'lib/mailarchiva/message.rb', line 7 def subject @subject end |
#to ⇒ Object
Returns the value of attribute to.
7 8 9 |
# File 'lib/mailarchiva/message.rb', line 7 def to @to end |
#volume_id ⇒ Object
Returns the value of attribute volume_id.
7 8 9 |
# File 'lib/mailarchiva/message.rb', line 7 def volume_id @volume_id end |
Instance Method Details
#mail_message ⇒ Object
52 53 54 |
# File 'lib/mailarchiva/message.rb', line 52 def @mail_message ||= @client.(@blob_id, @volume_id) end |
#raw_from ⇒ Object
28 29 30 |
# File 'lib/mailarchiva/message.rb', line 28 def raw_from @from end |
#raw_message ⇒ Object
48 49 50 |
# File 'lib/mailarchiva/message.rb', line 48 def @raw_message ||= @client.(@blob_id, @volume_id) end |
#raw_to ⇒ Object
36 37 38 |
# File 'lib/mailarchiva/message.rb', line 36 def raw_to @to end |
#undisclosed_recipients? ⇒ Boolean
56 57 58 |
# File 'lib/mailarchiva/message.rb', line 56 def undisclosed_recipients? raw_to.nil? || (raw_to =~ /undisclosed-recipients/i) == 1 end |