Created
May 11, 2012 18:17
-
-
Save DiogoAndre/2661478 to your computer and use it in GitHub Desktop.
Authenticated API call to the GitHub Users v3 API in Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
uri = URI('https://api.github.com/user') | |
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http| | |
request = Net::HTTP::Get.new uri.request_uri | |
request.basic_auth 'username', 'password' | |
response = http.request request | |
puts response.body | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment