Minor fixes for twitter4r/twitter4r-core/issues/11
[twitter4r-core.git] / lib / twitter / client / auth.rb
blob4d2225d2a67169e51308f40b8c53c1c4ba640526
1 class Twitter::Client
2   @@AUTHENTICATION_URIS = {
3     :verify => '/account/verify_credentials',
4   }
6   # Provides access to the Twitter verify credentials API.
7   # 
8   # You can verify Twitter user credentials with minimal overhead using this method.
9   # 
10   # Example:
11   #  client.authenticate?("osxisforlightweights", "l30p@rd_s^cks!")
12   def authenticate?(login, password)
13     verify_credentials(login, password)
14   end
16   private
17   def verify_credentials(username, passwd)
18     response = rest_oauth_connect(:get, "#{@@AUTHENTICATION_URIS[:verify]}.json")
19     response.is_a?(Net::HTTPSuccess) ? true : false
20   end
21 end