Class: Email::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/email/provider.rb,
lib/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



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/email/provider.rb', line 10

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