Class: Gmailish::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/gmailish/account.rb

Constant Summary collapse

ADDRESS =
'imap.gmail.com'
PORT =
993
UNREAD =
'UNSEEN'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username, password) ⇒ Account

Returns a new instance of Account.



7
8
9
10
# File 'lib/gmailish/account.rb', line 7

def initialize(username, password)
  @username = username
  @password = password
end

Class Method Details

.process(username, password) ⇒ Object



12
13
14
# File 'lib/gmailish/account.rb', line 12

def self.process(username, password)
  new(username, password).process
end

Instance Method Details

#messagesObject



21
22
23
24
25
# File 'lib/gmailish/account.rb', line 21

def messages
  @messages ||= .uid_search([UNREAD]).map do |uid|
    Message.process(, uid)
  end
end

#processObject



16
17
18
19
# File 'lib/gmailish/account.rb', line 16

def process
  actions.process { messages }
  self
end