Sha256: 9b95a20de9dab363c03714888b47d3f2ec0067cca0fdd5ed5b0855cb948b5c26

Contents?: true

Size: 857 Bytes

Versions: 1

Compression:

Stored size: 857 Bytes

Contents

module Gmail
  module Client
    # Raised when connection with GMail IMAP service couldn't be established. 
    class ConnectionError < SocketError; end
    # Raised when given username or password are invalid.
    class AuthorizationError < Net::IMAP::NoResponseError; end
    # Raised when delivered email is invalid. 
    class DeliveryError < ArgumentError; end
    # Raised when given client is not registered
    class UnknownClient < ArgumentError; end

    def self.register(name, klass)
      @clients ||= {}
      @clients[name] = klass
    end

    def self.new(name, *args)
      if client = @clients[name]
        client.new(*args)
      else
        raise UnknownClient, "No such client: #{name}" 
      end
    end

    require 'gmail/client/base'
    require 'gmail/client/plain'
    require 'gmail/client/xoauth'
  end # Client
end # Gmail

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gmail-afurmanov-0.1.0 lib/gmail/client.rb