Class: Imap::Backup::Client::Default
- Inherits:
-
Object
- Object
- Imap::Backup::Client::Default
- Extended by:
- Forwardable
- Defined in:
- lib/imap/backup/client/default.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
-
#disconnect ⇒ Object
Track mailbox selection during delegation to Net::IMAP instance.
- #examine(mailbox) ⇒ Object
-
#initialize(server, account, options) ⇒ Default
constructor
A new instance of Default.
- #list ⇒ Object
- #login ⇒ Object
- #reconnect ⇒ Object
- #select(mailbox) ⇒ Object
- #username ⇒ Object
Constructor Details
#initialize(server, account, options) ⇒ Default
Returns a new instance of Default.
21 22 23 24 25 26 |
# File 'lib/imap/backup/client/default.rb', line 21 def initialize(server, account, ) @account = account @options = @server = server @state = nil end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
16 17 18 |
# File 'lib/imap/backup/client/default.rb', line 16 def account @account end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
17 18 19 |
# File 'lib/imap/backup/client/default.rb', line 17 def @options end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
18 19 20 |
# File 'lib/imap/backup/client/default.rb', line 18 def server @server end |
#state ⇒ Object
Returns the value of attribute state.
19 20 21 |
# File 'lib/imap/backup/client/default.rb', line 19 def state @state end |
Instance Method Details
#disconnect ⇒ Object
Track mailbox selection during delegation to Net::IMAP instance
54 55 56 57 |
# File 'lib/imap/backup/client/default.rb', line 54 def disconnect imap.disconnect self.state = nil end |
#examine(mailbox) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/imap/backup/client/default.rb', line 59 def examine(mailbox) return if state == [:examine, mailbox] result = imap.examine(mailbox) self.state = [:examine, mailbox] result end |
#list ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/imap/backup/client/default.rb', line 28 def list root = provider_root mailbox_lists = imap.list(root, "*") return [] if mailbox_lists.nil? mailbox_lists.map { |ml| extract_name(ml) } end |
#login ⇒ Object
37 38 39 40 41 |
# File 'lib/imap/backup/client/default.rb', line 37 def login Logger.logger.debug "Logging in: #{account.username}/#{masked_password}" imap.login(account.username, account.password) Logger.logger.debug "Login complete" end |
#reconnect ⇒ Object
43 44 45 46 |
# File 'lib/imap/backup/client/default.rb', line 43 def reconnect disconnect login end |
#select(mailbox) ⇒ Object
67 68 69 70 71 72 |
# File 'lib/imap/backup/client/default.rb', line 67 def select(mailbox) return if state == [:select, mailbox] imap.select(mailbox) self.state = [:select, mailbox] end |
#username ⇒ Object
48 49 50 |
# File 'lib/imap/backup/client/default.rb', line 48 def username account.username end |