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

Defined Under Namespace

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

Class Method Summary collapse

Class Method Details

.for_address(address) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/imap/backup/email/provider.rb', line 13

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