Skip to content

Instantly share code, notes, and snippets.

@matsuda
Created April 27, 2009 06:06
Show Gist options
  • Save matsuda/102355 to your computer and use it in GitHub Desktop.
Save matsuda/102355 to your computer and use it in GitHub Desktop.
# github_api.rb
require 'rubygems'
require 'uri'
require 'net/http'
require 'yaml'
Net::HTTP.version_1_2
class GitHubApi
def repository(user_name, repos_name)
uri = "http://github.com/api/v2/yaml/repos/show/#{user_name}/#{repos_name}"
uri = URI.parse(uri)
http = Net::HTTP.new(uri.host, uri.port)
response = http.get(uri.path)
YAML.load(response.body)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment