Class: Gmail::Client::Plain

Inherits:
Base
  • Object
show all
Defined in:
lib/gmail/client/plain.rb

Constant Summary

Constants inherited from Base

Base::GMAIL_IMAP_HOST, Base::GMAIL_IMAP_PORT, Base::GMAIL_SMTP_HOST, Base::GMAIL_SMTP_PORT

Instance Attribute Summary collapse

Attributes inherited from Base

#options, #username

Instance Method Summary collapse

Methods inherited from Base

#compose, #connect, #connect!, #connection, #deliver, #deliver!, #fill_username, #inbox, #inspect, #labels, #logged_in?, #login!, #logout, #mail_domain, #mailbox, #mailboxes

Constructor Details

#initialize(username, password, options = {}) ⇒ Plain

Returns a new instance of Plain.



6
7
8
9
# File 'lib/gmail/client/plain.rb', line 6

def initialize(username, password, options={})
  @password = password
  super(username, options)
end

Instance Attribute Details

#passwordObject (readonly)

Returns the value of attribute password.



4
5
6
# File 'lib/gmail/client/plain.rb', line 4

def password
  @password
end

Instance Method Details

#login(raise_errors = false) ⇒ Object



11
12
13
14
15
# File 'lib/gmail/client/plain.rb', line 11

def (raise_errors=false)
  @imap and @logged_in = ( = @imap.(username, password)) && .name == 'OK'
rescue Net::IMAP::NoResponseError
  raise_errors and raise AuthorizationError, "Couldn't login to given GMail account: #{username}"
end