octokit 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +3 -2
- data/CHANGELOG.md +20 -0
- data/Gemfile +5 -1
- data/README.md +67 -0
- data/lib/faraday/response/raise_error.rb +1 -1
- data/lib/octokit/client/commits.rb +2 -2
- data/lib/octokit/client/connection.rb +5 -7
- data/lib/octokit/client/issues.rb +19 -19
- data/lib/octokit/client/network.rb +2 -2
- data/lib/octokit/client/objects.rb +6 -6
- data/lib/octokit/client/organizations.rb +18 -18
- data/lib/octokit/client/pulls.rb +3 -3
- data/lib/octokit/client/repositories.rb +29 -29
- data/lib/octokit/client/request.rb +20 -19
- data/lib/octokit/client/timelines.rb +5 -5
- data/lib/octokit/client/users.rb +15 -15
- data/lib/octokit/configuration.rb +4 -15
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +14 -14
- data/spec/fixtures/{blob.json → v2/blob.json} +0 -0
- data/spec/fixtures/{blob_metadata.json → v2/blob_metadata.json} +0 -0
- data/spec/fixtures/{blobs.json → v2/blobs.json} +0 -0
- data/spec/fixtures/{branches.json → v2/branches.json} +0 -0
- data/spec/fixtures/{collaborators.json → v2/collaborators.json} +0 -0
- data/spec/fixtures/{comment.json → v2/comment.json} +0 -0
- data/spec/fixtures/{comments.json → v2/comments.json} +0 -0
- data/spec/fixtures/{commit.json → v2/commit.json} +0 -0
- data/spec/fixtures/{commits.json → v2/commits.json} +0 -0
- data/spec/fixtures/{contributors.json → v2/contributors.json} +0 -0
- data/spec/fixtures/v2/delete_failure.json +1 -0
- data/spec/fixtures/{delete_token.json → v2/delete_token.json} +0 -0
- data/spec/fixtures/{emails.json → v2/emails.json} +0 -0
- data/spec/fixtures/{followers.json → v2/followers.json} +0 -0
- data/spec/fixtures/{following.json → v2/following.json} +0 -0
- data/spec/fixtures/{issue.json → v2/issue.json} +0 -0
- data/spec/fixtures/{issues.json → v2/issues.json} +0 -0
- data/spec/fixtures/{labels.json → v2/labels.json} +0 -0
- data/spec/fixtures/{languages.json → v2/languages.json} +0 -0
- data/spec/fixtures/{network.json → v2/network.json} +0 -0
- data/spec/fixtures/{network_data.json → v2/network_data.json} +0 -0
- data/spec/fixtures/{network_meta.json → v2/network_meta.json} +0 -0
- data/spec/fixtures/{organization.json → v2/organization.json} +0 -0
- data/spec/fixtures/{organizations.json → v2/organizations.json} +0 -0
- data/spec/fixtures/{public_keys.json → v2/public_keys.json} +0 -0
- data/spec/fixtures/{pull.json → v2/pull.json} +0 -0
- data/spec/fixtures/{pulls.json → v2/pulls.json} +0 -0
- data/spec/fixtures/{raw.txt → v2/raw.txt} +0 -0
- data/spec/fixtures/{repositories.json → v2/repositories.json} +0 -0
- data/spec/fixtures/{repository.json → v2/repository.json} +0 -0
- data/spec/fixtures/{tags.json → v2/tags.json} +0 -0
- data/spec/fixtures/{team.json → v2/team.json} +0 -0
- data/spec/fixtures/{teams.json → v2/teams.json} +0 -0
- data/spec/fixtures/{tree.json → v2/tree.json} +0 -0
- data/spec/fixtures/{tree_metadata.json → v2/tree_metadata.json} +0 -0
- data/spec/fixtures/{user.json → v2/user.json} +0 -0
- data/spec/fixtures/{users.json → v2/users.json} +0 -0
- data/spec/fixtures/{watchers.json → v2/watchers.json} +0 -0
- data/spec/fixtures/v3/issues.json +1580 -0
- data/spec/helper.rb +3 -3
- data/spec/octokit/client/commits_spec.rb +2 -2
- data/spec/octokit/client/issues_spec.rb +25 -26
- data/spec/octokit/client/network_spec.rb +2 -2
- data/spec/octokit/client/objects_spec.rb +6 -9
- data/spec/octokit/client/organizations_spec.rb +19 -19
- data/spec/octokit/client/pulls_spec.rb +3 -3
- data/spec/octokit/client/repositories_spec.rb +44 -31
- data/spec/octokit/client/users_spec.rb +21 -21
- data/spec/octokit/client_spec.rb +8 -7
- metadata +110 -96
- data/README.markdown +0 -73
- data/changelog.markdown +0 -42
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
* [0.6.3 - May 5, 2011](https://github.com/intridea/oauth2/compare/v0.6.2...v0.6.3)
|
4
|
+
* [0.6.2 - April 26, 2011](https://github.com/intridea/oauth2/compare/v0.6.1...v0.6.2)
|
5
|
+
* [0.6.1 - April 6, 2011](https://github.com/intridea/oauth2/compare/v0.6.0...v0.6.1)
|
6
|
+
* [0.6.0 - March 20, 2011](https://github.com/intridea/oauth2/compare/v0.5.2...v0.6.0)
|
7
|
+
* [0.5.2 - February 6, 2011](https://github.com/intridea/oauth2/compare/v0.5.1...v0.5.2)
|
8
|
+
* [0.5.1 - February 3, 2011](https://github.com/intridea/oauth2/compare/v0.5.0...v0.5.1)
|
9
|
+
* [0.5.0 - January 21, 2011](https://github.com/intridea/oauth2/compare/v0.4.1....v0.5.0)
|
10
|
+
* [0.4.1 - January 8, 2011](https://github.com/intridea/oauth2/compare/v0.2.3...v0.4.1)
|
11
|
+
* [0.2.3 - June 17, 2010](https://github.com/intridea/oauth2/compare/v0.2.2...v0.2.3)
|
12
|
+
* [0.2.2 - June 8, 2010](https://github.com/intridea/oauth2/compare/v0.2.1...v0.2.2)
|
13
|
+
* [0.2.1 - May 4, 2010](https://github.com/intridea/oauth2/compare/v0.2.0...v0.2.1)
|
14
|
+
* [0.2.0 - April 30, 2010](https://github.com/intridea/oauth2/compare/v0.1.4...v0.2.0)
|
15
|
+
* [0.1.4 - January 13, 2010](https://github.com/intridea/oauth2/compare/v0.1.3...v0.1.4)
|
16
|
+
* [0.1.3 - December 16, 2009](https://github.com/intridea/oauth2/compare/v0.1.2...v0.1.3)
|
17
|
+
* [0.1.2 - December 16, 2009](https://github.com/intridea/oauth2/compare/v0.1.1...v0.1.2)
|
18
|
+
* [0.1.1 - December 15, 2009](https://github.com/intridea/oauth2/compare/v0.1.0...v0.1.1)
|
19
|
+
* [0.1.0 - December 12, 2009](https://github.com/intridea/oauth2/compare/v0.0.1...v0.1.0)
|
20
|
+
* [0.0.1 - December 12, 2009](https://github.com/intridea/oauth2/compare/cb7d5480944229e1a5ddfa9d1113903628765584...v0.0.1)
|
data/Gemfile
CHANGED
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
Octokit
|
2
|
+
=======
|
3
|
+
Simple Ruby wrapper for the GitHub v2 API.
|
4
|
+
|
5
|
+
Installation
|
6
|
+
------------
|
7
|
+
gem install octokit
|
8
|
+
|
9
|
+
Continuous Integration
|
10
|
+
----------------------
|
11
|
+
[](http://travis-ci.org/pengwynn/octokit)
|
12
|
+
|
13
|
+
Documentation
|
14
|
+
-------------
|
15
|
+
http://rdoc.info/gems/octokit
|
16
|
+
|
17
|
+
Examples
|
18
|
+
-------------
|
19
|
+
|
20
|
+
### Show a user
|
21
|
+
|
22
|
+
Octokit.user("sferik")
|
23
|
+
=> <#Hashie::Mash 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">
|
24
|
+
|
25
|
+
### Show who a user follows
|
26
|
+
|
27
|
+
Octokit.following("sferik")
|
28
|
+
=> ["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"]
|
29
|
+
|
30
|
+
### Repositories
|
31
|
+
For convenience, methods that require a repoistory argument may be passed in any of the following forms:
|
32
|
+
|
33
|
+
* "pengwynn/octokit"
|
34
|
+
* {:username => "pengwynn", :name => "octokit"}
|
35
|
+
* {:username => "pengwynn", :repo => "octokit"}
|
36
|
+
* instance of `Repository`
|
37
|
+
|
38
|
+
Octokit.repo("pengwynn/octokit")
|
39
|
+
=> <#Hashie::Mash created_at="2009/12/10 13:41:49 -0800" description="Simple Ruby wrapper for the GitHub v2 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 06:12:21 -0700" size=1660 url="https://github.com/pengwynn/octokit" watchers=92>
|
40
|
+
|
41
|
+
Authenticated requests
|
42
|
+
----------------------
|
43
|
+
Some methods require authentication so you'll need to pass a login and an api_token. You can find your GitHub API token on your [account page](https://github.com/account).
|
44
|
+
|
45
|
+
client = Octokit::Client.new(:login => "pengwynn", :token => "OU812")
|
46
|
+
client.follow!("sferik")
|
47
|
+
|
48
|
+
Submitting a Pull Request
|
49
|
+
-------------------------
|
50
|
+
1. Fork the project.
|
51
|
+
2. Create a topic branch.
|
52
|
+
3. Implement your feature or bug fix.
|
53
|
+
4. Add documentation for your feature or bug fix.
|
54
|
+
5. Run <tt>bundle exec rake doc:yard</tt>. If your changes are not 100% documented, go back to step 4.
|
55
|
+
6. Add specs for your feature or bug fix.
|
56
|
+
7. Run <tt>bundle exec rake spec</tt>. If your changes are not 100% covered, go back to step 6.
|
57
|
+
8. Commit and push your changes.
|
58
|
+
9. Submit a pull request. Please do not include changes to the version or gemspec. (If you want to create your own version for some reason, please do so in a separate commit.)
|
59
|
+
|
60
|
+
Inspiration
|
61
|
+
-----------
|
62
|
+
Octokit was inspired by [Octopi](http://github.com/fcoury/octopi) and aims to be a lightweight, less-ActiveResourcey alternative.
|
63
|
+
|
64
|
+
Copyright
|
65
|
+
---------
|
66
|
+
Copyright (c) 2011 [Wynn Netherland](http://wynnnetherland.com), [Adam Stacoviak](http://adamstacoviak.com/), [Erik Michaels-Ober](https://github.com/sferik).
|
67
|
+
See [LICENSE](https://github.com/pengwynn/octokit/blob/master/LICENSE) for details.
|
@@ -27,7 +27,7 @@ module Faraday
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def error_message(response)
|
30
|
-
"#{response[:method].to_s.upcase} #{response[:url].to_s}: #{response[:status]}#{(': ' + response[:body]) if response[:body]}"
|
30
|
+
"#{response[:method].to_s.upcase} #{response[:url].to_s}: #{response[:status]}#{(': ' + response[:body][:error]) if response[:body]}"
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -3,12 +3,12 @@ module Octokit
|
|
3
3
|
module Commits
|
4
4
|
|
5
5
|
def commits(repo, branch="master", options={})
|
6
|
-
get("commits/list/#{Repository.new(repo)}/#{branch}", options)['commits']
|
6
|
+
get("api/v2/json/commits/list/#{Repository.new(repo)}/#{branch}", options)['commits']
|
7
7
|
end
|
8
8
|
alias :list_commits :commits
|
9
9
|
|
10
10
|
def commit(repo, sha, options={})
|
11
|
-
get("commits/show/#{Repository.new(repo)}/#{sha}", options)['commits']
|
11
|
+
get("api/v2/json/commits/show/#{Repository.new(repo)}/#{sha}", options)['commits']
|
12
12
|
end
|
13
13
|
|
14
14
|
end
|
@@ -7,23 +7,21 @@ module Octokit
|
|
7
7
|
module Connection
|
8
8
|
private
|
9
9
|
|
10
|
-
def connection(
|
10
|
+
def connection(url, authenticate=true, raw=false)
|
11
11
|
options = {
|
12
12
|
:proxy => proxy,
|
13
13
|
:ssl => {:verify => false},
|
14
|
-
:url =>
|
14
|
+
:url => url,
|
15
15
|
}
|
16
16
|
|
17
17
|
options.merge!(:params => { :access_token => oauth_token }) if oauthed? && !authenticated?
|
18
18
|
|
19
19
|
con = Faraday::Connection.new(options) do |connection|
|
20
|
+
connection.use Faraday::Request::UrlEncoded
|
20
21
|
connection.use Faraday::Response::RaiseError
|
21
22
|
unless raw
|
22
|
-
connection.use Faraday::Response::
|
23
|
-
|
24
|
-
when 'json' then connection.use Faraday::Response::ParseJson
|
25
|
-
when 'xml' then connection.use Faraday::Response::ParseXml
|
26
|
-
end
|
23
|
+
connection.use Faraday::Response::Rashify
|
24
|
+
connection.use Faraday::Response::ParseJson
|
27
25
|
end
|
28
26
|
connection.adapter(adapter)
|
29
27
|
end
|
@@ -3,57 +3,57 @@ module Octokit
|
|
3
3
|
module Issues
|
4
4
|
|
5
5
|
def search_issues(repo, search_term, state='open', options={})
|
6
|
-
get("issues/search/#{Repository.new(repo)}/#{state}/#{search_term}", options)['issues']
|
6
|
+
get("api/v2/json/issues/search/#{Repository.new(repo)}/#{state}/#{search_term}", options)['issues']
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
get("issues/list/#{Repository.new(repo)}/#{state}", options)['issues']
|
9
|
+
def list_issues(repo, state='open', options={})
|
10
|
+
get("api/v2/json/issues/list/#{Repository.new(repo)}/#{state}", options)['issues']
|
11
11
|
end
|
12
|
-
alias :
|
12
|
+
alias :issues :list_issues
|
13
13
|
|
14
14
|
def issues_labeled(repo, label, options={})
|
15
|
-
get("issues/list/#{Repository.new(repo)}/label/#{label}", options)['issues']
|
15
|
+
get("api/v2/json/issues/list/#{Repository.new(repo)}/label/#{label}", options)['issues']
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
|
18
|
+
def create_issue(repo, title, body, options={})
|
19
|
+
post("api/v2/json/issues/open/#{Repository.new(repo)}", options.merge({:title => title, :body => body}))['issue']
|
20
20
|
end
|
21
|
+
alias :open_issue :create_issue
|
21
22
|
|
22
|
-
def
|
23
|
-
get("issues/
|
23
|
+
def issue(repo, number, options={})
|
24
|
+
get("api/v2/json/issues/show/#{Repository.new(repo)}/#{number}", options)['issue']
|
24
25
|
end
|
25
26
|
|
26
|
-
def
|
27
|
-
|
27
|
+
def issue_comments(repo, number, options={})
|
28
|
+
get("api/v2/json/issues/comments/#{Repository.new(repo)}/#{number}", options)['comments']
|
28
29
|
end
|
29
|
-
alias :open_issue :create_issue
|
30
30
|
|
31
31
|
def close_issue(repo, number, options={})
|
32
|
-
post("issues/close/#{Repository.new(repo)}/#{number}", options)['issue']
|
32
|
+
post("api/v2/json/issues/close/#{Repository.new(repo)}/#{number}", options)['issue']
|
33
33
|
end
|
34
34
|
|
35
35
|
def reopen_issue(repo, number, options={})
|
36
|
-
post("issues/reopen/#{Repository.new(repo)}/#{number}", options)['issue']
|
36
|
+
post("api/v2/json/issues/reopen/#{Repository.new(repo)}/#{number}", options)['issue']
|
37
37
|
end
|
38
38
|
|
39
39
|
def update_issue(repo, number, title, body, options={})
|
40
|
-
post("issues/edit/#{Repository.new(repo)}/#{number}", options.merge({:title => title, :body => body}))['issue']
|
40
|
+
post("api/v2/json/issues/edit/#{Repository.new(repo)}/#{number}", options.merge({:title => title, :body => body}))['issue']
|
41
41
|
end
|
42
42
|
|
43
43
|
def labels(repo, options={})
|
44
|
-
get("issues/labels/#{Repository.new(repo)}", options)['labels']
|
44
|
+
get("api/v2/json/issues/labels/#{Repository.new(repo)}", options)['labels']
|
45
45
|
end
|
46
46
|
|
47
47
|
def add_label(repo, label, number=nil, options={})
|
48
|
-
post(["issues/label/add/#{Repository.new(repo)}/#{label}", number].compact.join('/'), options)['labels']
|
48
|
+
post(["api/v2/json/issues/label/add/#{Repository.new(repo)}/#{label}", number].compact.join('/'), options)['labels']
|
49
49
|
end
|
50
50
|
|
51
51
|
def remove_label(repo, label, number=nil, options={})
|
52
|
-
post(["issues/label/remove/#{Repository.new(repo)}/#{label}", number].compact.join('/'), options)['labels']
|
52
|
+
post(["api/v2/json/issues/label/remove/#{Repository.new(repo)}/#{label}", number].compact.join('/'), options)['labels']
|
53
53
|
end
|
54
54
|
|
55
55
|
def add_comment(repo, number, comment, options={})
|
56
|
-
post("issues/comment/#{Repository.new(repo)}/#{number}", options.merge({:comment => comment}))['comment']
|
56
|
+
post("api/v2/json/issues/comment/#{Repository.new(repo)}/#{number}", options.merge({:comment => comment}))['comment']
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -3,11 +3,11 @@ module Octokit
|
|
3
3
|
module Network
|
4
4
|
|
5
5
|
def network_meta(repo, options={})
|
6
|
-
get("#{Repository.new(repo)}/network_meta", options,
|
6
|
+
get("#{Repository.new(repo)}/network_meta", options, 2, false)
|
7
7
|
end
|
8
8
|
|
9
9
|
def network_data(repo, options={})
|
10
|
-
get("#{Repository.new(repo)}/network_data_chunk", options,
|
10
|
+
get("#{Repository.new(repo)}/network_data_chunk", options, 2, false)['commits']
|
11
11
|
end
|
12
12
|
|
13
13
|
end
|
@@ -3,29 +3,29 @@ module Octokit
|
|
3
3
|
module Objects
|
4
4
|
|
5
5
|
def tree(repo, tree_sha, options={})
|
6
|
-
get("tree/show/#{Repository.new(repo)}/#{tree_sha}", options)['tree']
|
6
|
+
get("api/v2/json/tree/show/#{Repository.new(repo)}/#{tree_sha}", options)['tree']
|
7
7
|
end
|
8
8
|
|
9
9
|
def blob(repo, tree_sha, path, options={})
|
10
|
-
get("blob/show/#{Repository.new(repo)}/#{tree_sha}/#{path}", options)['blob']
|
10
|
+
get("api/v2/json/blob/show/#{Repository.new(repo)}/#{tree_sha}/#{path}", options)['blob']
|
11
11
|
end
|
12
12
|
|
13
13
|
def blobs(repo, tree_sha, options={})
|
14
|
-
get("blob/all/#{Repository.new(repo)}/#{tree_sha}", options)['blobs']
|
14
|
+
get("api/v2/json/blob/all/#{Repository.new(repo)}/#{tree_sha}", options)['blobs']
|
15
15
|
end
|
16
16
|
|
17
17
|
def blob_metadata(repo, tree_sha, options={})
|
18
|
-
get("blob/full/#{Repository.new(repo)}/#{tree_sha}", options)['blobs']
|
18
|
+
get("api/v2/json/blob/full/#{Repository.new(repo)}/#{tree_sha}", options)['blobs']
|
19
19
|
end
|
20
20
|
alias :blob_meta :blob_metadata
|
21
21
|
|
22
22
|
def tree_metadata(repo, tree_sha, options={})
|
23
|
-
get("tree/full/#{Repository.new(repo)}/#{tree_sha}", options)['tree']
|
23
|
+
get("api/v2/json/tree/full/#{Repository.new(repo)}/#{tree_sha}", options)['tree']
|
24
24
|
end
|
25
25
|
alias :tree_meta :tree_metadata
|
26
26
|
|
27
27
|
def raw(repo, sha, options={})
|
28
|
-
get("blob/show/#{Repository.new(repo)}/#{sha}", options, true).body
|
28
|
+
get("api/v2/json/blob/show/#{Repository.new(repo)}/#{sha}", options, 2, true, true).body
|
29
29
|
end
|
30
30
|
|
31
31
|
end
|
@@ -3,20 +3,20 @@ module Octokit
|
|
3
3
|
module Organizations
|
4
4
|
|
5
5
|
def organization(org, options={})
|
6
|
-
get("organizations/#{org}", options)['organization']
|
6
|
+
get("api/v2/json/organizations/#{org}", options)['organization']
|
7
7
|
end
|
8
8
|
alias :org :organization
|
9
9
|
|
10
10
|
def update_organization(org, values, options={})
|
11
|
-
put("organizations/#{org}", options.merge({:organization => values}))['organization']
|
11
|
+
put("api/v2/json/organizations/#{org}", options.merge({:organization => values}))['organization']
|
12
12
|
end
|
13
13
|
alias :update_org :update_organization
|
14
14
|
|
15
15
|
def organizations(user=nil, options={})
|
16
16
|
if user
|
17
|
-
get("user/show/#{user}/organizations", options)
|
17
|
+
get("api/v2/json/user/show/#{user}/organizations", options)
|
18
18
|
else
|
19
|
-
get("organizations", options)
|
19
|
+
get("api/v2/json/organizations", options)
|
20
20
|
end['organizations']
|
21
21
|
end
|
22
22
|
alias :list_organizations :organizations
|
@@ -25,64 +25,64 @@ module Octokit
|
|
25
25
|
|
26
26
|
def organization_repositories(org=nil, options={})
|
27
27
|
if org
|
28
|
-
get("organizations/#{org}/public_repositories", options)
|
28
|
+
get("api/v2/json/organizations/#{org}/public_repositories", options)
|
29
29
|
else
|
30
|
-
get("organizations/repositories", options)
|
30
|
+
get("api/v2/json/organizations/repositories", options)
|
31
31
|
end['repositories']
|
32
32
|
end
|
33
33
|
alias :org_repositories :organization_repositories
|
34
34
|
alias :org_repos :organization_repositories
|
35
35
|
|
36
36
|
def organization_members(org, options={})
|
37
|
-
get("organizations/#{org}/public_members", options)['users']
|
37
|
+
get("api/v2/json/organizations/#{org}/public_members", options)['users']
|
38
38
|
end
|
39
39
|
alias :org_members :organization_members
|
40
40
|
|
41
41
|
def organization_teams(org, options={})
|
42
|
-
get("organizations/#{org}/teams", options)['teams']
|
42
|
+
get("api/v2/json/organizations/#{org}/teams", options)['teams']
|
43
43
|
end
|
44
44
|
alias :org_teams :organization_teams
|
45
45
|
|
46
46
|
def create_team(org, values, options={})
|
47
|
-
post("organizations/#{org}/teams", options.merge({:team => values}))['team']
|
47
|
+
post("api/v2/json/organizations/#{org}/teams", options.merge({:team => values}))['team']
|
48
48
|
end
|
49
49
|
|
50
50
|
def team(team_id, options={})
|
51
|
-
get("teams/#{team_id}", options)['team']
|
51
|
+
get("api/v2/json/teams/#{team_id}", options)['team']
|
52
52
|
end
|
53
53
|
|
54
54
|
def update_team(team_id, values, options={})
|
55
|
-
put("teams/#{team_id}", options.merge({:team => values}))['team']
|
55
|
+
put("api/v2/json/teams/#{team_id}", options.merge({:team => values}))['team']
|
56
56
|
end
|
57
57
|
|
58
58
|
def delete_team(team_id, options={})
|
59
|
-
delete("teams/#{team_id}", options)['team']
|
59
|
+
delete("api/v2/json/teams/#{team_id}", options)['team']
|
60
60
|
end
|
61
61
|
|
62
62
|
def team_members(team_id, options={})
|
63
|
-
get("teams/#{team_id}/members", options)['users']
|
63
|
+
get("api/v2/json/teams/#{team_id}/members", options)['users']
|
64
64
|
end
|
65
65
|
|
66
66
|
def add_team_member(team_id, user, options={})
|
67
|
-
post("teams/#{team_id}/members", options.merge({:name => user}))['user']
|
67
|
+
post("api/v2/json/teams/#{team_id}/members", options.merge({:name => user}))['user']
|
68
68
|
end
|
69
69
|
|
70
70
|
def remove_team_member(team_id, user, options={})
|
71
|
-
delete("teams/#{team_id}/members", options.merge({:name => user}))['user']
|
71
|
+
delete("api/v2/json/teams/#{team_id}/members", options.merge({:name => user}))['user']
|
72
72
|
end
|
73
73
|
|
74
74
|
def team_repositories(team_id, options={})
|
75
|
-
get("teams/#{team_id}/repositories", options)['repositories']
|
75
|
+
get("api/v2/json/teams/#{team_id}/repositories", options)['repositories']
|
76
76
|
end
|
77
77
|
alias :team_repos :team_repositories
|
78
78
|
|
79
79
|
def add_team_repository(team_id, repo, options={})
|
80
|
-
post("teams/#{team_id}/repositories", options.merge(:name => Repository.new(repo)))['repositories']
|
80
|
+
post("api/v2/json/teams/#{team_id}/repositories", options.merge(:name => Repository.new(repo)))['repositories']
|
81
81
|
end
|
82
82
|
alias :add_team_repo :add_team_repository
|
83
83
|
|
84
84
|
def remove_team_repository(team_id, repo, options={})
|
85
|
-
delete("teams/#{team_id}/repositories", options.merge(:name => Repository.new(repo)))['repositories']
|
85
|
+
delete("api/v2/json/teams/#{team_id}/repositories", options.merge(:name => Repository.new(repo)))['repositories']
|
86
86
|
end
|
87
87
|
alias :remove_team_repo :remove_team_repository
|
88
88
|
end
|
data/lib/octokit/client/pulls.rb
CHANGED
@@ -8,16 +8,16 @@ module Octokit
|
|
8
8
|
:title => title,
|
9
9
|
:body => body,
|
10
10
|
}
|
11
|
-
post("pulls/#{Repository.new(repo)}", options.merge({:pull => pull}))['pulls']
|
11
|
+
post("api/v2/json/pulls/#{Repository.new(repo)}", options.merge({:pull => pull}))['pulls']
|
12
12
|
end
|
13
13
|
|
14
14
|
def pull_requests(repo, state='open', options={})
|
15
|
-
get("pulls/#{Repository.new(repo)}/#{state}", options)['pulls']
|
15
|
+
get("api/v2/json/pulls/#{Repository.new(repo)}/#{state}", options)['pulls']
|
16
16
|
end
|
17
17
|
alias :pulls :pull_requests
|
18
18
|
|
19
19
|
def pull_request(repo, number, options={})
|
20
|
-
get("pulls/#{Repository.new(repo)}/#{number}", options)['pull']
|
20
|
+
get("api/v2/json/pulls/#{Repository.new(repo)}/#{number}", options)['pull']
|
21
21
|
end
|
22
22
|
alias :pull :pull_request
|
23
23
|
end
|
@@ -3,134 +3,134 @@ module Octokit
|
|
3
3
|
module Repositories
|
4
4
|
|
5
5
|
def search_repositories(q, options={})
|
6
|
-
get("repos/search/#{q}", options)['repositories']
|
6
|
+
get("api/v2/json/repos/search/#{q}", options)['repositories']
|
7
7
|
end
|
8
8
|
alias :search_repos :search_repositories
|
9
9
|
|
10
10
|
def repository(repo, options={})
|
11
|
-
get("repos/show/#{Repository.new(repo)}", options)['repository']
|
11
|
+
get("api/v2/json/repos/show/#{Repository.new(repo)}", options)['repository']
|
12
12
|
end
|
13
13
|
alias :repo :repository
|
14
14
|
|
15
15
|
def update_repository(repo, values, options={})
|
16
|
-
post("repos/show/#{Repository.new(repo)}", options.merge({:values => values}))['repository']
|
16
|
+
post("api/v2/json/repos/show/#{Repository.new(repo)}", options.merge({:values => values}))['repository']
|
17
17
|
end
|
18
18
|
alias :update_repo :update_repository
|
19
19
|
|
20
20
|
def repositories(username=login, options={})
|
21
|
-
get(["repos/show", username].compact.join('/'), options)['repositories']
|
21
|
+
get(["api/v2/json/repos/show", username].compact.join('/'), options)['repositories']
|
22
22
|
end
|
23
23
|
alias :list_repositories :repositories
|
24
24
|
alias :list_repos :repositories
|
25
25
|
alias :repos :repositories
|
26
26
|
|
27
27
|
def watch(repo, options={})
|
28
|
-
post("repos/watch/#{Repository.new(repo)}", options)['repository']
|
28
|
+
post("api/v2/json/repos/watch/#{Repository.new(repo)}", options)['repository']
|
29
29
|
end
|
30
30
|
|
31
31
|
def unwatch(repo, options={})
|
32
|
-
post("repos/unwatch/#{Repository.new(repo)}", options)['repository']
|
32
|
+
post("api/v2/json/repos/unwatch/#{Repository.new(repo)}", options)['repository']
|
33
33
|
end
|
34
34
|
|
35
35
|
def fork(repo, options={})
|
36
|
-
post("repos/fork/#{Repository.new(repo)}", options)['repository']
|
36
|
+
post("api/v2/json/repos/fork/#{Repository.new(repo)}", options)['repository']
|
37
37
|
end
|
38
38
|
|
39
39
|
def create_repository(name, options={})
|
40
|
-
post("repos/create", options.merge(:name => name))['repository']
|
40
|
+
post("api/v2/json/repos/create", options.merge(:name => name))['repository']
|
41
41
|
end
|
42
42
|
alias :create_repo :create_repository
|
43
43
|
alias :create :create_repository
|
44
44
|
|
45
45
|
def delete_repository(repo, options={})
|
46
|
-
response = post("repos/delete/#{Repository.new(repo)}", options)
|
46
|
+
response = post("api/v2/json/repos/delete/#{Repository.new(repo)}", options)
|
47
47
|
if response.respond_to?(:delete_token)
|
48
48
|
response['delete_token']
|
49
49
|
else
|
50
|
-
response
|
50
|
+
response
|
51
51
|
end
|
52
52
|
end
|
53
53
|
alias :delete_repo :delete_repository
|
54
54
|
|
55
55
|
def delete_repository!(repo, options={})
|
56
|
-
|
57
|
-
post("repos/delete/#{Repository.new(repo)}", options.merge(:delete_token =>
|
56
|
+
delete_token = post("api/v2/json/repos/delete/#{Repository.new(repo)}", options)
|
57
|
+
post("api/v2/json/repos/delete/#{Repository.new(repo)}", options.merge(:delete_token => delete_token))
|
58
58
|
end
|
59
59
|
alias :delete_repo! :delete_repository!
|
60
60
|
|
61
61
|
def set_private(repo, options={})
|
62
|
-
post("repos/set/private/#{Repository.new(repo)}", options)['repository']
|
62
|
+
post("api/v2/json/repos/set/private/#{Repository.new(repo)}", options)['repository']
|
63
63
|
end
|
64
64
|
|
65
65
|
def set_public(repo, options={})
|
66
|
-
post("repos/set/public/#{Repository.new(repo)}", options)['repository']
|
66
|
+
post("api/v2/json/repos/set/public/#{Repository.new(repo)}", options)['repository']
|
67
67
|
end
|
68
68
|
|
69
69
|
def deploy_keys(repo, options={})
|
70
|
-
get("repos/keys/#{Repository.new(repo)}", options)['public_keys']
|
70
|
+
get("api/v2/json/repos/keys/#{Repository.new(repo)}", options)['public_keys']
|
71
71
|
end
|
72
72
|
alias :list_deploy_keys :deploy_keys
|
73
73
|
|
74
74
|
def add_deploy_key(repo, title, key, options={})
|
75
|
-
post("repos/key/#{Repository.new(repo)}/add", options)['public_keys']
|
75
|
+
post("api/v2/json/repos/key/#{Repository.new(repo)}/add", options)['public_keys']
|
76
76
|
end
|
77
77
|
|
78
78
|
def remove_deploy_key(repo, id, options={})
|
79
|
-
post("repos/key/#{Repository.new(repo)}/remove", options.merge(:id => id))['public_keys']
|
79
|
+
post("api/v2/json/repos/key/#{Repository.new(repo)}/remove", options.merge(:id => id))['public_keys']
|
80
80
|
end
|
81
81
|
|
82
82
|
def collaborators(repo, options={})
|
83
|
-
get("repos/show/#{Repository.new(repo)}/collaborators", options)['collaborators']
|
83
|
+
get("api/v2/json/repos/show/#{Repository.new(repo)}/collaborators", options)['collaborators']
|
84
84
|
end
|
85
85
|
alias :collabs :collaborators
|
86
86
|
|
87
87
|
def add_collaborator(repo, collaborator, options={})
|
88
|
-
post("repos/collaborators/#{Repository.new(repo)}/add/#{collaborator}")['collaborators']
|
88
|
+
post("api/v2/json/repos/collaborators/#{Repository.new(repo)}/add/#{collaborator}")['collaborators']
|
89
89
|
end
|
90
90
|
alias :add_collab :add_collaborator
|
91
91
|
|
92
92
|
def remove_collaborator(repo, collaborator, options={})
|
93
|
-
post("repos/collaborators/#{Repository.new(repo)}/remove/#{collaborator}")['collaborators']
|
93
|
+
post("api/v2/json/repos/collaborators/#{Repository.new(repo)}/remove/#{collaborator}")['collaborators']
|
94
94
|
end
|
95
95
|
alias :remove_collab :remove_collaborator
|
96
96
|
|
97
97
|
def pushable(options={})
|
98
|
-
get("repos/pushable", options)['repositories']
|
98
|
+
get("api/v2/json/repos/pushable", options)['repositories']
|
99
99
|
end
|
100
100
|
|
101
101
|
def repository_teams(repo, options={})
|
102
|
-
get("repos/show/#{Repository.new(repo)}/teams", options)['teams']
|
102
|
+
get("api/v2/json/repos/show/#{Repository.new(repo)}/teams", options)['teams']
|
103
103
|
end
|
104
104
|
alias :repo_teams :repository_teams
|
105
105
|
alias :teams :repository_teams
|
106
106
|
|
107
107
|
def contributors(repo, anon=false, options={})
|
108
108
|
if anon
|
109
|
-
get("repos/show/#{Repository.new(repo)}/contributors/anon", options)
|
109
|
+
get("api/v2/json/repos/show/#{Repository.new(repo)}/contributors/anon", options)
|
110
110
|
else
|
111
|
-
get("repos/show/#{Repository.new(repo)}/contributors", options)
|
111
|
+
get("api/v2/json/repos/show/#{Repository.new(repo)}/contributors", options)
|
112
112
|
end['contributors']
|
113
113
|
end
|
114
114
|
alias :contribs :contributors
|
115
115
|
|
116
116
|
def watchers(repo, options={})
|
117
|
-
get("repos/show/#{Repository.new(repo)}/watchers", options)['watchers']
|
117
|
+
get("api/v2/json/repos/show/#{Repository.new(repo)}/watchers", options)['watchers']
|
118
118
|
end
|
119
119
|
|
120
120
|
def network(repo, options={})
|
121
|
-
get("repos/show/#{Repository.new(repo)}/network", options)['network']
|
121
|
+
get("api/v2/json/repos/show/#{Repository.new(repo)}/network", options)['network']
|
122
122
|
end
|
123
123
|
|
124
124
|
def languages(repo, options={})
|
125
|
-
get("repos/show/#{Repository.new(repo)}/languages", options)['languages']
|
125
|
+
get("api/v2/json/repos/show/#{Repository.new(repo)}/languages", options)['languages']
|
126
126
|
end
|
127
127
|
|
128
128
|
def tags(repo, options={})
|
129
|
-
get("repos/show/#{Repository.new(repo)}/tags", options)['tags']
|
129
|
+
get("api/v2/json/repos/show/#{Repository.new(repo)}/tags", options)['tags']
|
130
130
|
end
|
131
131
|
|
132
132
|
def branches(repo, options={})
|
133
|
-
get("repos/show/#{Repository.new(repo)}/branches", options)['branches']
|
133
|
+
get("api/v2/json/repos/show/#{Repository.new(repo)}/branches", options)['branches']
|
134
134
|
end
|
135
135
|
|
136
136
|
end
|