Class: EveGate::Mail
- Inherits:
-
Object
- Object
- EveGate::Mail
- Defined in:
- lib/eve_gate.rb
Instance Attribute Summary collapse
-
#read ⇒ Object
Returns the value of attribute read.
-
#receipient ⇒ Object
Returns the value of attribute receipient.
-
#subject ⇒ Object
Returns the value of attribute subject.
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(mail, agent) ⇒ Mail
constructor
attr_writer :body, :sender, :to.
- #sender ⇒ Object
- #to ⇒ Object
- #update_details ⇒ Object
Constructor Details
#initialize(mail, agent) ⇒ Mail
attr_writer :body, :sender, :to
9 10 11 12 13 14 15 16 |
# File 'lib/eve_gate.rb', line 9 def initialize(mail, agent) @read = mail.children[2].children[1].attributes['alt'].text == 'Read' @sender = mail.children[4].children[1].text.strip @subject = mail.children[6].children[1].children[1].text @url = mail.children[6].children[1].children[1].attributes['href'].value @date = DateTime.parse(mail.children[8].text).to_time @agent = agent end |
Instance Attribute Details
#read ⇒ Object
Returns the value of attribute read.
7 8 9 |
# File 'lib/eve_gate.rb', line 7 def read @read end |
#receipient ⇒ Object
Returns the value of attribute receipient.
7 8 9 |
# File 'lib/eve_gate.rb', line 7 def receipient @receipient end |
#subject ⇒ Object
Returns the value of attribute subject.
7 8 9 |
# File 'lib/eve_gate.rb', line 7 def subject @subject end |
Instance Method Details
#body ⇒ Object
18 19 20 21 |
# File 'lib/eve_gate.rb', line 18 def body update_details unless @body @body end |
#sender ⇒ Object
23 24 25 26 |
# File 'lib/eve_gate.rb', line 23 def sender update_details unless @sender @sender end |
#to ⇒ Object
28 29 30 31 |
# File 'lib/eve_gate.rb', line 28 def to update_details unless @to @to end |
#update_details ⇒ Object
33 34 35 36 37 38 |
# File 'lib/eve_gate.rb', line 33 def update_details @agent.get(@url) @body = @agent.page.search(".//div[@id='hideBottomButtons']/p")[1].inner_html @to = @agent.page.search(".//div[@id='hideBottomButtons']/p[1]/a")[1].text @sender = @agent.page.search(".//div[@id='hideBottomButtons']/p[1]/a")[0].text end |