GitHub API v3 Wrapper
This is a simple wrapper for GitHub's v3 API. It is in the EARLY stages of development. Knowing a little about GitHub's API will aid in its use.
Installation
As of right now, the library has not reached a version which I consider worth pushing to RubyGems.org. Feel free to clone the repository and build the gem and install it if you wish:
$ git clone https://github.com/caseyscarborough/github && cd github
$ gem build github-api-v3.gemspec
$ gem install github-api-v3-0.0.1.gem
Usage
Add the following line to your gemfile:
gem 'github-api-v3'
or install it manually:
$ gem install github-api-v3
Then you can proceed to use it in the following manner:
User
Returns a Hash containing information about a user.
user = GitHub.user('caseyscarborough')
user.login # => "caseyscarborough"
user.name # => "Casey Scarborough"
user.html_url # => "https://github.com/caseyscarborough"
user.following # => 23
# etc...
You can find the available attributes here.
Events
Returns an array of events for a particular user.
events = GitHub.events('caseyscarborough')
events.each { |e| puts e.type }
Followers
Returns an array of followers for a user.
followers = GitHub.followers('caseyscarborough')
followers.each { |f| puts f.login }
Repositories
Returns an array of repositories that belong to a user.
repos = GitHub.repos('caseyscarborough')
repos.each { |r| puts r.name }
Authenticated Requests
Some methods, such as retrieving private repos or emails, require authentication. To create one of these requests, you'll need to pass in your login and access token. You can create a personal access token on your account page.
client = GitHub::Client.new(login: 'username', access_token: 'abcdefghijklmnopqrstuvwxyz12345')
client.emails # => ["[email protected]", "[email protected]"]
More functionality to come.
To Do
The better question is... What's not to do? Any functionality of the API listed at developer.github.com that isn't currently in effect.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request