Class: WatirmarkEmail::Email

Inherits:
Object
  • Object
show all
Defined in:
lib/watirmark_email/email_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(envelope, body_text, body_raw, uid) ⇒ Email

Returns a new instance of Email.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/watirmark_email/email_collection.rb', line 5

def initialize(envelope, body_text, body_raw, uid)
  @to = []
  @date = envelope.date
  @subject = envelope.subject
  envelope.to.each do |recipient|
    @to << "#{recipient.mailbox}@#{recipient.host}"
  end
  @from = "#{envelope.from.first.mailbox}@#{envelope.from.first.host}"
  @message_id = envelope.message_id
  @body_text = body_text
  @body_raw = body_raw
  @uid = uid
end

Instance Attribute Details

#body_rawObject

Returns the value of attribute body_raw.



3
4
5
# File 'lib/watirmark_email/email_collection.rb', line 3

def body_raw
  @body_raw
end

#body_textObject

Returns the value of attribute body_text.



3
4
5
# File 'lib/watirmark_email/email_collection.rb', line 3

def body_text
  @body_text
end

#dateObject

Returns the value of attribute date.



3
4
5
# File 'lib/watirmark_email/email_collection.rb', line 3

def date
  @date
end

#fromObject

Returns the value of attribute from.



3
4
5
# File 'lib/watirmark_email/email_collection.rb', line 3

def from
  @from
end

#message_idObject

Returns the value of attribute message_id.



3
4
5
# File 'lib/watirmark_email/email_collection.rb', line 3

def message_id
  @message_id
end

#subjectObject

Returns the value of attribute subject.



3
4
5
# File 'lib/watirmark_email/email_collection.rb', line 3

def subject
  @subject
end

#toObject

Returns the value of attribute to.



3
4
5
# File 'lib/watirmark_email/email_collection.rb', line 3

def to
  @to
end

#uidObject

Returns the value of attribute uid.



3
4
5
# File 'lib/watirmark_email/email_collection.rb', line 3

def uid
  @uid
end

Instance Method Details

#<=>(other) ⇒ Object



19
20
21
# File 'lib/watirmark_email/email_collection.rb', line 19

def <=> (other)
  date <=> other.date
end