Skip to content

Instantly share code, notes, and snippets.

@anthonycintron
Created July 23, 2010 02:05
Show Gist options
  • Save anthonycintron/486917 to your computer and use it in GitHub Desktop.
Save anthonycintron/486917 to your computer and use it in GitHub Desktop.
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