octokit 2.6.3 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +2 -2
- data/lib/octokit/client.rb +13 -3
- data/lib/octokit/client/commit_comments.rb +6 -6
- data/lib/octokit/client/commits.rb +25 -15
- data/lib/octokit/client/contents.rb +3 -3
- data/lib/octokit/client/downloads.rb +1 -1
- data/lib/octokit/client/emojis.rb +1 -0
- data/lib/octokit/client/events.rb +1 -0
- data/lib/octokit/client/feeds.rb +33 -0
- data/lib/octokit/client/gists.rb +1 -0
- data/lib/octokit/client/gitignore.rb +0 -1
- data/lib/octokit/client/hooks.rb +1 -0
- data/lib/octokit/client/issues.rb +9 -8
- data/lib/octokit/client/labels.rb +3 -3
- data/lib/octokit/client/markdown.rb +1 -1
- data/lib/octokit/client/meta.rb +1 -1
- data/lib/octokit/client/milestones.rb +1 -1
- data/lib/octokit/client/objects.rb +6 -5
- data/lib/octokit/client/organizations.rb +37 -5
- data/lib/octokit/client/pub_sub_hubbub.rb +4 -0
- data/lib/octokit/client/pull_requests.rb +2 -1
- data/lib/octokit/client/rate_limit.rb +4 -4
- data/lib/octokit/client/refs.rb +31 -5
- data/lib/octokit/client/releases.rb +1 -1
- data/lib/octokit/client/repositories.rb +48 -4
- data/lib/octokit/client/search.rb +3 -1
- data/lib/octokit/client/statuses.rb +2 -2
- data/lib/octokit/client/users.rb +6 -3
- data/lib/octokit/default.rb +2 -0
- data/lib/octokit/response/feed_parser.rb +24 -0
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44e64ada68666da82947ca24101ba7211dc42719
|
4
|
+
data.tar.gz: 03696bbca61e9dbea82b41b972046997cc865d9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0ad9385e3c93bc1caa5c0c5b08554f44ac4577dcc578898e1522a1aaf8d0e7a99dfa380a43015c091bfffcfc6c63f4ca73a44a4de2775c0e17a620753ff16b6
|
7
|
+
data.tar.gz: 3f6f16e93823cb57be96d2999c7a04b33d9cb078a73570276ec7eba6da944db0a46d96c6590e6e22a61601143bfdabcef5644a783ad4bdbb7ada318b4a973f9c
|
data/CONTRIBUTING.md
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
1. [Fork the repository.][fork]
|
6
6
|
2. [Create a topic branch.][branch]
|
7
7
|
3. Add specs for your unimplemented feature or bug fix.
|
8
|
-
4. Run `
|
8
|
+
4. Run `script/test`. If your specs pass, return to step 3.
|
9
9
|
5. Implement your feature or bug fix.
|
10
|
-
6. Run `
|
10
|
+
6. Run `script/test`. If your specs fail, return to step 5.
|
11
11
|
7. Run `open coverage/index.html`. If your changes are not completely covered
|
12
12
|
by your tests, return to step 3.
|
13
13
|
8. Add documentation for your feature or bug fix.
|
data/lib/octokit/client.rb
CHANGED
@@ -13,6 +13,7 @@ require 'octokit/client/contents'
|
|
13
13
|
require 'octokit/client/downloads'
|
14
14
|
require 'octokit/client/emojis'
|
15
15
|
require 'octokit/client/events'
|
16
|
+
require 'octokit/client/feeds'
|
16
17
|
require 'octokit/client/gists'
|
17
18
|
require 'octokit/client/gitignore'
|
18
19
|
require 'octokit/client/hooks'
|
@@ -54,6 +55,7 @@ module Octokit
|
|
54
55
|
include Octokit::Client::Downloads
|
55
56
|
include Octokit::Client::Emojis
|
56
57
|
include Octokit::Client::Events
|
58
|
+
include Octokit::Client::Feeds
|
57
59
|
include Octokit::Client::Gists
|
58
60
|
include Octokit::Client::Gitignore
|
59
61
|
include Octokit::Client::Hooks
|
@@ -178,8 +180,12 @@ module Octokit
|
|
178
180
|
#
|
179
181
|
# @param url [String] The path, relative to {#api_endpoint}
|
180
182
|
# @param options [Hash] Query and header params for request
|
183
|
+
# @param block [Block] Block to perform the data concatination of the
|
184
|
+
# multiple requests. The block is called with two parameters, the first
|
185
|
+
# contains the contents of the requests so far and the second parameter
|
186
|
+
# contains the latest response.
|
181
187
|
# @return [Sawyer::Resource]
|
182
|
-
def paginate(url, options = {})
|
188
|
+
def paginate(url, options = {}, &block)
|
183
189
|
opts = parse_query_and_convenience_headers(options.dup)
|
184
190
|
if @auto_paginate || @per_page
|
185
191
|
opts[:query][:per_page] ||= @per_page || (@auto_paginate ? 100 : nil)
|
@@ -187,10 +193,14 @@ module Octokit
|
|
187
193
|
|
188
194
|
data = request(:get, url, opts)
|
189
195
|
|
190
|
-
if @auto_paginate
|
196
|
+
if @auto_paginate
|
191
197
|
while @last_response.rels[:next] && rate_limit.remaining > 0
|
192
198
|
@last_response = @last_response.rels[:next].get
|
193
|
-
|
199
|
+
if block_given?
|
200
|
+
yield(data, @last_response)
|
201
|
+
else
|
202
|
+
data.concat(@last_response.data) if @last_response.data.is_a?(Array)
|
203
|
+
end
|
194
204
|
end
|
195
205
|
|
196
206
|
end
|
@@ -10,7 +10,7 @@ module Octokit
|
|
10
10
|
#
|
11
11
|
# @param repo [String, Hash, Repository] A GitHub repository
|
12
12
|
# @return [Array] List of commit comments
|
13
|
-
# @see http://developer.github.com/v3/repos/comments
|
13
|
+
# @see http://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository
|
14
14
|
def list_commit_comments(repo, options = {})
|
15
15
|
get "repos/#{Repository.new(repo)}/comments", options
|
16
16
|
end
|
@@ -20,7 +20,7 @@ module Octokit
|
|
20
20
|
# @param repo [String, Hash, Repository] A GitHub repository
|
21
21
|
# @param sha [String] The SHA of the commit whose comments will be fetched
|
22
22
|
# @return [Array] List of commit comments
|
23
|
-
# @see http://developer.github.com/v3/repos/comments
|
23
|
+
# @see http://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit
|
24
24
|
def commit_comments(repo, sha, options = {})
|
25
25
|
get "repos/#{Repository.new(repo)}/commits/#{sha}/comments", options
|
26
26
|
end
|
@@ -30,7 +30,7 @@ module Octokit
|
|
30
30
|
# @param repo [String, Hash, Repository] A GitHub repository
|
31
31
|
# @param id [String] The ID of the comment to fetch
|
32
32
|
# @return [Sawyer::Resource] Commit comment
|
33
|
-
# @see http://developer.github.com/v3/repos/comments
|
33
|
+
# @see http://developer.github.com/v3/repos/comments/#get-a-single-commit-comment
|
34
34
|
def commit_comment(repo, id, options = {})
|
35
35
|
get "repos/#{Repository.new(repo)}/comments/#{id}", options
|
36
36
|
end
|
@@ -44,7 +44,7 @@ module Octokit
|
|
44
44
|
# @param line [Integer] Line number in the file to comment on
|
45
45
|
# @param position [Integer] Line index in the diff to comment on
|
46
46
|
# @return [Sawyer::Resource] Commit comment
|
47
|
-
# @see http://developer.github.com/v3/repos/comments
|
47
|
+
# @see http://developer.github.com/v3/repos/comments/#create-a-commit-comment
|
48
48
|
# @example Create a commit comment
|
49
49
|
# commit = Octokit.create_commit_comment("octocat/Hello-World", "827efc6d56897b048c772eb4087f854f46256132", "My comment message", "README.md", 10, 1)
|
50
50
|
# commit.commit_id # => "827efc6d56897b048c772eb4087f854f46256132"
|
@@ -69,7 +69,7 @@ module Octokit
|
|
69
69
|
# @param id [String] The ID of the comment to update
|
70
70
|
# @param body [String] Message
|
71
71
|
# @return [Sawyer::Resource] Updated commit comment
|
72
|
-
# @see http://developer.github.com/v3/repos/comments
|
72
|
+
# @see http://developer.github.com/v3/repos/comments/#update-a-commit-comment
|
73
73
|
# @example Update a commit comment
|
74
74
|
# commit = Octokit.update_commit_comment("octocat/Hello-World", "860296", "Updated commit comment")
|
75
75
|
# commit.id # => 860296
|
@@ -86,7 +86,7 @@ module Octokit
|
|
86
86
|
# @param repo [String, Hash, Repository] A GitHub repository
|
87
87
|
# @param id [String] The ID of the comment to delete
|
88
88
|
# @return [Boolean] Success
|
89
|
-
# @see http://developer.github.com/v3/repos/comments
|
89
|
+
# @see http://developer.github.com/v3/repos/comments/#delete-a-commit-comment
|
90
90
|
def delete_commit_comment(repo, id, options = {})
|
91
91
|
boolean_from_response :delete, "repos/#{Repository.new(repo)}/comments/#{id}", options
|
92
92
|
end
|
@@ -19,7 +19,7 @@ module Octokit
|
|
19
19
|
# @param repo [String, Hash, Repository] A GitHub repository
|
20
20
|
# @param options [String] :sha Commit SHA or branch name from which to start the list
|
21
21
|
# @return [Array<Sawyer::Resource>] An array of hashes representing commits
|
22
|
-
# @see http://developer.github.com/v3/repos/commits
|
22
|
+
# @see http://developer.github.com/v3/repos/commits/#list-commits-on-a-repository
|
23
23
|
def commits(*args)
|
24
24
|
arguments = Octokit::RepoArguments.new(args)
|
25
25
|
sha_or_branch = arguments.pop
|
@@ -43,7 +43,7 @@ module Octokit
|
|
43
43
|
# @param sha_or_branch [String] A commit SHA or branch name
|
44
44
|
# @param options [String] :sha Commit SHA or branch name from which to start the list
|
45
45
|
# @return [Array<Sawyer::Resource>] An array of hashes representing commits
|
46
|
-
# @see http://developer.github.com/v3/repos/commits
|
46
|
+
# @see http://developer.github.com/v3/repos/commits/#list-commits-on-a-repository
|
47
47
|
# @example
|
48
48
|
# Octokit.commits_since('octokit/octokit.rb', '2012-10-01')
|
49
49
|
def commits_since(*args)
|
@@ -70,7 +70,7 @@ module Octokit
|
|
70
70
|
# @param date [String] Date on which we want to compare
|
71
71
|
# @param sha_or_branch [String] Commit SHA or branch name from which to start the list
|
72
72
|
# @return [Array<Sawyer::Resource>] An array of hashes representing commits
|
73
|
-
# @see http://developer.github.com/v3/repos/commits
|
73
|
+
# @see http://developer.github.com/v3/repos/commits/#list-commits-on-a-repository
|
74
74
|
# @example
|
75
75
|
# Octokit.commits_before('octokit/octokit.rb', '2012-10-01')
|
76
76
|
def commits_before(*args)
|
@@ -97,7 +97,7 @@ module Octokit
|
|
97
97
|
# @param date [String] Date on which we want to compare
|
98
98
|
# @param sha_or_branch [String] Commit SHA or branch name from which to start the list
|
99
99
|
# @return [Array<Sawyer::Resource>] An array of hashes representing commits
|
100
|
-
# @see http://developer.github.com/v3/repos/commits
|
100
|
+
# @see http://developer.github.com/v3/repos/commits/#list-commits-on-a-repository
|
101
101
|
# @example
|
102
102
|
# Octokit.commits_on('octokit/octokit.rb', '2012-10-01')
|
103
103
|
def commits_on(*args)
|
@@ -126,7 +126,7 @@ module Octokit
|
|
126
126
|
# @param end_date [String] End Date on which we want to compare
|
127
127
|
# @param sha_or_branch [String] Commit SHA or branch name from which to start the list
|
128
128
|
# @return [Array<Sawyer::Resource>] An array of hashes representing commits
|
129
|
-
# @see http://developer.github.com/v3/repos/commits
|
129
|
+
# @see http://developer.github.com/v3/repos/commits/#list-commits-on-a-repository
|
130
130
|
# @example
|
131
131
|
# Octokit.commits_on('octokit/octokit.rb', '2012-10-01', '2012-11-01')
|
132
132
|
def commits_between(*args)
|
@@ -149,11 +149,21 @@ module Octokit
|
|
149
149
|
# @param repo [String, Hash, Repository] A GitHub repository
|
150
150
|
# @param sha [String] The SHA of the commit to fetch
|
151
151
|
# @return [Sawyer::Resource] A hash representing the commit
|
152
|
-
# @see http://developer.github.com/v3/repos/commits
|
152
|
+
# @see http://developer.github.com/v3/repos/commits/#get-a-single-commit
|
153
153
|
def commit(repo, sha, options = {})
|
154
154
|
get "repos/#{Repository.new(repo)}/commits/#{sha}", options
|
155
155
|
end
|
156
156
|
|
157
|
+
# Get a detailed git commit
|
158
|
+
#
|
159
|
+
# @param repo [String, Hash, Repository] A GitHub repository
|
160
|
+
# @param sha [String] The SHA of the commit to fetch
|
161
|
+
# @return [Sawyer::Resource] A hash representing the commit
|
162
|
+
# @see http://developer.github.com/v3/git/commits/#get-a-commit
|
163
|
+
def git_commit(repo, sha, options = {})
|
164
|
+
get "repos/#{Repository.new(repo)}/git/commits/#{sha}", options
|
165
|
+
end
|
166
|
+
|
157
167
|
# Create a commit
|
158
168
|
#
|
159
169
|
# Optionally pass <tt>author</tt> and <tt>committer</tt> hashes in <tt>options</tt>
|
@@ -166,7 +176,7 @@ module Octokit
|
|
166
176
|
# @param tree [String] The SHA of the tree object the new commit will point to
|
167
177
|
# @param parents [String, Array] One SHA (for a normal commit) or an array of SHAs (for a merge) of the new commit's parent commits. If ommitted or empty, a root commit will be created
|
168
178
|
# @return [Sawyer::Resource] A hash representing the new commit
|
169
|
-
# @see http://developer.github.com/v3/git/commits
|
179
|
+
# @see http://developer.github.com/v3/git/commits/#create-a-commit
|
170
180
|
# @example Create a commit
|
171
181
|
# commit = Octokit.create_commit("octocat/Hello-World", "My commit message", "827efc6d56897b048c772eb4087f854f46256132", "7d1b31e74ee336d15cbd21741bc88a537ed063a0")
|
172
182
|
# commit.sha # => "7638417db6d59f3c431d3e1f261cc637155684cd"
|
@@ -183,7 +193,7 @@ module Octokit
|
|
183
193
|
#
|
184
194
|
# @param repo [String, Hash, Repository] A GitHub repository
|
185
195
|
# @return [Array] An array of hashes representing comments
|
186
|
-
# @see http://developer.github.com/v3/repos/comments
|
196
|
+
# @see http://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository
|
187
197
|
def list_commit_comments(repo, options = {})
|
188
198
|
get "repos/#{Repository.new(repo)}/comments", options
|
189
199
|
end
|
@@ -193,7 +203,7 @@ module Octokit
|
|
193
203
|
# @param repo [String, Hash, Repository] A GitHub repository
|
194
204
|
# @param sha [String] The SHA of the commit whose comments will be fetched
|
195
205
|
# @return [Array] An array of hashes representing comments
|
196
|
-
# @see http://developer.github.com/v3/repos/comments
|
206
|
+
# @see http://developer.github.com/v3/repos/comments/#list-comments-for-a-single-commit
|
197
207
|
def commit_comments(repo, sha, options = {})
|
198
208
|
get "repos/#{Repository.new(repo)}/commits/#{sha}/comments", options
|
199
209
|
end
|
@@ -203,7 +213,7 @@ module Octokit
|
|
203
213
|
# @param repo [String, Hash, Repository] A GitHub repository
|
204
214
|
# @param id [String] The ID of the comment to fetch
|
205
215
|
# @return [Sawyer::Resource] A hash representing the comment
|
206
|
-
# @see http://developer.github.com/v3/repos/comments
|
216
|
+
# @see http://developer.github.com/v3/repos/comments/#get-a-single-commit-comment
|
207
217
|
def commit_comment(repo, id, options = {})
|
208
218
|
get "repos/#{Repository.new(repo)}/comments/#{id}", options
|
209
219
|
end
|
@@ -217,7 +227,7 @@ module Octokit
|
|
217
227
|
# @param line [Integer] Line number in the file to comment on
|
218
228
|
# @param position [Integer] Line index in the diff to comment on
|
219
229
|
# @return [Sawyer::Resource] A hash representing the new commit comment
|
220
|
-
# @see http://developer.github.com/v3/repos/comments
|
230
|
+
# @see http://developer.github.com/v3/repos/comments/#create-a-commit-comment
|
221
231
|
# @example Create a commit comment
|
222
232
|
# commit = Octokit.create_commit_comment("octocat/Hello-World", "827efc6d56897b048c772eb4087f854f46256132", "My comment message", "README.md", 10, 1)
|
223
233
|
# commit.commit_id # => "827efc6d56897b048c772eb4087f854f46256132"
|
@@ -242,7 +252,7 @@ module Octokit
|
|
242
252
|
# @param id [String] The ID of the comment to update
|
243
253
|
# @param body [String] Message
|
244
254
|
# @return [Sawyer::Resource] A hash representing the updated commit comment
|
245
|
-
# @see http://developer.github.com/v3/repos/comments
|
255
|
+
# @see http://developer.github.com/v3/repos/comments/#update-a-commit-comment
|
246
256
|
# @example Update a commit comment
|
247
257
|
# commit = Octokit.update_commit_comment("octocat/Hello-World", "860296", "Updated commit comment")
|
248
258
|
# commit.id # => 860296
|
@@ -259,7 +269,7 @@ module Octokit
|
|
259
269
|
# @param repo [String, Hash, Repository] A GitHub repository
|
260
270
|
# @param id [String] The ID of the comment to delete
|
261
271
|
# @return [nil] nil
|
262
|
-
# @see http://developer.github.com/v3/repos/comments
|
272
|
+
# @see http://developer.github.com/v3/repos/comments/#delete-a-commit-comment
|
263
273
|
def delete_commit_comment(repo, id, options = {})
|
264
274
|
boolean_from_response :delete, "repos/#{Repository.new(repo)}/comments/#{id}", options
|
265
275
|
end
|
@@ -270,7 +280,7 @@ module Octokit
|
|
270
280
|
# @param start [String] The sha of the starting commit
|
271
281
|
# @param endd [String] The sha of the ending commit
|
272
282
|
# @return [Sawyer::Resource] A hash representing the comparison
|
273
|
-
# @see http://developer.github.com/v3/repos/commits
|
283
|
+
# @see http://developer.github.com/v3/repos/commits/#compare-two-commits
|
274
284
|
def compare(repo, start, endd, options = {})
|
275
285
|
get "repos/#{Repository.new(repo)}/compare/#{start}...#{endd}", options
|
276
286
|
end
|
@@ -282,7 +292,7 @@ module Octokit
|
|
282
292
|
# @param head [String] The branch or SHA1 to merge
|
283
293
|
# @option options [String] :commit_message The commit message for the merge
|
284
294
|
# @return [Sawyer::Resource] A hash representing the comparison
|
285
|
-
# @see http://developer.github.com/v3/repos/merging
|
295
|
+
# @see http://developer.github.com/v3/repos/merging/#perform-a-merge
|
286
296
|
def merge(repo, base, head, options = {})
|
287
297
|
params = {
|
288
298
|
:base => base,
|
@@ -13,7 +13,7 @@ module Octokit
|
|
13
13
|
# @param repo [String, Repository, Hash] A GitHub repository
|
14
14
|
# @option options [String] :ref name of the Commit/Branch/Tag. Defaults to “master”.
|
15
15
|
# @return [Sawyer::Resource] The detail of the readme
|
16
|
-
# @see http://developer.github.com/v3/repos/contents
|
16
|
+
# @see http://developer.github.com/v3/repos/contents/#get-the-readme
|
17
17
|
# @example Get the readme file for a repo
|
18
18
|
# Octokit.readme("octokit/octokit.rb")
|
19
19
|
def readme(repo, options={})
|
@@ -26,7 +26,7 @@ module Octokit
|
|
26
26
|
# @option options [String] :path A folder or file path
|
27
27
|
# @option options [String] :ref name of the Commit/Branch/Tag. Defaults to “master”.
|
28
28
|
# @return [Sawyer::Resource] The contents of a file or list of the files in the folder
|
29
|
-
# @see http://developer.github.com/v3/repos/contents
|
29
|
+
# @see http://developer.github.com/v3/repos/contents/#get-contents
|
30
30
|
# @example List the contents of lib/octokit.rb
|
31
31
|
# Octokit.contents("octokit/octokit.rb", :path => 'lib/octokit.rb')
|
32
32
|
def contents(repo, options={})
|
@@ -146,7 +146,7 @@ module Octokit
|
|
146
146
|
# @option options format [String] Either tarball (default) or zipball.
|
147
147
|
# @option options [String] :ref Optional valid Git reference, defaults to master.
|
148
148
|
# @return [String] Location of the download
|
149
|
-
# @see http://developer.github.com/v3/repos/contents
|
149
|
+
# @see http://developer.github.com/v3/repos/contents/#get-archive-link
|
150
150
|
# @example Get archive link for octokit/octokit.rb
|
151
151
|
# Octokit.archive_link("octokit/octokit.rb")
|
152
152
|
def archive_link(repo, options={})
|
@@ -75,7 +75,7 @@ module Octokit
|
|
75
75
|
# @param repo [String, Repository, Hash] A GitHub repository
|
76
76
|
# @param id [Integer] ID of the download
|
77
77
|
# @deprecated As of December 11th, 2012: https://github.com/blog/1302-goodbye-uploads
|
78
|
-
# @see http://developer.github.com/v3/repos/downloads/#delete-a-
|
78
|
+
# @see http://developer.github.com/v3/repos/downloads/#delete-a-download
|
79
79
|
# @return [Boolean] Status
|
80
80
|
# @example Get the "Robawt" download from Github/Hubot
|
81
81
|
# Octokit.delete_download("github/hubot", 1234)
|
@@ -110,6 +110,7 @@ module Octokit
|
|
110
110
|
#
|
111
111
|
# @return [Array<Sawyer::Resource>] Array of all Issue Events for this Repository
|
112
112
|
# @see http://developer.github.com/v3/issues/events/#list-events-for-a-repository
|
113
|
+
# @see http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
|
113
114
|
# @example Get all Issue Events for Octokit
|
114
115
|
# Octokit.repository_issue_events("octokit/octokit.rb")
|
115
116
|
def repository_issue_events(repo, options = {})
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Feeds API
|
5
|
+
#
|
6
|
+
# @see http://developer.github.com/v3/activity/feeds/
|
7
|
+
module Feeds
|
8
|
+
|
9
|
+
# List Feeds
|
10
|
+
#
|
11
|
+
# The feeds returned depend on authentication, see the GitHub API docs
|
12
|
+
# for more information.
|
13
|
+
#
|
14
|
+
# @return [Array<Sawyer::Resource>] list of feeds
|
15
|
+
# @see http://developer.github.com/v3/activity/feeds/#list-feeds
|
16
|
+
def feeds
|
17
|
+
get "feeds"
|
18
|
+
end
|
19
|
+
|
20
|
+
# Get a Feed by name
|
21
|
+
#
|
22
|
+
# @param [Symbol, String] Name of feed to retrieve.
|
23
|
+
# @return [Feed] Parsed feed in the format returned by the configured
|
24
|
+
# parser.
|
25
|
+
def feed(name, options = {})
|
26
|
+
if rel = feeds._links[name]
|
27
|
+
get rel.href, :accept => rel.type, :options => options
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/octokit/client/gists.rb
CHANGED
@@ -11,7 +11,6 @@ module Octokit
|
|
11
11
|
# These templates can be passed option when creating a repository.
|
12
12
|
#
|
13
13
|
# @see http://developer.github.com/v3/gitignore/#listing-available-templates
|
14
|
-
# @see http://developer.github.com/v3/repos/#create
|
15
14
|
#
|
16
15
|
# @return [Array<String>] List of templates.
|
17
16
|
#
|
data/lib/octokit/client/hooks.rb
CHANGED
@@ -7,6 +7,7 @@ module Octokit
|
|
7
7
|
# List all Service Hooks supported by GitHub
|
8
8
|
#
|
9
9
|
# @return [Sawyer::Resource] A list of all hooks on GitHub
|
10
|
+
# @see http://developer.github.com/v3/repos/hooks/#services
|
10
11
|
# @example List all hooks
|
11
12
|
# Octokit.available_hooks
|
12
13
|
def available_hooks(options = {})
|
@@ -20,7 +20,8 @@ module Octokit
|
|
20
20
|
# @option options [String] :direction (desc) Direction: <tt>asc</tt> or <tt>desc</tt>.
|
21
21
|
# @option options [Integer] :page (1) Page number.
|
22
22
|
# @return [Array<Sawyer::Resource>] A list of issues for a repository.
|
23
|
-
# @see http://developer.github.com/v3/issues/#list-issues-for-
|
23
|
+
# @see http://developer.github.com/v3/issues/#list-issues-for-a-repository
|
24
|
+
# @see http://developer.github.com/v3/issues/#list-issues
|
24
25
|
# @example List issues for a repository
|
25
26
|
# Octokit.list_issues("sferik/rails_admin")
|
26
27
|
# @example List issues for the authenticted user across repositories
|
@@ -103,7 +104,7 @@ module Octokit
|
|
103
104
|
# Get a single issue from a repository
|
104
105
|
#
|
105
106
|
# @param repo [String, Repository, Hash] A GitHub repository
|
106
|
-
# @param number [
|
107
|
+
# @param number [Integer] Number ID of the issue
|
107
108
|
# @return [Sawyer::Resource] The issue you requested, if it exists
|
108
109
|
# @see http://developer.github.com/v3/issues/#get-a-single-issue
|
109
110
|
# @example Get issue #25 from octokit/octokit.rb
|
@@ -115,7 +116,7 @@ module Octokit
|
|
115
116
|
# Close an issue
|
116
117
|
#
|
117
118
|
# @param repo [String, Repository, Hash] A GitHub repository
|
118
|
-
# @param number [
|
119
|
+
# @param number [Integer] Number ID of the issue
|
119
120
|
# @param options [Hash] A customizable set of options.
|
120
121
|
# @option options [String] :assignee User login.
|
121
122
|
# @option options [Integer] :milestone Milestone number.
|
@@ -131,7 +132,7 @@ module Octokit
|
|
131
132
|
# Reopen an issue
|
132
133
|
#
|
133
134
|
# @param repo [String, Repository, Hash] A GitHub repository
|
134
|
-
# @param number [
|
135
|
+
# @param number [Integer] Number ID of the issue
|
135
136
|
# @param options [Hash] A customizable set of options.
|
136
137
|
# @option options [String] :assignee User login.
|
137
138
|
# @option options [Integer] :milestone Milestone number.
|
@@ -147,7 +148,7 @@ module Octokit
|
|
147
148
|
# Update an issue
|
148
149
|
#
|
149
150
|
# @param repo [String, Repository, Hash] A GitHub repository
|
150
|
-
# @param number [
|
151
|
+
# @param number [Integer] Number ID of the issue
|
151
152
|
# @param title [String] Updated title for the issue
|
152
153
|
# @param body [String] Updated body of the issue
|
153
154
|
# @param options [Hash] A customizable set of options.
|
@@ -195,9 +196,9 @@ module Octokit
|
|
195
196
|
# Get all comments attached to an issue
|
196
197
|
#
|
197
198
|
# @param repo [String, Repository, Hash] A GitHub repository
|
198
|
-
# @param number [
|
199
|
+
# @param number [Integer] Number ID of the issue
|
199
200
|
# @return [Array<Sawyer::Resource>] Array of comments that belong to an issue
|
200
|
-
# @see http://developer.github.com/v3/issues/comments
|
201
|
+
# @see http://developer.github.com/v3/issues/comments/#list-comments-on-an-issue
|
201
202
|
# @example Get comments for issue #25 from octokit/octokit.rb
|
202
203
|
# Octokit.issue_comments("octokit/octokit.rb", "25")
|
203
204
|
def issue_comments(repo, number, options = {})
|
@@ -207,7 +208,7 @@ module Octokit
|
|
207
208
|
# Get a single comment attached to an issue
|
208
209
|
#
|
209
210
|
# @param repo [String, Repository, Hash] A GitHub repository
|
210
|
-
# @param number [
|
211
|
+
# @param number [Integer] Number ID of the comment
|
211
212
|
# @return [Sawyer::Resource] The specific comment in question
|
212
213
|
# @see http://developer.github.com/v3/issues/comments/#get-a-single-comment
|
213
214
|
# @example Get comment #1194549 from an issue on octokit/octokit.rb
|
@@ -12,7 +12,7 @@ module Octokit
|
|
12
12
|
#
|
13
13
|
# @param repo [String, Repository, Hash] A GitHub repository
|
14
14
|
# @return [Array<Sawyer::Resource>] A list of the labels across the repository
|
15
|
-
# @see http://developer.github.com/v3/issues/labels
|
15
|
+
# @see http://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository
|
16
16
|
# @example List labels for octokit/octokit.rb
|
17
17
|
# Octokit.labels("octokit/octokit.rb")
|
18
18
|
def labels(repo, options = {})
|
@@ -37,7 +37,7 @@ module Octokit
|
|
37
37
|
# @param label [String] A new label
|
38
38
|
# @param color [String] A color, in hex, without the leading #
|
39
39
|
# @return [Sawyer::Resource] The new label
|
40
|
-
# @see http://developer.github.com/v3/issues/labels
|
40
|
+
# @see http://developer.github.com/v3/issues/labels/#create-a-label
|
41
41
|
# @example Add a new label "Version 1.0" with color "#cccccc"
|
42
42
|
# Octokit.add_label("octokit/octokit.rb", "Version 1.0", "cccccc")
|
43
43
|
def add_label(repo, label, color="ffffff", options = {})
|
@@ -49,7 +49,7 @@ module Octokit
|
|
49
49
|
# @param repo [String, Repository, Hash] A GitHub repository
|
50
50
|
# @param label [String] The name of the label which will be updated
|
51
51
|
# @param options [Hash] A customizable set of options.
|
52
|
-
# @option options [String] :
|
52
|
+
# @option options [String] :name An updated label name
|
53
53
|
# @option options [String] :color An updated color value, in hex, without leading #
|
54
54
|
# @return [Sawyer::Resource] The updated label
|
55
55
|
# @see http://developer.github.com/v3/issues/labels/#update-a-label
|
@@ -12,7 +12,7 @@ module Octokit
|
|
12
12
|
# @option options [String] (optional) :mode (`markdown` or `gfm`)
|
13
13
|
# @option options [String] (optional) :context Repo context
|
14
14
|
# @return [String] HTML renderization
|
15
|
-
# @see http://developer.github.com/v3/
|
15
|
+
# @see http://developer.github.com/v3/markdown/#render-an-arbitrary-markdown-document
|
16
16
|
# @example Render some GFM
|
17
17
|
# Octokit.markdown('Fixed in #111', :mode => "gfm", :context => "octokit/octokit.rb")
|
18
18
|
def markdown(text, options = {})
|
data/lib/octokit/client/meta.rb
CHANGED
@@ -7,7 +7,7 @@ module Octokit
|
|
7
7
|
module Meta
|
8
8
|
|
9
9
|
# Get meta information about GitHub.com, the service.
|
10
|
-
# @see http://developer.github.com/v3/meta
|
10
|
+
# @see http://developer.github.com/v3/meta/#meta
|
11
11
|
# @return [Sawyer::Resource] Hash with meta information.
|
12
12
|
# @example Get GitHub meta information
|
13
13
|
# @client.github_meta
|
@@ -15,7 +15,7 @@ module Octokit
|
|
15
15
|
# @option options [String] :sort (created) Sort: <tt>created</tt>, <tt>updated</tt>, or <tt>comments</tt>.
|
16
16
|
# @option options [String] :direction (desc) Direction: <tt>asc</tt> or <tt>desc</tt>.
|
17
17
|
# @return [Array<Sawyer::Resource>] A list of milestones for a repository.
|
18
|
-
# @see http://developer.github.com/v3/issues/milestones/#
|
18
|
+
# @see http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
|
19
19
|
# @example List milestones for a repository
|
20
20
|
# Octokit.list_milestones("octokit/octokit.rb")
|
21
21
|
def list_milestones(repository, options = {})
|
@@ -13,12 +13,13 @@ module Octokit
|
|
13
13
|
# @param repo [String, Hash, Repository] A GitHub repository
|
14
14
|
# @param tree_sha [String] The SHA of the tree to fetch
|
15
15
|
# @return [Sawyer::Resource] A hash representing the fetched tree
|
16
|
-
# @see http://developer.github.com/v3/git/trees
|
16
|
+
# @see http://developer.github.com/v3/git/trees/#get-a-tree
|
17
|
+
# @see http://developer.github.com/v3/git/trees/#get-a-tree-recursively
|
17
18
|
# @example Fetch a tree and inspect the path of one of its files
|
18
19
|
# tree = Octokit.tree("octocat/Hello-World", "9fb037999f264ba9a7fc6274d15fa3ae2ab98312")
|
19
20
|
# tree.tree.first.path # => "file.rb"
|
20
21
|
# @example Fetch a tree recursively
|
21
|
-
# tree = Octokit.tree("octocat/Hello-World", "fc6274d15fa3ae2ab983129fb037999f264ba9a7")
|
22
|
+
# tree = Octokit.tree("octocat/Hello-World", "fc6274d15fa3ae2ab983129fb037999f264ba9a7", :recursive => true)
|
22
23
|
# tree.tree.first.path # => "subdir/file.txt"
|
23
24
|
def tree(repo, tree_sha, options = {})
|
24
25
|
get "repos/#{Repository.new(repo)}/git/trees/#{tree_sha}", options
|
@@ -31,7 +32,7 @@ module Octokit
|
|
31
32
|
# @param repo [String, Hash, Repository] A GitHub repository
|
32
33
|
# @param tree [Array] An array of hashes representing a tree structure
|
33
34
|
# @return [Sawyer::Resource] A hash representing the new tree
|
34
|
-
# @see http://developer.github.com/v3/git/trees
|
35
|
+
# @see http://developer.github.com/v3/git/trees/#create-a-tree
|
35
36
|
# @example Create a tree containing one file
|
36
37
|
# tree = Octokit.create_tree("octocat/Hello-World", [ { :path => "file.rb", :mode => "100644", :type => "blob", :sha => "44b4fc6d56897b048c772eb4087f854f46256132" } ])
|
37
38
|
# tree.sha # => "cd8274d15fa3ae2ab983129fb037999f264ba9a7"
|
@@ -46,7 +47,7 @@ module Octokit
|
|
46
47
|
# @param repo [String, Hash, Repository] A GitHub repository
|
47
48
|
# @param blob_sha [String] The SHA of the blob to fetch
|
48
49
|
# @return [Sawyer::Resource] A hash representing the fetched blob
|
49
|
-
# @see http://developer.github.com/v3/git/blobs
|
50
|
+
# @see http://developer.github.com/v3/git/blobs/#get-a-blob
|
50
51
|
# @example Fetch a blob and inspect its contents
|
51
52
|
# blob = Octokit.blob("octocat/Hello-World", "827efc6d56897b048c772eb4087f854f46256132")
|
52
53
|
# blob.encoding # => "utf-8"
|
@@ -67,7 +68,7 @@ module Octokit
|
|
67
68
|
# @param content [String] Content of the blob
|
68
69
|
# @param encoding [String] The content's encoding. <tt>utf-8</tt> and <tt>base64</tt> are accepted. If your data cannot be losslessly sent as a UTF-8 string, you can base64 encode it
|
69
70
|
# @return [String] The new blob's SHA, e.g. <tt>827efc6d56897b048c772eb4087f854f46256132</tt>
|
70
|
-
# @see http://developer.github.com/v3/git/blobs
|
71
|
+
# @see http://developer.github.com/v3/git/blobs/#create-a-blob
|
71
72
|
# @example Create a blob containing <tt>foo bar baz</tt>
|
72
73
|
# Octokit.create_blob("octocat/Hello-World", "foo bar baz")
|
73
74
|
# @example Create a blob containing <tt>foo bar baz</tt>, encoded using base64
|
@@ -118,18 +118,33 @@ module Octokit
|
|
118
118
|
#
|
119
119
|
# @param org [String] Organization GitHub username.
|
120
120
|
# @return [Array<Sawyer::Resource>] Array of hashes representing users.
|
121
|
-
# @see http://developer.github.com/v3/orgs/members/#list
|
121
|
+
# @see http://developer.github.com/v3/orgs/members/#members-list
|
122
122
|
# @example
|
123
123
|
# Octokit.organization_members('github')
|
124
124
|
# @example
|
125
|
-
# @client.organization_members('github')
|
126
|
-
# @example
|
127
125
|
# Octokit.org_members('github')
|
128
126
|
def organization_members(org, options = {})
|
129
|
-
|
127
|
+
path = "public_" if options.delete(:public)
|
128
|
+
paginate "orgs/#{org}/#{path}members", options
|
130
129
|
end
|
131
130
|
alias :org_members :organization_members
|
132
131
|
|
132
|
+
# Get organization public members
|
133
|
+
#
|
134
|
+
# Lists the public members of an organization
|
135
|
+
#
|
136
|
+
# @param org [String] Organization GitHub username.
|
137
|
+
# @return [Array<Sawyer::Resource>] Array of hashes representing users.
|
138
|
+
# @see http://developer.github.com/v3/orgs/members/#public-members-list
|
139
|
+
# @example
|
140
|
+
# Octokit.organization_public_members('github')
|
141
|
+
# @example
|
142
|
+
# Octokit.org_public_members('github')
|
143
|
+
def organization_public_members(org, options = {})
|
144
|
+
organization_members org, options.merge(:public => true)
|
145
|
+
end
|
146
|
+
alias :org_public_members :organization_public_members
|
147
|
+
|
133
148
|
# Check if a user is a member of an organization.
|
134
149
|
#
|
135
150
|
# Use this to check if another user is a member of an organization that
|
@@ -346,6 +361,23 @@ module Octokit
|
|
346
361
|
end
|
347
362
|
alias :team_repos :team_repositories
|
348
363
|
|
364
|
+
# Check if a repo is managed by a specific team
|
365
|
+
#
|
366
|
+
# @param team_id [Integer] Team ID.
|
367
|
+
# @param repo [String, Hash, Repository] A GitHub repository.
|
368
|
+
# @return [Boolean] True if managed by a team. False if not managed by
|
369
|
+
# the team OR the requesting user does not have authorization to access
|
370
|
+
# the team information.
|
371
|
+
# @see http://developer.github.com/v3/orgs/teams/#get-team-repo
|
372
|
+
# @example
|
373
|
+
# @client.team_repository?(8675309, 'octokit/octokit.rb')
|
374
|
+
# @example
|
375
|
+
# @client.team_repo?(8675309, 'octokit/octokit.rb')
|
376
|
+
def team_repository?(team_id, repo, options = {})
|
377
|
+
boolean_from_response :get, "teams/#{team_id}/repos/#{Repository.new repo}"
|
378
|
+
end
|
379
|
+
alias :team_repo? :team_repository?
|
380
|
+
|
349
381
|
# Add team repository
|
350
382
|
#
|
351
383
|
# Requires authenticated user to be an owner of the organization that the
|
@@ -393,7 +425,7 @@ module Octokit
|
|
393
425
|
# @param org [String] Organization GitHub username.
|
394
426
|
# @param user [String] GitHub username of user to remove.
|
395
427
|
# @return [Boolean] True if removal is successful, false otherwise.
|
396
|
-
# @see http://developer.github.com/v3/orgs/
|
428
|
+
# @see http://developer.github.com/v3/orgs/members/#remove-a-member
|
397
429
|
# @example
|
398
430
|
# @client.remove_organization_member('github', 'pengwynn')
|
399
431
|
# @example
|
@@ -18,6 +18,7 @@ module Octokit
|
|
18
18
|
# @param topic [String] A recoginized and supported pubsub topic
|
19
19
|
# @param callback [String] A callback url to be posted to when the topic event is fired
|
20
20
|
# @return [Boolean] true if the subscribe was successful, otherwise an error is raised
|
21
|
+
# @see http://developer.github.com/v3/repos/hooks/#subscribing
|
21
22
|
# @example Subscribe to push events from one of your repositories, having an email sent when fired
|
22
23
|
# client = Octokit::Client.new(:oauth_token = "token")
|
23
24
|
# client.subscribe("https://github.com/joshk/devise_imapable/events/push", "github://Email?address=josh.kalderimis@gmail.com")
|
@@ -37,6 +38,7 @@ module Octokit
|
|
37
38
|
# @param topic [String] A recoginized pubsub topic
|
38
39
|
# @param callback [String] A callback url to be unsubscribed from
|
39
40
|
# @return [Boolean] true if the unsubscribe was successful, otherwise an error is raised
|
41
|
+
# @see http://developer.github.com/v3/repos/hooks/#subscribing
|
40
42
|
# @example Unsubscribe to push events from one of your repositories, no longer having an email sent when fired
|
41
43
|
# client = Octokit::Client.new(:oauth_token = "token")
|
42
44
|
# client.unsubscribe("https://github.com/joshk/devise_imapable/events/push", "github://Email?address=josh.kalderimis@gmail.com")
|
@@ -58,6 +60,7 @@ module Octokit
|
|
58
60
|
# @param service_arguments [Hash] params that will be passed by subscribed hook.
|
59
61
|
# List of services is available @ https://github.com/github/github-services/tree/master/docs.
|
60
62
|
# Please refer Data node for complete list of arguments.
|
63
|
+
# @see http://developer.github.com/v3/repos/hooks/#subscribing
|
61
64
|
# @example Subscribe to push events to one of your repositories to Travis-CI
|
62
65
|
# client = Octokit::Client.new(:oauth_token = "token")
|
63
66
|
# client.subscribe_service_hook('joshk/device_imapable', 'Travis', { :token => "test", :domain => "domain", :user => "user" })
|
@@ -72,6 +75,7 @@ module Octokit
|
|
72
75
|
# @param repo [String, Repository, Hash] A GitHub repository
|
73
76
|
# @param service_name [String] service name owner
|
74
77
|
# List of services is available @ https://github.com/github/github-services/tree/master/docs.
|
78
|
+
# @see http://developer.github.com/v3/repos/hooks/#subscribing
|
75
79
|
# @example Subscribe to push events to one of your repositories to Travis-CI
|
76
80
|
# client = Octokit::Client.new(:oauth_token = "token")
|
77
81
|
# client.unsubscribe_service_hook('joshk/device_imapable', 'Travis')
|
@@ -254,6 +254,7 @@ module Octokit
|
|
254
254
|
# @param repo [String, Hash, Repository] A GitHub repository
|
255
255
|
# @param comment_id [Integer] Id of the comment to delete
|
256
256
|
# @return [Boolean] True if deleted, false otherwise
|
257
|
+
# @see http://developer.github.com/v3/pulls/comments/#delete-a-comment
|
257
258
|
# @example
|
258
259
|
# @client.delete_pull_request_comment("octokit/octokit.rb", 1902707)
|
259
260
|
def delete_pull_request_comment(repo, comment_id, options = {})
|
@@ -264,7 +265,7 @@ module Octokit
|
|
264
265
|
|
265
266
|
# List files on a pull request
|
266
267
|
#
|
267
|
-
# @see http://developer.github.com/v3/pulls/#list-
|
268
|
+
# @see http://developer.github.com/v3/pulls/#list-pull-requests-files
|
268
269
|
# @param repo [String, Hash, Repository] A GitHub repository
|
269
270
|
# @param number [Integer] Number of pull request
|
270
271
|
# @return [Array<Sawyer::Resource>] List of files
|
@@ -9,7 +9,7 @@ module Octokit
|
|
9
9
|
# Get rate limit info from last response if available
|
10
10
|
# or make a new request to fetch rate limit
|
11
11
|
#
|
12
|
-
# @see http://developer.github.com/v3/#rate-
|
12
|
+
# @see http://developer.github.com/v3/rate_limit/#rate-limit
|
13
13
|
# @return [Octokit::RateLimit] Rate limit info
|
14
14
|
def rate_limit(options = {})
|
15
15
|
return rate_limit! if last_response.nil?
|
@@ -20,7 +20,7 @@ module Octokit
|
|
20
20
|
|
21
21
|
# Get number of rate limted requests remaining
|
22
22
|
#
|
23
|
-
# @see http://developer.github.com/v3/#rate-
|
23
|
+
# @see http://developer.github.com/v3/rate_limit/#rate-limit
|
24
24
|
# @return [Fixnum] Number of requests remaining in this period
|
25
25
|
def rate_limit_remaining(options = {})
|
26
26
|
puts "Deprecated: Please use .rate_limit.remaining"
|
@@ -30,7 +30,7 @@ module Octokit
|
|
30
30
|
|
31
31
|
# Refresh rate limit info by making a new request
|
32
32
|
#
|
33
|
-
# @see http://developer.github.com/v3/#rate-
|
33
|
+
# @see http://developer.github.com/v3/rate_limit/#rate-limit
|
34
34
|
# @return [Octokit::RateLimit] Rate limit info
|
35
35
|
def rate_limit!(options = {})
|
36
36
|
get "rate_limit"
|
@@ -40,7 +40,7 @@ module Octokit
|
|
40
40
|
|
41
41
|
# Refresh rate limit info and get number of rate limted requests remaining
|
42
42
|
#
|
43
|
-
# @see http://developer.github.com/v3/#rate-
|
43
|
+
# @see http://developer.github.com/v3/rate_limit/#rate-limit
|
44
44
|
# @return [Fixnum] Number of requests remaining in this period
|
45
45
|
def rate_limit_remaining!(options = {})
|
46
46
|
puts "Deprecated: Please use .rate_limit!.remaining"
|
data/lib/octokit/client/refs.rb
CHANGED
@@ -11,7 +11,7 @@ module Octokit
|
|
11
11
|
# @param repo [String, Repository, Hash] A GitHub repository
|
12
12
|
# @param namespace [String] The ref namespace, e.g. <tt>tag</tt> or <tt>heads</tt>
|
13
13
|
# @return [Array<Sawyer::Resource>] A list of references matching the repo and the namespace
|
14
|
-
# @see http://developer.github.com/v3/git/refs
|
14
|
+
# @see http://developer.github.com/v3/git/refs/#get-all-references
|
15
15
|
# @example Fetch all refs for sferik/rails_admin
|
16
16
|
# Octokit.refs("sferik/rails_admin")
|
17
17
|
def refs(repo, namespace = nil, options = {})
|
@@ -28,7 +28,7 @@ module Octokit
|
|
28
28
|
# @param repo [String, Repository, Hash] A GitHub repository
|
29
29
|
# @param ref [String] The ref, e.g. <tt>tags/v0.0.3</tt>
|
30
30
|
# @return [Sawyer::Resource] The reference matching the given repo and the ref id
|
31
|
-
# @see http://developer.github.com/v3/git/refs
|
31
|
+
# @see http://developer.github.com/v3/git/refs/#get-a-reference
|
32
32
|
# @example Fetch tags/v0.0.3 for sferik/rails_admin
|
33
33
|
# Octokit.ref("sferik/rails_admin","tags/v0.0.3")
|
34
34
|
def ref(repo, ref, options = {})
|
@@ -42,7 +42,7 @@ module Octokit
|
|
42
42
|
# @param ref [String] The ref, e.g. <tt>tags/v0.0.3</tt>
|
43
43
|
# @param sha [String] A SHA, e.g. <tt>827efc6d56897b048c772eb4087f854f46256132</tt>
|
44
44
|
# @return [Array<Sawyer::Resource>] The list of references, already containing the new one
|
45
|
-
# @see http://developer.github.com/v3/git/refs
|
45
|
+
# @see http://developer.github.com/v3/git/refs/#create-a-reference
|
46
46
|
# @example Create refs/heads/master for octocat/Hello-World with sha 827efc6d56897b048c772eb4087f854f46256132
|
47
47
|
# Octokit.create_ref("octocat/Hello-World","heads/master", "827efc6d56897b048c772eb4087f854f46256132")
|
48
48
|
def create_ref(repo, ref, sha, options = {})
|
@@ -61,7 +61,7 @@ module Octokit
|
|
61
61
|
# @param sha [String] A SHA, e.g. <tt>827efc6d56897b048c772eb4087f854f46256132</tt>
|
62
62
|
# @param force [Boolean] A flag indicating one wants to force the update to make sure the update is a fast-forward update.
|
63
63
|
# @return [Array<Sawyer::Resource>] The list of references updated
|
64
|
-
# @see http://developer.github.com/v3/git/refs
|
64
|
+
# @see http://developer.github.com/v3/git/refs/#update-a-reference
|
65
65
|
# @example Force update heads/sc/featureA for octocat/Hello-World with sha aa218f56b14c9653891f9e74264a383fa43fefbd
|
66
66
|
# Octokit.update_ref("octocat/Hello-World","heads/sc/featureA", "aa218f56b14c9653891f9e74264a383fa43fefbd")
|
67
67
|
def update_ref(repo, ref, sha, force = true, options = {})
|
@@ -73,12 +73,38 @@ module Octokit
|
|
73
73
|
end
|
74
74
|
alias :update_reference :update_ref
|
75
75
|
|
76
|
+
# Update a branch
|
77
|
+
#
|
78
|
+
# @param repo [String, Repository, Hash] A GitHub repository
|
79
|
+
# @param branch [String] The ref, e.g. <tt>feature/new-shiny</tt>
|
80
|
+
# @param sha [String] A SHA, e.g. <tt>827efc6d56897b048c772eb4087f854f46256132</tt>
|
81
|
+
# @param force [Boolean] A flag indicating one wants to force the update to make sure the update is a fast-forward update.
|
82
|
+
# @return [Array<Sawyer::Resource>] The list of references updated
|
83
|
+
# @see http://developer.github.com/v3/git/refs/#update-a-reference
|
84
|
+
# @example Force update heads/sc/featureA for octocat/Hello-World with sha aa218f56b14c9653891f9e74264a383fa43fefbd
|
85
|
+
# Octokit.update_ref("octocat/Hello-World","sc/featureA", "aa218f56b14c9653891f9e74264a383fa43fefbd")
|
86
|
+
def update_branch(repo, branch, sha, force = true, options = {})
|
87
|
+
update_ref repo, "heads/#{branch}", sha, force, options
|
88
|
+
end
|
89
|
+
|
90
|
+
# Delete a single branch
|
91
|
+
#
|
92
|
+
# @param repo [String, Repository, Hash] A GitHub repository
|
93
|
+
# @param branch [String] The branch, e.g. <tt>fix-refs</tt>
|
94
|
+
# @return [Boolean] Success
|
95
|
+
# @see http://developer.github.com/v3/git/refs/#delete-a-reference
|
96
|
+
# @example Delete uritemplate for sigmavirus24/github3.py
|
97
|
+
# Octokit.delete_branch("sigmavirus24/github3.py", "uritemplate")
|
98
|
+
def delete_branch(repo, branch, options = {})
|
99
|
+
delete_ref repo, "heads/#{branch}", options
|
100
|
+
end
|
101
|
+
|
76
102
|
# Delete a single reference
|
77
103
|
#
|
78
104
|
# @param repo [String, Repository, Hash] A GitHub repository
|
79
105
|
# @param ref [String] The ref, e.g. <tt>tags/v0.0.3</tt>
|
80
106
|
# @return [Boolean] Success
|
81
|
-
# @see http://developer.github.com/v3/git/refs
|
107
|
+
# @see http://developer.github.com/v3/git/refs/#delete-a-reference
|
82
108
|
# @example Delete tags/v0.0.3 for sferik/rails_admin
|
83
109
|
# Octokit.delete_ref("sferik/rails_admin","tags/v0.0.3")
|
84
110
|
def delete_ref(repo, ref, options = {})
|
@@ -112,7 +112,7 @@ module Octokit
|
|
112
112
|
# @option options [String] :name The name for the file
|
113
113
|
# @option options [String] :label The download text for the file
|
114
114
|
# @return [Sawyer::Resource] The release asset
|
115
|
-
# @see http://developer.github.com/v3/repos/releases/#
|
115
|
+
# @see http://developer.github.com/v3/repos/releases/#edit-a-release-asset
|
116
116
|
def update_release_asset(asset_url, options = {})
|
117
117
|
patch(asset_url, options)
|
118
118
|
end
|
@@ -74,7 +74,7 @@ module Octokit
|
|
74
74
|
# This provides a dump of every repository, in the order that they were
|
75
75
|
# created.
|
76
76
|
#
|
77
|
-
# @see http://developer.github.com/v3/repos/#list-all-repositories
|
77
|
+
# @see http://developer.github.com/v3/repos/#list-all-public-repositories
|
78
78
|
#
|
79
79
|
# @param options [Hash] Optional options
|
80
80
|
# @option options [Integer] :since The integer ID of the last Repository
|
@@ -195,7 +195,7 @@ module Octokit
|
|
195
195
|
#
|
196
196
|
# @param repo [String, Hash, Repository] A GitHub repository
|
197
197
|
# @return [Array<Sawyer::Resource>] Array of hashes representing deploy keys.
|
198
|
-
# @see http://developer.github.com/v3/repos/keys/#
|
198
|
+
# @see http://developer.github.com/v3/repos/keys/#list
|
199
199
|
# @example
|
200
200
|
# @client.deploy_keys('octokit/octokit.rb')
|
201
201
|
# @example
|
@@ -205,6 +205,18 @@ module Octokit
|
|
205
205
|
end
|
206
206
|
alias :list_deploy_keys :deploy_keys
|
207
207
|
|
208
|
+
# Get a single deploy key for a repo
|
209
|
+
#
|
210
|
+
# @param repo [String, Hash, Repository] A GitHub repository.
|
211
|
+
# @param id [Integer] Deploy key ID.
|
212
|
+
# @return [Sawyer::Resource] Deploy key.
|
213
|
+
# @see http://developer.github.com/v3/repos/keys/#get
|
214
|
+
# @example
|
215
|
+
# @client.deploy_key('octokit/octokit.rb', 8675309)
|
216
|
+
def deploy_key(repo, id, options={})
|
217
|
+
get "repos/#{Repository.new repo}/keys/#{id}", options
|
218
|
+
end
|
219
|
+
|
208
220
|
# Add deploy key to a repo
|
209
221
|
#
|
210
222
|
# Requires authenticated client.
|
@@ -220,6 +232,24 @@ module Octokit
|
|
220
232
|
post "repos/#{Repository.new repo}/keys", options.merge(:title => title, :key => key)
|
221
233
|
end
|
222
234
|
|
235
|
+
# Edit a deploy key
|
236
|
+
#
|
237
|
+
# @param repo [String, Hash, Repository] A GitHub repository.
|
238
|
+
# @param id [Integer] Deploy key ID.
|
239
|
+
# @param options [Hash] Attributes to edit.
|
240
|
+
# @option title [String] Key title.
|
241
|
+
# @option key [String] Public key.
|
242
|
+
# @return [Sawyer::Resource] Updated deploy key.
|
243
|
+
# @see http://developer.github.com/v3/repos/keys/#edit
|
244
|
+
# @example Update the key for a deploy key.
|
245
|
+
# @client.edit_deploy_key('octokit/octokit.rb', 8675309, :key => 'ssh-rsa BBB...')
|
246
|
+
# @example
|
247
|
+
# @client.update_deploy_key('octokit/octokit.rb', 8675309, :title => 'Uber', :key => 'ssh-rsa BBB...'))
|
248
|
+
def edit_deploy_key(repo, id, options)
|
249
|
+
patch "repos/#{Repository.new repo}/keys/#{id}", options
|
250
|
+
end
|
251
|
+
alias :update_deploy_key :edit_deploy_key
|
252
|
+
|
223
253
|
# Remove deploy key from a repo
|
224
254
|
#
|
225
255
|
# Requires authenticated client.
|
@@ -286,6 +316,20 @@ module Octokit
|
|
286
316
|
end
|
287
317
|
alias :remove_collab :remove_collaborator
|
288
318
|
|
319
|
+
# Checks if a user is a collaborator for a repo.
|
320
|
+
#
|
321
|
+
# Requires authenticated client.
|
322
|
+
#
|
323
|
+
# @param repo [String, Hash, Repository] A GitHub repository.
|
324
|
+
# @param collaborator [String] Collaborator GitHub username to check.
|
325
|
+
# @return [Boolean] True if user is a collaborator, false otherwise.
|
326
|
+
# @see http://developer.github.com/v3/repos/collaborators/#get
|
327
|
+
# @example
|
328
|
+
# @client.collaborator?('octokit/octokit.rb', 'holman')
|
329
|
+
def collaborator?(repo, collaborator, options={})
|
330
|
+
boolean_from_response :get, "repos/#{Repository.new repo}/collaborators/#{collaborator}", options
|
331
|
+
end
|
332
|
+
|
289
333
|
# List teams for a repo
|
290
334
|
#
|
291
335
|
# Requires authenticated client that is an owner or collaborator of the repo.
|
@@ -331,7 +375,7 @@ module Octokit
|
|
331
375
|
#
|
332
376
|
# @param repo [String, Hash, Repository] A GitHub repository.
|
333
377
|
# @return [Array<Sawyer::Resource>] Array of hashes representing users.
|
334
|
-
# @see http://developer.github.com/v3/
|
378
|
+
# @see http://developer.github.com/v3/activity/starring/#list-stargazers
|
335
379
|
# @example
|
336
380
|
# Octokit.stargazers('octokit/octokit.rb')
|
337
381
|
# @example
|
@@ -560,7 +604,7 @@ module Octokit
|
|
560
604
|
# @param repo [String, Hash, Repository] A GitHub repository.
|
561
605
|
# @param id [Integer] Id of the hook to test.
|
562
606
|
# @return [Boolean] Success
|
563
|
-
# @see http://developer.github.com/v3/repos/hooks/#test-a-hook
|
607
|
+
# @see http://developer.github.com/v3/repos/hooks/#test-a-push-hook
|
564
608
|
# @example
|
565
609
|
# @client.test_hook('octokit/octokit.rb', 1000000)
|
566
610
|
def test_hook(repo, id, options = {})
|
@@ -11,7 +11,7 @@ module Octokit
|
|
11
11
|
# @param repo [String, Repository, Hash] A GitHub repository
|
12
12
|
# @param sha [String] The SHA1 for the commit
|
13
13
|
# @return [Array<Sawyer::Resource>] A list of statuses
|
14
|
-
# @see http://developer.github.com/v3/repos/statuses
|
14
|
+
# @see http://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref
|
15
15
|
def statuses(repo, sha, options = {})
|
16
16
|
get "repos/#{Repository.new(repo)}/statuses/#{sha}", options
|
17
17
|
end
|
@@ -23,7 +23,7 @@ module Octokit
|
|
23
23
|
# @param sha [String] The SHA1 for the commit
|
24
24
|
# @param state [String] The state: pending, success, failure, error
|
25
25
|
# @return [Sawyer::Resource] A status
|
26
|
-
# @see http://developer.github.com/v3/repos/statuses
|
26
|
+
# @see http://developer.github.com/v3/repos/statuses/#create-a-status
|
27
27
|
def create_status(repo, sha, state, options = {})
|
28
28
|
options.merge!(:state => state)
|
29
29
|
post "repos/#{Repository.new(repo)}/statuses/#{sha}", options
|
data/lib/octokit/client/users.rb
CHANGED
@@ -27,6 +27,7 @@ module Octokit
|
|
27
27
|
# @param user [String] A GitHub user name.
|
28
28
|
# @return [Sawyer::Resource]
|
29
29
|
# @see http://developer.github.com/v3/users/#get-a-single-user
|
30
|
+
# @see http://developer.github.com/v3/users/#get-the-authenticated-user
|
30
31
|
# @example
|
31
32
|
# Octokit.user("sferik")
|
32
33
|
def user(user=nil, options = {})
|
@@ -82,8 +83,9 @@ module Octokit
|
|
82
83
|
# @option options [Boolean] :hireable
|
83
84
|
# @option options [String] :bio
|
84
85
|
# @return [Sawyer::Resource]
|
86
|
+
# @see http://developer.github.com/v3/users/#update-the-authenticated-user
|
85
87
|
# @example
|
86
|
-
# Octokit.
|
88
|
+
# Octokit.update_user(:name => "Erik Michaels-Ober", :email => "sferik@gmail.com", :company => "Code for America", :location => "San Francisco", :hireable => false)
|
87
89
|
def update_user(options)
|
88
90
|
patch "user", options
|
89
91
|
end
|
@@ -122,6 +124,7 @@ module Octokit
|
|
122
124
|
# @param target [String] Username of the target user
|
123
125
|
# @return [Boolean] True following target user, false otherwise.
|
124
126
|
# @see http://developer.github.com/v3/users/followers/#check-if-you-are-following-a-user
|
127
|
+
# @see http://developer.github.com/v3/users/followers/#check-if-one-user-follows-another
|
125
128
|
# @example
|
126
129
|
# @client.follows?('pengwynn')
|
127
130
|
# @example
|
@@ -170,7 +173,7 @@ module Octokit
|
|
170
173
|
# @option options [String] :sort (created) Sort: <tt>created</tt> or <tt>updated</tt>.
|
171
174
|
# @option options [String] :direction (desc) Direction: <tt>asc</tt> or <tt>desc</tt>.
|
172
175
|
# @return [Array<Sawyer::Resource>] Array of hashes representing repositories starred by user.
|
173
|
-
# @see http://developer.github.com/v3/
|
176
|
+
# @see http://developer.github.com/v3/activity/starring/#list-repositories-being-starred
|
174
177
|
# @example
|
175
178
|
# Octokit.starred('pengwynn')
|
176
179
|
def starred(user=login, options = {})
|
@@ -184,7 +187,7 @@ module Octokit
|
|
184
187
|
#
|
185
188
|
# @param args [String, Hash, Repository] A GitHub repository
|
186
189
|
# @return [Boolean] True if you are following the repo, false otherwise.
|
187
|
-
# @see http://developer.github.com/v3/
|
190
|
+
# @see http://developer.github.com/v3/activity/starring/#check-if-you-are-starring-a-repository
|
188
191
|
# @example
|
189
192
|
# @client.starred?('pengwynn/octokit')
|
190
193
|
# @client.starred?('pengwynn', 'octokit') # deprecated
|
data/lib/octokit/default.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'octokit/response/raise_error'
|
2
|
+
require 'octokit/response/feed_parser'
|
2
3
|
require 'octokit/version'
|
3
4
|
|
4
5
|
module Octokit
|
@@ -21,6 +22,7 @@ module Octokit
|
|
21
22
|
# Default Faraday middleware stack
|
22
23
|
MIDDLEWARE = Faraday::Builder.new do |builder|
|
23
24
|
builder.use Octokit::Response::RaiseError
|
25
|
+
builder.use Octokit::Response::FeedParser
|
24
26
|
builder.adapter Faraday.default_adapter
|
25
27
|
end
|
26
28
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
|
3
|
+
module Octokit
|
4
|
+
|
5
|
+
module Response
|
6
|
+
|
7
|
+
# Parses RSS and Atom feed responses.
|
8
|
+
class FeedParser < Faraday::Response::Middleware
|
9
|
+
|
10
|
+
dependency do
|
11
|
+
require 'rss'
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def on_complete(env)
|
17
|
+
if env[:response_headers]["content-type"] =~ /(\batom|\brss)/
|
18
|
+
env[:body] = RSS::Parser.parse env[:body]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/octokit/version.rb
CHANGED
data/octokit.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'octokit/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.add_development_dependency 'bundler', '~> 1.0'
|
8
|
-
spec.add_dependency 'sawyer', '~> 0.5.
|
8
|
+
spec.add_dependency 'sawyer', '~> 0.5.2'
|
9
9
|
spec.authors = ["Wynn Netherland", "Erik Michaels-Ober", "Clint Shryock"]
|
10
10
|
spec.description = %q{Simple wrapper for the GitHub API}
|
11
11
|
spec.email = ['wynn.netherland@gmail.com', 'sferik@gmail.com', 'clint@ctshryock.com']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octokit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wynn Netherland
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-12-
|
13
|
+
date: 2013-12-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -32,14 +32,14 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - ~>
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.5.
|
35
|
+
version: 0.5.2
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - ~>
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.5.
|
42
|
+
version: 0.5.2
|
43
43
|
description: Simple wrapper for the GitHub API
|
44
44
|
email:
|
45
45
|
- wynn.netherland@gmail.com
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- lib/octokit/client/downloads.rb
|
66
66
|
- lib/octokit/client/emojis.rb
|
67
67
|
- lib/octokit/client/events.rb
|
68
|
+
- lib/octokit/client/feeds.rb
|
68
69
|
- lib/octokit/client/gists.rb
|
69
70
|
- lib/octokit/client/gitignore.rb
|
70
71
|
- lib/octokit/client/hooks.rb
|
@@ -97,6 +98,7 @@ files:
|
|
97
98
|
- lib/octokit/rate_limit.rb
|
98
99
|
- lib/octokit/repo_arguments.rb
|
99
100
|
- lib/octokit/repository.rb
|
101
|
+
- lib/octokit/response/feed_parser.rb
|
100
102
|
- lib/octokit/response/raise_error.rb
|
101
103
|
- lib/octokit/version.rb
|
102
104
|
- lib/octokit.rb
|