Sha256: 4697bd2b080c19dbc90dc079d3d349c36d4b624249d539970ef3233107be3711

Contents?: true

Size: 596 Bytes

Versions: 7

Compression:

Stored size: 596 Bytes

Contents

module Email; end

class Email::Provider
  def self.for_address(address)
    case
    when address.end_with?("@fastmail.com")
      new(:fastmail)
    when address.end_with?("@gmail.com")
      new(:gmail)
    when address.end_with?("@fastmail.fm")
      new(:fastmail)
    else
      new(:default)
    end
  end

  attr_reader :provider

  def initialize(provider)
    @provider = provider
  end

  def options
    {port: 993, ssl: {ssl_version: :TLSv1_2}}
  end

  def host
    case provider
    when :gmail
      "imap.gmail.com"
    when :fastmail
      "imap.fastmail.com"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
imap-backup-2.2.2 lib/email/provider.rb
imap-backup-2.2.1 lib/email/provider.rb
imap-backup-2.2.0 lib/email/provider.rb
imap-backup-2.1.1 lib/email/provider.rb
imap-backup-2.1.0 lib/email/provider.rb
imap-backup-2.0.0 lib/email/provider.rb
imap-backup-2.0.0.rc4 lib/email/provider.rb