Class: Imap::Backup::Account::Backup
- Inherits:
-
Object
- Object
- Imap::Backup::Account::Backup
- Defined in:
- lib/imap/backup/account/backup.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#refresh ⇒ Object
readonly
Returns the value of attribute refresh.
Instance Method Summary collapse
-
#initialize(account:, refresh: false) ⇒ Backup
constructor
A new instance of Backup.
- #run ⇒ Object
Constructor Details
#initialize(account:, refresh: false) ⇒ Backup
Returns a new instance of Backup.
18 19 20 21 |
# File 'lib/imap/backup/account/backup.rb', line 18 def initialize(account:, refresh: false) @account = account @refresh = refresh end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
15 16 17 |
# File 'lib/imap/backup/account/backup.rb', line 15 def account @account end |
#refresh ⇒ Object (readonly)
Returns the value of attribute refresh.
16 17 18 |
# File 'lib/imap/backup/account/backup.rb', line 16 def refresh @refresh end |
Instance Method Details
#run ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/imap/backup/account/backup.rb', line 23 def run Logger.logger.info "Running backup of account: #{account.username}" # start the connection so we get logging messages in the right order account.client Account::FolderEnsurer.new(account: account).run Account::LocalOnlyFolderDeleter.new(account: account).run if account.mirror_mode backup_folders = Account::BackupFolders.new( client: account.client, account: account ) if backup_folders.none? Logger.logger.warn "Account #{account.username}: No folders found to backup" return end backup_folders.each do |folder| backup_folder folder end end |