Class: Netposti::Inbox

Inherits:
Object
  • Object
show all
Defined in:
lib/netposti/inbox.rb

Instance Method Summary collapse

Constructor Details

#initialize(inbox) ⇒ Inbox

Returns a new instance of Inbox.



6
7
8
# File 'lib/netposti/inbox.rb', line 6

def initialize(inbox)
  @inbox = inbox
end

Instance Method Details

#last_messageObject



22
23
24
# File 'lib/netposti/inbox.rb', line 22

def last_message
  messages.first(1).first
end

#messagesObject



14
15
16
# File 'lib/netposti/inbox.rb', line 14

def messages
  @_messages ||= @inbox.links_with(:href => /(.*?)listview(.*?)openMessage$/).lazy.map { |message| Message.new(message.click) }
end

#number_of_unread_messagesObject



10
11
12
# File 'lib/netposti/inbox.rb', line 10

def number_of_unread_messages
  @inbox.search('.unread').count
end

#unread_messagesObject



18
19
20
# File 'lib/netposti/inbox.rb', line 18

def unread_messages
  messages.first(number_of_unread_messages)
end