Created
July 23, 2010 02:05
-
-
Save anthonycintron/486917 to your computer and use it in GitHub Desktop.
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' | |
require 'json' | |
class GithubAPI | |
attr_reader :response, :host, :api, :format | |
def initialize | |
@host = "github.com" | |
@api = "/api/v2" | |
@format = "json" | |
end | |
def get_user_info (user_name, password, token) | |
connect "#{api}/#{format}/user/show/", user_name, password, token | |
end | |
def get_all_commit_history (value) | |
end | |
private | |
def connect (command, user_name, password, token) | |
Net::HTTP.start(@host) do |http| | |
req = Net::HTTP::Get.new("#{command}#{user_name}?token='#{token}'") | |
req.basic_auth user_name, password | |
@response = http.request(req) | |
@user = JSON.parse(@response.body) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment