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 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.
18 19 20 21 22 23 |
# File 'lib/imap/backup/client/default.rb', line 18 def initialize(server, account, ) @account = account @options = @server = server @state = nil end |
Instance Method Details
#disconnect ⇒ Object
Track mailbox selection during delegation to Net::IMAP instance
51 52 53 54 |
# File 'lib/imap/backup/client/default.rb', line 51 def disconnect imap.disconnect self.state = nil end |
#examine(mailbox) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/imap/backup/client/default.rb', line 56 def examine(mailbox) return if state == [:examine, mailbox] result = imap.examine(mailbox) self.state = [:examine, mailbox] result end |
#list ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/imap/backup/client/default.rb', line 25 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
34 35 36 37 38 |
# File 'lib/imap/backup/client/default.rb', line 34 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
40 41 42 43 |
# File 'lib/imap/backup/client/default.rb', line 40 def reconnect disconnect login end |
#select(mailbox) ⇒ Object
64 65 66 67 68 69 |
# File 'lib/imap/backup/client/default.rb', line 64 def select(mailbox) return if state == [:select, mailbox] imap.select(mailbox) self.state = [:select, mailbox] end |
#username ⇒ Object
45 46 47 |
# File 'lib/imap/backup/client/default.rb', line 45 def username account.username end |