Sha256: 0b4f60a0ff8034e9cd81586a2d323a8b79018d00959f2f04c59a1335eb226747

Contents?: true

Size: 761 Bytes

Versions: 9

Compression:

Stored size: 761 Bytes

Contents

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.
  #
	# Example:
	#  client.authenticate?("osxisforlightweights", "l30p@rd_s^cks!")
	def authenticate?(login, password)
    verify_credentials(login, password)
	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
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
cerberus-0.8.0 lib/vendor/twitter/lib/twitter/client/auth.rb
cerberus-0.7.9 lib/vendor/twitter/lib/twitter/client/auth.rb
edavis10-cerberus-0.7.8 lib/vendor/twitter/lib/twitter/client/auth.rb
cerberus-0.7.8 lib/vendor/twitter/lib/twitter/client/auth.rb
cerberus-0.7.7 lib/vendor/twitter/lib/twitter/client/auth.rb
cerberus-0.7.6 lib/vendor/twitter/lib/twitter/client/auth.rb
cerberus-0.7.2 lib/vendor/twitter/lib/twitter/client/auth.rb
cerberus-0.7.5 lib/vendor/twitter/lib/twitter/client/auth.rb
cerberus-0.7 lib/vendor/twitter/lib/twitter/client/auth.rb