README.md in octokit-1.24.0 vs README.md in octokit-1.25.0

- old
+ new

@@ -1,69 +1,54 @@ # Octokit -[![Gem Version](https://badge.fury.io/rb/octokit.png)][gem] -[![Build Status](https://secure.travis-ci.org/pengwynn/octokit.png?branch=master)][travis] -[![Dependency Status](https://gemnasium.com/pengwynn/octokit.png?travis)][gemnasium] -[![Code Climate](https://codeclimate.com/github/pengwynn/octokit.png)][codeclimate] -[![Coverage Status](https://coveralls.io/repos/pengwynn/octokit/badge.png?branch=master)][coveralls] +Simple Ruby wrapper for the GitHub API. -[gem]: https://rubygems.org/gems/octokit -[travis]: http://travis-ci.org/pengwynn/octokit -[gemnasium]: https://gemnasium.com/pengwynn/octokit -[codeclimate]: https://codeclimate.com/github/pengwynn/octokit -[coveralls]: https://coveralls.io/r/pengwynn/octokit - -Simple Ruby wrapper for the GitHub v3 API. - ## Installation + gem install octokit ## Documentation + [http://rdoc.info/gems/octokit][documentation] [documentation]: http://rdoc.info/gems/octokit -## Examples -### Show a user -```ruby -Octokit.user("sferik") -=> <#Hashie::Rash blog="http://twitter.com/sferik" company="Code for America" created_at="2008/05/14 13:36:12 -0700" email="sferik@gmail.com" followers_count=177 following_count=83 gravatar_id="1f74b13f1e5c6c69cb5d7fbaabb1e2cb" id=10308 location="San Francisco" login="sferik" name="Erik Michaels-Ober" permission=nil public_gist_count=16 public_repo_count=30 type="User"> -``` +### Examples -### Show who a user follows +#### Show a user + ```ruby -Octokit.following("sferik") -=> ["rails", "puls", "wycats", "dhh", "jm3", "joshsusser", "nkallen", "technoweenie", "blaine", "al3x", "defunkt", "schacon", "bmizerany", "rtomayko", "jpr5", "lholden", "140proof", "ephramzerb", "carlhuda", "carllerche", "jnunemaker", "josh", "hoverbird", "jamiew", "jeremyevans", "brynary", "mojodna", "mojombo", "joshbuddy", "igrigorik", "perplexes", "joearasin", "hassox", "nickmarden", "pengwynn", "mmcgrana", "reddavis", "reinh", "mzsanford", "aanand", "pjhyett", "kneath", "tekkub", "adamstac", "timtrueman", "aaronblohowiak", "josevalim", "kaapa", "hurrycane", "jackdempsey", "drogus", "cameronpriest", "danmelton", "marcel", "r", "atmos", "mbleigh", "isaacs", "maxogden", "codeforamerica", "chadk", "laserlemon", "gruber", "lsegal", "bblimke", "wayneeseguin", "brixen", "dkubb", "bhb", "bcardarella", "elliottcable", "fbjork", "mlightner", "dianakimball", "amerine", "danchoi", "develop", "dmfrancisco", "unruthless", "trotter", "hannestyden", "codahale", "ry"] +Octokit.user "sferik" +=> #<Hashie::Mash avatar_url="https://secure.gravatar.com/avatar/1f74b13f1e5c6c69cb5d7fbaabb1e2cb?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" bio="" blog="http://twitter.com/sferik" company="" created_at="2008-05-14T20:36:12Z" email="sferik@gmail.com" events_url="https://api.github.com/users/sferik/events{/privacy}" followers=662 followers_url="https://api.github.com/users/sferik/followers" following=102 following_url="https://api.github.com/users/sferik/following{/other_user}" gists_url="https://api.github.com/users/sferik/gists{/gist_id}" gravatar_id="1f74b13f1e5c6c69cb5d7fbaabb1e2cb" hireable=false html_url="https://github.com/sferik" id=10308 location="San Francisco, CA" login="sferik" name="Erik Michaels-Ober" organizations_url="https://api.github.com/users/sferik/orgs" public_gists=59 public_repos=83 received_events_url="https://api.github.com/users/sferik/received_events" repos_url="https://api.github.com/users/sferik/repos" starred_url="https://api.github.com/users/sferik/starred{/owner}{/repo}" subscriptions_url="https://api.github.com/users/sferik/subscriptions" type="User" updated_at="2013-05-31T16:01:08Z" url="https://api.github.com/users/sferik"> ``` -### Repositories +#### Repositories + For convenience, methods that require a repository argument may be passed in any of the following forms: ```ruby -Octokit.repo("pengwynn/octokit") +Octokit.repo "octokit/octokit.rb" -Octokit.repo({:username => "pengwynn", :name => "octokit"}) +Octokit.repo {:username => "octokit", :name => "octokit.rb"} -Octokit.repo({:username => "pengwynn", :repo => "octokit"}) +Octokit.repo {:username => "octokit", :repo => "octokit.rb"} -Octokit.repo(Repository.new('pengwynn/octokit')) - -=> <#Hashie::Rash created_at="2009/12/10 13:41:49 -0800" description="Simple Ruby wrapper for the GitHub API and feeds" fork=false forks=25 has_downloads=true has_issues=true has_wiki=true homepage="http://wynnnetherland.com/projects/octokit" integrate_branch="master" language="Ruby" name="octokit" open_issues=8 owner="pengwynn" private=false pushed_at="2011/05/05 10:48:57 -0700" size=1804 url="https://github.com/pengwynn/octokit" watchers=92> +Octokit.repo Repository.new('octokit/octokit.rb') ``` -### List the commits for a repository +#### List the commits for a repository ```ruby -Octokit.commits("pengwynn/octokit") +Octokit.commits("octokit/octokit.rb") -Octokit.list_commits("pengwynn/octokit") +Octokit.list_commits("octokit/octokit.rb") -=> [#<Hashie::Mash author=#<Hashie::Mash avatar_url="https://secure.gravatar.com/avatar/7e19cd5486b5d6dc1ef90e671ba52ae0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" gravatar_id="7e19cd5486b5d6dc1ef90e671ba52ae0" id=865 login="pengwynn" url="https://api.github.com/users/pengwynn"> commit=#<Hashie::Mash author=#<Hashie::Mash date="2012-10-31T15:17:51Z" email="wynn@github.com" name="Wynn Netherland"> comment_count=0 committer=#<Hashie::Mash date="2012-10-31T15:17:51Z" email="wynn@github.com" name="Wynn Netherland"> message="Fix bug with archive_link for private repo" tree=#<Hashie::Mash sha="49bf2a476aa819f29b0fc1a8805f7567f010006d" url="https://api.github.com/repos/pengwynn/octokit/git/trees/49bf2a476aa819f29b0fc1a8805f7567f010006d"> url="https://api.github.com/repos/pengwynn/octokit/git/commits/8db3df37fad3a021eb8036b007c718149836cb32"> committer=#<Hashie::Mash avatar_url="https://secure.gravatar.com/avatar/7e19cd5486b5d6dc1ef90e671ba52ae0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" gravatar_id="7e19cd5486b5d6dc1ef90e671ba52ae0" id=865 login="pengwynn" url="https://api.github.com/users/pengwynn"> parents=[#<Hashie::Mash sha="7a67f4b47791cb77de33e491df87cef06012c79f" url="https://api.github.com/repos/pengwynn/octokit/commits/7a67f4b47791cb77de33e491df87cef06012c79f">] sha="8db3df37fad3a021eb8036b007c718149836cb32" url="https://api.github.com/repos/pengwynn/octokit/commits/8db3df37fad3a021eb8036b007c718149836cb32">, ... , ...] +=> [#<Hashie::Mash author=#<Hashie::Mash avatar_url="https://secure.gravatar.com/avatar/7e19cd5486b5d6dc1ef90e671ba52ae0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" gravatar_id="7e19cd5486b5d6dc1ef90e671ba52ae0" id=865 login="pengwynn" url="https://api.github.com/users/pengwynn"> commit=#<Hashie::Mash author=#<Hashie::Mash date="2012-10-31T15:17:51Z" email="wynn@github.com" name="Wynn Netherland"> comment_count=0 committer=#<Hashie::Mash date="2012-10-31T15:17:51Z" email="wynn@github.com" name="Wynn Netherland"> message="Fix bug with archive_link for private repo" tree=#<Hashie::Mash sha="49bf2a476aa819f29b0fc1a8805f7567f010006d" url="https://api.github.com/repos/octokit/octokit.rb/git/trees/49bf2a476aa819f29b0fc1a8805f7567f010006d"> url="https://api.github.com/repos/octokit/octokit.rb/git/commits/8db3df37fad3a021eb8036b007c718149836cb32"> committer=#<Hashie::Mash avatar_url="https://secure.gravatar.com/avatar/7e19cd5486b5d6dc1ef90e671ba52ae0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" gravatar_id="7e19cd5486b5d6dc1ef90e671ba52ae0" id=865 login="pengwynn" url="https://api.github.com/users/pengwynn"> parents=[#<Hashie::Mash sha="7a67f4b47791cb77de33e491df87cef06012c79f" url="https://api.github.com/repos/octokit/octokit.rb/commits/7a67f4b47791cb77de33e491df87cef06012c79f">] sha="8db3df37fad3a021eb8036b007c718149836cb32" url="https://api.github.com/repos/octokit/octokit.rb/commits/8db3df37fad3a021eb8036b007c718149836cb32">, ... , ...] ``` -## Authenticated Requests +#### Authenticated Requests For methods that require authentication, you'll need to setup a client with your login and password. ```ruby client = Octokit::Client.new(:login => "me", :password => "sekret") @@ -77,41 +62,22 @@ ```ruby client = Octokit::Client.new(:login => "me", :oauth_token => "oauth2token") client.follow("sferik") ``` -### Using `.netrc` for stored credentials +#### Requesting a specific media type -Octokit now supports [`.netrc`][netrc] files for storing your GitHub Basic Auth -credentials. Given a `~/.netrc` like the following - -[netrc]: http://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-File.html - -``` -machine api.github.com login pengwynn password 0ct0c4tz4ev3r! -``` - -You can make authenticated calls by telling Octokit to use credentials from -this file: - -```ruby -Octokit.netrc = true # or /path/to/file -Octokit.user # authenticates as 'pengwynn' user -``` - -## Requesting a specific media type - You can pass an `:accept` option value to request a particular [media type][media-types]. [media-types]: http://developer.github.com/v3/media/ ```ruby -Octokit.contents 'pengwynn/octokit', :path => 'README.md', :accept => 'application/vnd.github.html' +Octokit.contents 'octokit/octokit.rb', :path => 'README.md', :accept => 'application/vnd.github.html' ``` -## Using with GitHub Enterprise +### Using with GitHub Enterprise To use with [GitHub Enterprise](https://enterprise.github.com/), you'll need to set the API and web endpoints before instantiating a client. ```ruby @@ -171,24 +137,26 @@ ## Contributors Octokit was initially created by Wynn Netherland and [Adam Stacoviak](http://twitter.com/adamstac) but has -turned into a true community effort. Special thanks to the following core +turned into a true community effort. Special thanks to the following contributors: * [Erik Michaels-Ober](http://github.com/sferik) * [Clint Shryock](http://github.com/ctshryock) * [Joey Wendt](http://github.com/joeyw) ## Inspiration + Octokit was inspired by [Octopi][] and aims to be a lightweight, less-ActiveResourcey alternative. [octopi]: https://github.com/fcoury/octopi ## Copyright + Copyright (c) 2011-2013 Wynn Netherland, Adam Stacoviak, Erik Michaels-Ober. See [LICENSE][] for details. [license]: LICENSE.md