Skip to content

Instantly share code, notes, and snippets.

@fxposter
Created October 29, 2011 18:41
Show Gist options
  • Save fxposter/1324914 to your computer and use it in GitHub Desktop.
Save fxposter/1324914 to your computer and use it in GitHub Desktop.
module Api
extend self
def repository(owner, name)
fetch("repos/show/#{owner}/#{name}")['repository']
end
def organization(name)
fetch("organizations/#{name}/public_members")
end
def user(name)
fetch("user/show/#{name}")['user']
end
private
def fetch(path)
uri = URI.parse("http://github.com/api/v2/json/#{path}")
response = Net::HTTP.get_response(uri)
ActiveSupport::JSON.decode(response.body)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment