Class: Gmail::Client::Plain
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
-
#password ⇒ Object
readonly
Returns the value of attribute password.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(username, password, options = {}) ⇒ Plain
constructor
A new instance of Plain.
- #login(raise_errors = false) ⇒ Object
Methods inherited from Base
#compose, #connect, #connect!, #connection, #deliver, #deliver!, #disconnect, #fill_username, #find, #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, = {}) @password = password super(username, ) end |
Instance Attribute Details
#password ⇒ Object (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 16 17 18 19 |
# File 'lib/gmail/client/plain.rb', line 11 def login(raise_errors = false) @imap and @logged_in = (login = @imap.login(username, password)) && login.name == 'OK' rescue Net::IMAP::NoResponseError => e if raise_errors = "Couldn't login to given Gmail account: #{username}" += " (#{e.response.data.text.strip})" raise(AuthorizationError.new(e.response), , e.backtrace) end end |