Class: Imap::Backup::Account::ClientFactory
- Inherits:
-
Object
- Object
- Imap::Backup::Account::ClientFactory
- Includes:
- RetryOnError
- Defined in:
- lib/imap/backup/account/client_factory.rb
Constant Summary collapse
- LOGIN_RETRY_CLASSES =
[::EOFError, ::Errno::ECONNRESET, ::SocketError].freeze
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
Instance Method Summary collapse
-
#initialize(account:) ⇒ ClientFactory
constructor
A new instance of ClientFactory.
- #run ⇒ Object
Methods included from RetryOnError
Constructor Details
#initialize(account:) ⇒ ClientFactory
Returns a new instance of ClientFactory.
20 21 22 23 24 |
# File 'lib/imap/backup/account/client_factory.rb', line 20 def initialize(account:) @account = account @provider = nil @server = nil end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
18 19 20 |
# File 'lib/imap/backup/account/client_factory.rb', line 18 def account @account end |
Instance Method Details
#run ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/imap/backup/account/client_factory.rb', line 26 def run retry_on_error(errors: LOGIN_RETRY_CLASSES) do = Logger.logger.debug( "Creating IMAP instance: #{server}, options: #{.inspect}" ) client = if provider.is_a?(Email::Provider::AppleMail) Client::AppleMail.new(server, account, ) else Client::Default.new(server, account, ) end client.login client end end |