Sha256: 20ec0c886e080569d1909437fc604953493956971a8fdb9511bb874108515264

Contents?: true

Size: 650 Bytes

Versions: 4

Compression:

Stored size: 650 Bytes

Contents

module Email; end

class Email::Provider
  def self.for_address(address)
    case 
    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
    case provider
    when :gmail
      {port: 993, ssl: true}
    when :fastmail
      {port: 993, ssl: true}
    else
      {port: 993, ssl: true}
    end
  end

  def host
    case provider
    when :gmail
      'imap.gmail.com'
    when :fastmail
      'mail.messagingengine.com'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
imap-backup-1.2.2 lib/email/provider.rb
imap-backup-1.2.1 lib/email/provider.rb
imap-backup-1.2.0 lib/email/provider.rb
imap-backup-1.1.0 lib/email/provider.rb