lib/twitter/client/auth.rb in twitter4r-0.3.2 vs lib/twitter/client/auth.rb in twitter4r-0.5.0
- old
+ new
@@ -1,27 +1,21 @@
class Twitter::Client
@@AUTHENTICATION_URIS = {
:verify => '/account/verify_credentials',
}
-
- # Provides access to the Twitter verify credentials API.
- #
- # You can verify Twitter user credentials with minimal overhead using this method.
+
+ # Provides access to the Twitter verify credentials API.
#
- # Example:
- # client.authenticate?("osxisforlightweights", "l30p@rd_s^cks!")
- def authenticate?(login, password)
+ # You can verify Twitter user credentials with minimal overhead using this method.
+ #
+ # Example:
+ # client.authenticate?("osxisforlightweights", "l30p@rd_s^cks!")
+ def authenticate?(login, password)
verify_credentials(login, password)
- end
-
-private
+ end
+
+ private
def verify_credentials(username, passwd)
- connection = create_http_connection
- connection.start do |connection|
- request = create_http_get_request("#{@@AUTHENTICATION_URIS[:verify]}.json")
- request.basic_auth(username, passwd)
- response = connection.request(request)
- response.is_a?(Net::HTTPSuccess) ? true : false
- end
+ response = rest_oauth_connect(:get, "#{@@AUTHENTICATION_URIS[:verify]}.json")
+ response.is_a?(Net::HTTPSuccess) ? true : false
end
end
-