Skip to content

Commit

Permalink
fix guess and login methods to use options
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Carlson committed Jan 26, 2010
1 parent 9fc0252 commit 19c2b6a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/contacts/base.rb
Expand Up @@ -197,18 +197,18 @@ class ConnectionError < ContactsError
class TypeNotFound < ContactsError
end

def self.new(type, login, password)
def self.new(type, login, password, options={})
if TYPES.include?(type.to_s.intern)
TYPES[type.to_s.intern].new(login, password)
TYPES[type.to_s.intern].new(login, password, options)
else
raise TypeNotFound, "#{type.inspect} is not a valid type, please choose one of the following: #{TYPES.keys.inspect}"
end
end

def self.guess(login, password)
def self.guess(login, password, options={})
TYPES.inject([]) do |a, t|
begin
a + t[1].new(login, password).contacts
a + t[1].new(login, password, options).contacts
rescue AuthenticationError
a
end
Expand Down

0 comments on commit 19c2b6a

Please sign in to comment.