Class: Imap::Backup::Account::ClientFactory
- Inherits:
-
Object
- Object
- Imap::Backup::Account::ClientFactory
- Defined in:
- lib/imap/backup/account/client_factory.rb
Overview
Returns an IMAP client set up for the supplied account
Instance Method Summary collapse
-
#initialize(account:) ⇒ ClientFactory
constructor
A new instance of ClientFactory.
-
#run ⇒ Client::AutomaticLoginWrapper
A client for the account.
Constructor Details
#initialize(account:) ⇒ ClientFactory
Returns a new instance of ClientFactory.
15 16 17 18 19 |
# File 'lib/imap/backup/account/client_factory.rb', line 15 def initialize(account:) @account = account @provider = nil @server = nil end |
Instance Method Details
#run ⇒ Client::AutomaticLoginWrapper
Returns a client for the account.
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/imap/backup/account/client_factory.rb', line 22 def run = 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::AutomaticLoginWrapper.new(client: client) end |