Class: Imap::Backup::Account::ClientFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/imap/backup/account/client_factory.rb

Overview

Returns an IMAP client set up for the supplied account

Instance Method Summary collapse

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 = 
  @provider = nil
  @server = nil
end

Instance Method Details

#runClient::AutomaticLoginWrapper

Returns a client for the account.

Returns:



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
  options = provider_options
  Logger.logger.debug(
    "Creating IMAP instance: #{server}, options: #{options.inspect}"
  )
  client =
    if provider.is_a?(Email::Provider::AppleMail)
      Client::AppleMail.new(server, , options)
    else
      Client::Default.new(server, , options)
    end
  Client::AutomaticLoginWrapper.new(client: client)
end