Class: Imap::Backup::Email::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/imap/backup/email/provider.rb,
lib/imap/backup/email/provider/base.rb

Overview

Provides a class factory for email account providers

Defined Under Namespace

Classes: AppleMail, Base, Fastmail, GMail, Purelymail, Unknown

Class Method Summary collapse

Class Method Details

.for_address(address) ⇒ Email::Provider::Fastmail, ...

Returns an instance supplying default values for the email’s account set up.

Parameters:

  • address (String)

    an email address

Returns:



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/imap/backup/email/provider.rb', line 18

def self.for_address(address)
  # rubocop:disable Lint/DuplicateBranch
  case
  when address.end_with?("@fastmail.com")
    Email::Provider::Fastmail.new
  when address.end_with?("@fastmail.fm")
    Email::Provider::Fastmail.new
  when address.end_with?("@gmail.com")
    Email::Provider::GMail.new
  when address.end_with?("@icloud.com")
    Email::Provider::AppleMail.new
  when address.end_with?("@mac.com")
    Email::Provider::AppleMail.new
  when address.end_with?("@me.com")
    Email::Provider::AppleMail.new
  when address.end_with?("@purelymail.com")
    Email::Provider::Purelymail.new
  else
    Email::Provider::Unknown.new
  end
  # rubocop:enable Lint/DuplicateBranch
end