Created
November 11, 2012 22:18
-
-
Save jeffreyiacono/4056476 to your computer and use it in GitHub Desktop.
Get github information for a user
This file contains hidden or 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' | |
| require 'uri' | |
| require 'io/console' | |
| puts "Enter in a github username:" | |
| gh_username = gets.chomp | |
| puts "Enter in the github user password (hidden):" | |
| gh_password = STDIN.noecho(&:gets).chomp | |
| uri = URI.parse('https://api.github.com/user') | |
| http = Net::HTTP.new(uri.host, uri.port) | |
| http.use_ssl = true | |
| req = Net::HTTP::Get.new(uri.request_uri) | |
| req.basic_auth(gh_username, gh_password) | |
| r = http.request(req) | |
| puts r.body |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment