octokit 2.0.0.pre → 2.0.0.rc1
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/lib/octokit/client.rb +2 -2
- data/lib/octokit/client/authorizations.rb +6 -6
- data/lib/octokit/client/commit_comments.rb +6 -6
- data/lib/octokit/client/commits.rb +10 -10
- data/lib/octokit/client/downloads.rb +2 -2
- data/lib/octokit/client/emojis.rb +2 -2
- data/lib/octokit/client/events.rb +12 -12
- data/lib/octokit/client/gists.rb +16 -16
- data/lib/octokit/client/gitignore.rb +2 -2
- data/lib/octokit/client/issues.rb +14 -14
- data/lib/octokit/client/labels.rb +10 -10
- data/lib/octokit/client/legacy_search.rb +4 -4
- data/lib/octokit/client/markdown.rb +1 -1
- data/lib/octokit/client/meta.rb +1 -1
- data/lib/octokit/client/milestones.rb +5 -5
- data/lib/octokit/client/notifications.rb +9 -9
- data/lib/octokit/client/objects.rb +6 -6
- data/lib/octokit/client/organizations.rb +22 -22
- data/lib/octokit/client/pull_requests.rb +18 -18
- data/lib/octokit/client/rate_limit.rb +4 -4
- data/lib/octokit/client/refs.rb +5 -5
- data/lib/octokit/client/repositories.rb +40 -40
- data/lib/octokit/client/say.rb +2 -3
- data/lib/octokit/client/stats.rb +12 -12
- data/lib/octokit/client/statuses.rb +2 -2
- data/lib/octokit/client/users.rb +16 -16
- data/lib/octokit/default.rb +1 -0
- data/lib/octokit/gist.rb +1 -3
- data/lib/octokit/rate_limit.rb +12 -1
- data/lib/octokit/repository.rb +10 -11
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +1 -1
- data/spec/cassettes/rate_limit.json +1 -1
- data/spec/octokit/client/rate_limit_spec.rb +4 -0
- data/spec/octokit/rate_limit_spec.rb +6 -1
- metadata +2 -3
- data/CHANGELOG.md +0 -133
@@ -14,7 +14,7 @@ module Octokit
|
|
14
14
|
# Octokit.organization('github')
|
15
15
|
# @example
|
16
16
|
# Octokit.org('github')
|
17
|
-
def organization(org, options={})
|
17
|
+
def organization(org, options = {})
|
18
18
|
get "orgs/#{org}", options
|
19
19
|
end
|
20
20
|
alias :org :organization
|
@@ -42,7 +42,7 @@ module Octokit
|
|
42
42
|
# })
|
43
43
|
# @example
|
44
44
|
# @client.update_org('github', {:company => 'Unicorns, Inc.'})
|
45
|
-
def update_organization(org, values, options={})
|
45
|
+
def update_organization(org, values, options = {})
|
46
46
|
patch "orgs/#{org}", options.merge({:organization => values})
|
47
47
|
end
|
48
48
|
alias :update_org :update_organization
|
@@ -73,7 +73,7 @@ module Octokit
|
|
73
73
|
# Octokit.list_orgs('pengwynn')
|
74
74
|
# @example
|
75
75
|
# @client.organizations
|
76
|
-
def organizations(user=nil, options={})
|
76
|
+
def organizations(user=nil, options = {})
|
77
77
|
if user
|
78
78
|
get "users/#{user}/orgs", options
|
79
79
|
else
|
@@ -103,7 +103,7 @@ module Octokit
|
|
103
103
|
# Octokit.org_repos('github')
|
104
104
|
# @example
|
105
105
|
# @client.org_repos('github', {:type => 'private'})
|
106
|
-
def organization_repositories(org, options={})
|
106
|
+
def organization_repositories(org, options = {})
|
107
107
|
get "orgs/#{org}/repos", options
|
108
108
|
end
|
109
109
|
alias :org_repositories :organization_repositories
|
@@ -124,7 +124,7 @@ module Octokit
|
|
124
124
|
# @client.organization_members('github')
|
125
125
|
# @example
|
126
126
|
# Octokit.org_members('github')
|
127
|
-
def organization_members(org, options={})
|
127
|
+
def organization_members(org, options = {})
|
128
128
|
get "orgs/#{org}/members", options
|
129
129
|
end
|
130
130
|
alias :org_members :organization_members
|
@@ -145,7 +145,7 @@ module Octokit
|
|
145
145
|
# @example Check if a user is in your organization
|
146
146
|
# @client.organization_member?('your_organization', 'pengwynn')
|
147
147
|
# => false
|
148
|
-
def organization_member?(org, user, options={})
|
148
|
+
def organization_member?(org, user, options = {})
|
149
149
|
result = boolean_from_response(:get, "orgs/#{org}/members/#{user}", options)
|
150
150
|
if last_response.status == 302
|
151
151
|
boolean_from_response :get, last_response.headers['Location']
|
@@ -170,7 +170,7 @@ module Octokit
|
|
170
170
|
# @example Check if a user is a hubbernaut
|
171
171
|
# @client.organization_public_member?('github', 'pengwynn')
|
172
172
|
# => true
|
173
|
-
def organization_public_member?(org, user, options={})
|
173
|
+
def organization_public_member?(org, user, options = {})
|
174
174
|
boolean_from_response :get, "orgs/#{org}/public_members/#{user}", options
|
175
175
|
end
|
176
176
|
alias :org_public_member? :organization_public_member?
|
@@ -186,7 +186,7 @@ module Octokit
|
|
186
186
|
# @client.organization_teams('github')
|
187
187
|
# @example
|
188
188
|
# @client.org_teams('github')
|
189
|
-
def organization_teams(org, options={})
|
189
|
+
def organization_teams(org, options = {})
|
190
190
|
get "orgs/#{org}/teams", options
|
191
191
|
end
|
192
192
|
alias :org_teams :organization_teams
|
@@ -212,7 +212,7 @@ module Octokit
|
|
212
212
|
# :repo_names => ['dotcom', 'developer.github.com'],
|
213
213
|
# :permission => 'push'
|
214
214
|
# })
|
215
|
-
def create_team(org, options={})
|
215
|
+
def create_team(org, options = {})
|
216
216
|
post "orgs/#{org}/teams", options
|
217
217
|
end
|
218
218
|
|
@@ -225,7 +225,7 @@ module Octokit
|
|
225
225
|
# @see http://developer.github.com/v3/orgs/teams/#get-team
|
226
226
|
# @example
|
227
227
|
# @client.team(100000)
|
228
|
-
def team(team_id, options={})
|
228
|
+
def team(team_id, options = {})
|
229
229
|
get "teams/#{team_id}", options
|
230
230
|
end
|
231
231
|
|
@@ -247,7 +247,7 @@ module Octokit
|
|
247
247
|
# :name => 'Front-end Designers',
|
248
248
|
# :permission => 'push'
|
249
249
|
# })
|
250
|
-
def update_team(team_id, options={})
|
250
|
+
def update_team(team_id, options = {})
|
251
251
|
patch "teams/#{team_id}", options
|
252
252
|
end
|
253
253
|
|
@@ -260,7 +260,7 @@ module Octokit
|
|
260
260
|
# @see http://developer.github.com/v3/orgs/teams/#delete-team
|
261
261
|
# @example
|
262
262
|
# @client.delete_team(100000)
|
263
|
-
def delete_team(team_id, options={})
|
263
|
+
def delete_team(team_id, options = {})
|
264
264
|
boolean_from_response :delete, "teams/#{team_id}", options
|
265
265
|
end
|
266
266
|
|
@@ -273,7 +273,7 @@ module Octokit
|
|
273
273
|
# @see http://developer.github.com/v3/orgs/teams/#list-team-members
|
274
274
|
# @example
|
275
275
|
# @client.team_members(100000)
|
276
|
-
def team_members(team_id, options={})
|
276
|
+
def team_members(team_id, options = {})
|
277
277
|
get "teams/#{team_id}/members", options
|
278
278
|
end
|
279
279
|
|
@@ -288,7 +288,7 @@ module Octokit
|
|
288
288
|
# @see http://developer.github.com/v3/orgs/teams/#add-team-member
|
289
289
|
# @example
|
290
290
|
# @client.add_team_member(100000, 'pengwynn')
|
291
|
-
def add_team_member(team_id, user, options={})
|
291
|
+
def add_team_member(team_id, user, options = {})
|
292
292
|
# There's a bug in this API call. The docs say to leave the body blank,
|
293
293
|
# but it fails if the body is both blank and the content-length header
|
294
294
|
# is not 0.
|
@@ -306,7 +306,7 @@ module Octokit
|
|
306
306
|
# @see http://developer.github.com/v3/orgs/teams/#remove-team-member
|
307
307
|
# @example
|
308
308
|
# @client.remove_team_member(100000, 'pengwynn')
|
309
|
-
def remove_team_member(team_id, user, options={})
|
309
|
+
def remove_team_member(team_id, user, options = {})
|
310
310
|
boolean_from_response :delete, "teams/#{team_id}/members/#{user}", options
|
311
311
|
end
|
312
312
|
|
@@ -325,7 +325,7 @@ module Octokit
|
|
325
325
|
# @example Check if a user is in your team
|
326
326
|
# @client.team_member?('your_team', 'pengwynn')
|
327
327
|
# => false
|
328
|
-
def team_member?(team_id, user, options={})
|
328
|
+
def team_member?(team_id, user, options = {})
|
329
329
|
boolean_from_response :get, "teams/#{team_id}/members/#{user}", options
|
330
330
|
end
|
331
331
|
|
@@ -340,7 +340,7 @@ module Octokit
|
|
340
340
|
# @client.team_repositories(100000)
|
341
341
|
# @example
|
342
342
|
# @client.team_repos(100000)
|
343
|
-
def team_repositories(team_id, options={})
|
343
|
+
def team_repositories(team_id, options = {})
|
344
344
|
get "teams/#{team_id}/repos", options
|
345
345
|
end
|
346
346
|
alias :team_repos :team_repositories
|
@@ -360,7 +360,7 @@ module Octokit
|
|
360
360
|
# @client.add_team_repository(100000, 'github/developer.github.com')
|
361
361
|
# @example
|
362
362
|
# @client.add_team_repo(100000, 'github/developer.github.com')
|
363
|
-
def add_team_repository(team_id, repo, options={})
|
363
|
+
def add_team_repository(team_id, repo, options = {})
|
364
364
|
boolean_from_response :put, "teams/#{team_id}/repos/#{Repository.new(repo)}", options.merge(:name => Repository.new(repo))
|
365
365
|
end
|
366
366
|
alias :add_team_repo :add_team_repository
|
@@ -380,7 +380,7 @@ module Octokit
|
|
380
380
|
# @client.remove_team_repository(100000, 'github/developer.github.com')
|
381
381
|
# @example
|
382
382
|
# @client.remove_team_repo(100000, 'github/developer.github.com')
|
383
|
-
def remove_team_repository(team_id, repo, options={})
|
383
|
+
def remove_team_repository(team_id, repo, options = {})
|
384
384
|
boolean_from_response :delete, "teams/#{team_id}/repos/#{Repository.new(repo)}"
|
385
385
|
end
|
386
386
|
alias :remove_team_repo :remove_team_repository
|
@@ -397,7 +397,7 @@ module Octokit
|
|
397
397
|
# @client.remove_organization_member('github', 'pengwynn')
|
398
398
|
# @example
|
399
399
|
# @client.remove_org_member('github', 'pengwynn')
|
400
|
-
def remove_organization_member(org, user, options={})
|
400
|
+
def remove_organization_member(org, user, options = {})
|
401
401
|
# this is a synonym for: for team in org.teams: remove_team_member(team.id, user)
|
402
402
|
# provided in the GH API v3
|
403
403
|
boolean_from_response :delete, "orgs/#{org}/members/#{user}", options
|
@@ -414,7 +414,7 @@ module Octokit
|
|
414
414
|
# @see http://developer.github.com/v3/orgs/members/#publicize-a-users-membership
|
415
415
|
# @example
|
416
416
|
# @client.publicize_membership('github', 'pengwynn')
|
417
|
-
def publicize_membership(org, user, options={})
|
417
|
+
def publicize_membership(org, user, options = {})
|
418
418
|
boolean_from_response :put, "orgs/#{org}/public_members/#{user}", options
|
419
419
|
end
|
420
420
|
|
@@ -430,7 +430,7 @@ module Octokit
|
|
430
430
|
# @client.unpublicize_membership('github', 'pengwynn')
|
431
431
|
# @example
|
432
432
|
# @client.conceal_membership('github', 'pengwynn')
|
433
|
-
def unpublicize_membership(org, user, options={})
|
433
|
+
def unpublicize_membership(org, user, options = {})
|
434
434
|
boolean_from_response :delete, "orgs/#{org}/public_members/#{user}", options
|
435
435
|
end
|
436
436
|
alias :conceal_membership :unpublicize_membership
|
@@ -14,7 +14,7 @@ module Octokit
|
|
14
14
|
# @return [Array<Sawyer::Resource>] Array of pulls
|
15
15
|
# @example
|
16
16
|
# Octokit.pull_requests('rails/rails')
|
17
|
-
def pull_requests(repo, state = nil, options={})
|
17
|
+
def pull_requests(repo, state = nil, options = {})
|
18
18
|
options[:state] = state if state
|
19
19
|
get "repos/#{Repository.new(repo)}/pulls", options
|
20
20
|
end
|
@@ -26,7 +26,7 @@ module Octokit
|
|
26
26
|
# @param repo [String, Hash, Repository] A GitHub repository
|
27
27
|
# @param number [Integer] Number of the pull request to fetch
|
28
28
|
# @return [Sawyer::Resource] Pull request info
|
29
|
-
def pull_request(repo, number, options={})
|
29
|
+
def pull_request(repo, number, options = {})
|
30
30
|
get "repos/#{Repository.new(repo)}/pulls/#{number}", options
|
31
31
|
end
|
32
32
|
alias :pull :pull_request
|
@@ -43,7 +43,7 @@ module Octokit
|
|
43
43
|
# @param title [String] Title for the pull request
|
44
44
|
# @param body [String] The body for the pull request. Supports GFM.
|
45
45
|
# @return [Sawyer::Resource] The newly created pull request
|
46
|
-
def create_pull_request(repo, base, head, title, body, options={})
|
46
|
+
def create_pull_request(repo, base, head, title, body, options = {})
|
47
47
|
pull = {
|
48
48
|
:base => base,
|
49
49
|
:head => head,
|
@@ -64,7 +64,7 @@ module Octokit
|
|
64
64
|
# @param head [String] The branch (or git ref) where your changes are implemented.
|
65
65
|
# @param issue [Integer] Number of Issue on which to base this pull request
|
66
66
|
# @return [Sawyer::Resource] The newly created pull request
|
67
|
-
def create_pull_request_for_issue(repo, base, head, issue, options={})
|
67
|
+
def create_pull_request_for_issue(repo, base, head, issue, options = {})
|
68
68
|
pull = {
|
69
69
|
:base => base,
|
70
70
|
:head => head,
|
@@ -74,14 +74,14 @@ module Octokit
|
|
74
74
|
end
|
75
75
|
|
76
76
|
# Update a pull request
|
77
|
-
# @overload update_pull_request(repo, id, title=nil, body=nil, state=nil, options={})
|
77
|
+
# @overload update_pull_request(repo, id, title=nil, body=nil, state=nil, options = {})
|
78
78
|
# @deprecated
|
79
79
|
# @param repo [String, Hash, Repository] A GitHub repository.
|
80
80
|
# @param number [Integer] Number of pull request to update.
|
81
81
|
# @param title [String] Title for the pull request.
|
82
82
|
# @param body [String] Body content for pull request. Supports GFM.
|
83
83
|
# @param state [String] State of the pull request. `open` or `closed`.
|
84
|
-
# @overload update_pull_request(repo, id, options={})
|
84
|
+
# @overload update_pull_request(repo, id, options = {})
|
85
85
|
# @param repo [String, Hash, Repository] A GitHub repository.
|
86
86
|
# @param number [Integer] Number of pull request to update.
|
87
87
|
# @option options [String] :title Title for the pull request.
|
@@ -113,7 +113,7 @@ module Octokit
|
|
113
113
|
# @see http://developer.github.com/v3/pulls/#update-a-pull-request
|
114
114
|
# @example
|
115
115
|
# @client.close_pull_request('pengwynn/octokit', 67)
|
116
|
-
def close_pull_request(repo, number, options={})
|
116
|
+
def close_pull_request(repo, number, options = {})
|
117
117
|
options.merge! :state => 'closed'
|
118
118
|
update_pull_request(repo, number, options)
|
119
119
|
end
|
@@ -124,7 +124,7 @@ module Octokit
|
|
124
124
|
# @param repo [String, Hash, Repository] A GitHub repository
|
125
125
|
# @param number [Integer] Number of pull request
|
126
126
|
# @return [Array<Sawyer::Resource>] List of commits
|
127
|
-
def pull_request_commits(repo, number, options={})
|
127
|
+
def pull_request_commits(repo, number, options = {})
|
128
128
|
get "repos/#{Repository.new(repo)}/pulls/#{number}/commits", options
|
129
129
|
end
|
130
130
|
alias :pull_commits :pull_request_commits
|
@@ -154,7 +154,7 @@ module Octokit
|
|
154
154
|
# :direction => 'down',
|
155
155
|
# :since => '2010-05-04T23:45:02Z'
|
156
156
|
# })
|
157
|
-
def pull_requests_comments(repo, options={})
|
157
|
+
def pull_requests_comments(repo, options = {})
|
158
158
|
get("repos/#{Repository.new repo}/pulls/comments", options)
|
159
159
|
end
|
160
160
|
alias :pulls_comments :pull_requests_comments
|
@@ -166,7 +166,7 @@ module Octokit
|
|
166
166
|
# @param repo [String, Hash, Repository] A GitHub repository
|
167
167
|
# @param number [Integer] Number of pull request
|
168
168
|
# @return [Array<Sawyer::Resource>] List of comments
|
169
|
-
def pull_request_comments(repo, number, options={})
|
169
|
+
def pull_request_comments(repo, number, options = {})
|
170
170
|
# return the comments for a pull request
|
171
171
|
get "repos/#{Repository.new(repo)}/pulls/#{number}/comments", options
|
172
172
|
end
|
@@ -181,7 +181,7 @@ module Octokit
|
|
181
181
|
# @see http://developer.github.com/v3/pulls/comments/#get-a-single-comment
|
182
182
|
# @example
|
183
183
|
# @client.pull_request_comment("pengwynn/octkit", 1903950)
|
184
|
-
def pull_request_comment(repo, comment_id, options={})
|
184
|
+
def pull_request_comment(repo, comment_id, options = {})
|
185
185
|
get "repos/#{Repository.new repo}/pulls/comments/#{comment_id}", options
|
186
186
|
end
|
187
187
|
alias :pull_comment :pull_request_comment
|
@@ -200,7 +200,7 @@ module Octokit
|
|
200
200
|
# @example
|
201
201
|
# @client.create_pull_request_comment("pengwynn/octokit", 163, ":shipit:",
|
202
202
|
# "2d3201e4440903d8b04a5487842053ca4883e5f0", "lib/octokit/request.rb", 47)
|
203
|
-
def create_pull_request_comment(repo, pull_id, body, commit_id, path, position, options={})
|
203
|
+
def create_pull_request_comment(repo, pull_id, body, commit_id, path, position, options = {})
|
204
204
|
options.merge!({
|
205
205
|
:body => body,
|
206
206
|
:commit_id => commit_id,
|
@@ -222,7 +222,7 @@ module Octokit
|
|
222
222
|
# @see http://developer.github.com/v3/pulls/comments/#create-a-comment
|
223
223
|
# @example
|
224
224
|
# @client.create_pull_request_comment_reply("pengwynn/octokit", 1903950, "done.")
|
225
|
-
def create_pull_request_comment_reply(repo, pull_id, body, comment_id, options={})
|
225
|
+
def create_pull_request_comment_reply(repo, pull_id, body, comment_id, options = {})
|
226
226
|
options.merge!({
|
227
227
|
:body => body,
|
228
228
|
:in_reply_to => comment_id
|
@@ -241,7 +241,7 @@ module Octokit
|
|
241
241
|
# @see http://developer.github.com/v3/pulls/comments/#edit-a-comment
|
242
242
|
# @example
|
243
243
|
# @client.update_pull_request_comment("pengwynn/octokit", 1903950, ":shipit:")
|
244
|
-
def update_pull_request_comment(repo, comment_id, body, options={})
|
244
|
+
def update_pull_request_comment(repo, comment_id, body, options = {})
|
245
245
|
options.merge! :body => body
|
246
246
|
patch("repos/#{Repository.new repo}/pulls/comments/#{comment_id}", options)
|
247
247
|
end
|
@@ -255,7 +255,7 @@ module Octokit
|
|
255
255
|
# @return [Boolean] True if deleted, false otherwise
|
256
256
|
# @example
|
257
257
|
# @client.delete_pull_request_comment("pengwynn/octokit", 1902707)
|
258
|
-
def delete_pull_request_comment(repo, comment_id, options={})
|
258
|
+
def delete_pull_request_comment(repo, comment_id, options = {})
|
259
259
|
boolean_from_response(:delete, "repos/#{Repository.new repo}/pulls/comments/#{comment_id}", options)
|
260
260
|
end
|
261
261
|
alias :delete_pull_comment :delete_pull_request_comment
|
@@ -267,7 +267,7 @@ module Octokit
|
|
267
267
|
# @param repo [String, Hash, Repository] A GitHub repository
|
268
268
|
# @param number [Integer] Number of pull request
|
269
269
|
# @return [Array<Sawyer::Resource>] List of files
|
270
|
-
def pull_request_files(repo, number, options={})
|
270
|
+
def pull_request_files(repo, number, options = {})
|
271
271
|
get "repos/#{Repository.new(repo)}/pulls/#{number}/files", options
|
272
272
|
end
|
273
273
|
alias :pull_files :pull_request_files
|
@@ -279,7 +279,7 @@ module Octokit
|
|
279
279
|
# @param number [Integer] Number of pull request
|
280
280
|
# @param commit_message [String] Optional commit message for the merge commit
|
281
281
|
# @return [Array<Sawyer::Resource>] Merge commit info if successful
|
282
|
-
def merge_pull_request(repo, number, commit_message='', options={})
|
282
|
+
def merge_pull_request(repo, number, commit_message='', options = {})
|
283
283
|
put "repos/#{Repository.new(repo)}/pulls/#{number}/merge", options.merge({:commit_message => commit_message})
|
284
284
|
end
|
285
285
|
|
@@ -289,7 +289,7 @@ module Octokit
|
|
289
289
|
# @param repo [String, Hash, Repository] A GitHub repository
|
290
290
|
# @param number [Integer] Number of pull request
|
291
291
|
# @return [Boolean] True if the pull request has been merged
|
292
|
-
def pull_merged?(repo, number, options={})
|
292
|
+
def pull_merged?(repo, number, options = {})
|
293
293
|
boolean_from_response :get, "repos/#{Repository.new(repo)}/pulls/#{number}/merge", options
|
294
294
|
end
|
295
295
|
alias :pull_request_merged? :pull_merged?
|
@@ -11,7 +11,7 @@ module Octokit
|
|
11
11
|
#
|
12
12
|
# @see http://developer.github.com/v3/#rate-limiting
|
13
13
|
# @return [Octokit::RateLimit] Rate limit info
|
14
|
-
def rate_limit(options={})
|
14
|
+
def rate_limit(options = {})
|
15
15
|
return rate_limit! if last_response.nil?
|
16
16
|
|
17
17
|
Octokit::RateLimit.from_response(last_response)
|
@@ -22,7 +22,7 @@ module Octokit
|
|
22
22
|
#
|
23
23
|
# @see http://developer.github.com/v3/#rate-limiting
|
24
24
|
# @return [Fixnum] Number of requests remaining in this period
|
25
|
-
def rate_limit_remaining(options={})
|
25
|
+
def rate_limit_remaining(options = {})
|
26
26
|
puts "Deprecated: Please use .rate_limit.remaining"
|
27
27
|
rate_limit.remaining
|
28
28
|
end
|
@@ -32,7 +32,7 @@ module Octokit
|
|
32
32
|
#
|
33
33
|
# @see http://developer.github.com/v3/#rate-limiting
|
34
34
|
# @return [Octokit::RateLimit] Rate limit info
|
35
|
-
def rate_limit!(options={})
|
35
|
+
def rate_limit!(options = {})
|
36
36
|
get "rate_limit"
|
37
37
|
Octokit::RateLimit.from_response(last_response)
|
38
38
|
end
|
@@ -42,7 +42,7 @@ module Octokit
|
|
42
42
|
#
|
43
43
|
# @see http://developer.github.com/v3/#rate-limiting
|
44
44
|
# @return [Fixnum] Number of requests remaining in this period
|
45
|
-
def rate_limit_remaining!(options={})
|
45
|
+
def rate_limit_remaining!(options = {})
|
46
46
|
puts "Deprecated: Please use .rate_limit!.remaining"
|
47
47
|
rate_limit!.remaining
|
48
48
|
end
|
data/lib/octokit/client/refs.rb
CHANGED
@@ -14,7 +14,7 @@ module Octokit
|
|
14
14
|
# @see http://developer.github.com/v3/git/refs/
|
15
15
|
# @example Fetch all refs for sferik/rails_admin
|
16
16
|
# Octokit.refs("sferik/rails_admin")
|
17
|
-
def refs(repo, namespace = nil, options={})
|
17
|
+
def refs(repo, namespace = nil, options = {})
|
18
18
|
path = "repos/#{Repository.new(repo)}/git/refs"
|
19
19
|
path += "/#{namespace}" unless namespace.nil?
|
20
20
|
get path, options
|
@@ -31,7 +31,7 @@ module Octokit
|
|
31
31
|
# @see http://developer.github.com/v3/git/refs/
|
32
32
|
# @example Fetch tags/v0.0.3 for sferik/rails_admin
|
33
33
|
# Octokit.ref("sferik/rails_admin","tags/v0.0.3")
|
34
|
-
def ref(repo, ref, options={})
|
34
|
+
def ref(repo, ref, options = {})
|
35
35
|
get "repos/#{Repository.new(repo)}/git/refs/#{ref}", options
|
36
36
|
end
|
37
37
|
alias :reference :ref
|
@@ -45,7 +45,7 @@ module Octokit
|
|
45
45
|
# @see http://developer.github.com/v3/git/refs/
|
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
|
-
def create_ref(repo, ref, sha, options={})
|
48
|
+
def create_ref(repo, ref, sha, options = {})
|
49
49
|
parameters = {
|
50
50
|
:ref => "refs/#{ref}",
|
51
51
|
:sha => sha
|
@@ -64,7 +64,7 @@ module Octokit
|
|
64
64
|
# @see http://developer.github.com/v3/git/refs/
|
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
|
-
def update_ref(repo, ref, sha, force=true, options={})
|
67
|
+
def update_ref(repo, ref, sha, force = true, options = {})
|
68
68
|
parameters = {
|
69
69
|
:sha => sha,
|
70
70
|
:force => force
|
@@ -81,7 +81,7 @@ module Octokit
|
|
81
81
|
# @see http://developer.github.com/v3/git/refs/
|
82
82
|
# @example Delete tags/v0.0.3 for sferik/rails_admin
|
83
83
|
# Octokit.delete_ref("sferik/rails_admin","tags/v0.0.3")
|
84
|
-
def delete_ref(repo, ref, options={})
|
84
|
+
def delete_ref(repo, ref, options = {})
|
85
85
|
boolean_from_response :delete, "repos/#{Repository.new(repo)}/git/refs/#{ref}", options
|
86
86
|
end
|
87
87
|
alias :delete_reference :delete_ref
|
@@ -23,7 +23,7 @@ module Octokit
|
|
23
23
|
# @see http://developer.github.com/v3/repos/#get
|
24
24
|
# @param repo [String, Hash, Repository] A GitHub repository
|
25
25
|
# @return [Sawyer::Resource] Repository information
|
26
|
-
def repository(repo, options={})
|
26
|
+
def repository(repo, options = {})
|
27
27
|
get "repos/#{Repository.new repo}", options
|
28
28
|
end
|
29
29
|
alias :repo :repository
|
@@ -42,7 +42,7 @@ module Octokit
|
|
42
42
|
# @option options [String] :has_downloads `true` enables downloads for this repo, `false` disables downloads.
|
43
43
|
# @option options [String] :default_branch Update the default branch for this repository.
|
44
44
|
# @return [Sawyer::Resource] Repository information
|
45
|
-
def edit_repository(repo, options={})
|
45
|
+
def edit_repository(repo, options = {})
|
46
46
|
repo = Repository.new(repo)
|
47
47
|
options[:name] ||= repo.name
|
48
48
|
patch "repos/#{repo}", options
|
@@ -59,7 +59,7 @@ module Octokit
|
|
59
59
|
# @see http://developer.github.com/v3/repos/#list-your-repositories
|
60
60
|
# @param username [String] Optional username for which to list repos
|
61
61
|
# @return [Array<Sawyer::Resource>] List of repositories
|
62
|
-
def repositories(username=nil, options={})
|
62
|
+
def repositories(username=nil, options = {})
|
63
63
|
if username.nil?
|
64
64
|
paginate 'user/repos', options
|
65
65
|
else
|
@@ -81,7 +81,7 @@ module Octokit
|
|
81
81
|
# @option options [Integer] :since The integer ID of the last Repository
|
82
82
|
# that you’ve seen.
|
83
83
|
# @return [Array<Sawyer::Resource>] List of repositories.
|
84
|
-
def all_repositories(options={})
|
84
|
+
def all_repositories(options = {})
|
85
85
|
paginate 'repositories', options
|
86
86
|
end
|
87
87
|
|
@@ -90,7 +90,7 @@ module Octokit
|
|
90
90
|
# @param repo [String, Hash, Repository] A GitHub repository
|
91
91
|
# @return [Boolean] `true` if successfully starred
|
92
92
|
# @see http://developer.github.com/v3/activity/starring/#star-a-repository
|
93
|
-
def star(repo, options={})
|
93
|
+
def star(repo, options = {})
|
94
94
|
boolean_from_response :put, "user/starred/#{Repository.new repo}", options
|
95
95
|
end
|
96
96
|
|
@@ -99,7 +99,7 @@ module Octokit
|
|
99
99
|
# @param repo [String, Hash, Repository] A GitHub repository
|
100
100
|
# @return [Boolean] `true` if successfully unstarred
|
101
101
|
# @see http://developer.github.com/v3/activity/starring/#unstar-a-repository
|
102
|
-
def unstar(repo, options={})
|
102
|
+
def unstar(repo, options = {})
|
103
103
|
boolean_from_response :delete, "user/starred/#{Repository.new repo}", options
|
104
104
|
end
|
105
105
|
|
@@ -109,7 +109,7 @@ module Octokit
|
|
109
109
|
# @return [Boolean] `true` if successfully watched
|
110
110
|
# @deprecated Use #star instead
|
111
111
|
# @see http://developer.github.com/v3/activity/watching/#watch-a-repository-legacy
|
112
|
-
def watch(repo, options={})
|
112
|
+
def watch(repo, options = {})
|
113
113
|
boolean_from_response :put, "user/watched/#{Repository.new repo}", options
|
114
114
|
end
|
115
115
|
|
@@ -119,7 +119,7 @@ module Octokit
|
|
119
119
|
# @return [Boolean] `true` if successfully unwatched
|
120
120
|
# @deprecated Use #unstar instead
|
121
121
|
# @see http://developer.github.com/v3/activity/watching/#stop-watching-a-repository-legacy
|
122
|
-
def unwatch(repo, options={})
|
122
|
+
def unwatch(repo, options = {})
|
123
123
|
boolean_from_response :delete, "user/watched/#{Repository.new repo}", options
|
124
124
|
end
|
125
125
|
|
@@ -128,7 +128,7 @@ module Octokit
|
|
128
128
|
# @param repo [String, Hash, Repository] A GitHub repository
|
129
129
|
# @return [Sawyer::Resource] Repository info for the new fork
|
130
130
|
# @see http://developer.github.com/v3/repos/forks/#create-a-fork
|
131
|
-
def fork(repo, options={})
|
131
|
+
def fork(repo, options = {})
|
132
132
|
post "repos/#{Repository.new repo}/forks", options
|
133
133
|
end
|
134
134
|
|
@@ -147,7 +147,7 @@ module Octokit
|
|
147
147
|
# @option options [String] :gitignore_template Desired language or platform .gitignore template to apply. Ignored if auto_init parameter is not provided.
|
148
148
|
# @return [Sawyer::Resource] Repository info for the new repository
|
149
149
|
# @see http://developer.github.com/v3/repos/#create
|
150
|
-
def create_repository(name, options={})
|
150
|
+
def create_repository(name, options = {})
|
151
151
|
organization = options.delete :organization
|
152
152
|
options.merge! :name => name
|
153
153
|
|
@@ -167,7 +167,7 @@ module Octokit
|
|
167
167
|
# @see http://developer.github.com/v3/repos/#delete-a-repository
|
168
168
|
# @param repo [String, Hash, Repository] A GitHub repository
|
169
169
|
# @return [Boolean] `true` if repository was deleted
|
170
|
-
def delete_repository(repo, options={})
|
170
|
+
def delete_repository(repo, options = {})
|
171
171
|
boolean_from_response :delete, "repos/#{Repository.new repo}", options
|
172
172
|
end
|
173
173
|
alias :delete_repo :delete_repository
|
@@ -176,7 +176,7 @@ module Octokit
|
|
176
176
|
#
|
177
177
|
# @param repo [String, Hash, Repository] A GitHub repository
|
178
178
|
# @return [Sawyer::Resource] Updated repository info
|
179
|
-
def set_private(repo, options={})
|
179
|
+
def set_private(repo, options = {})
|
180
180
|
# GitHub Api for setting private updated to use private attr, rather than public
|
181
181
|
update_repository repo, options.merge({ :private => true })
|
182
182
|
end
|
@@ -185,7 +185,7 @@ module Octokit
|
|
185
185
|
#
|
186
186
|
# @param repo [String, Hash, Repository] A GitHub repository
|
187
187
|
# @return [Sawyer::Resource] Updated repository info
|
188
|
-
def set_public(repo, options={})
|
188
|
+
def set_public(repo, options = {})
|
189
189
|
# GitHub Api for setting private updated to use private attr, rather than public
|
190
190
|
update_repository repo, options.merge({ :private => false })
|
191
191
|
end
|
@@ -201,7 +201,7 @@ module Octokit
|
|
201
201
|
# @client.deploy_keys('pengwynn/octokit')
|
202
202
|
# @example
|
203
203
|
# @client.list_deploy_keys('pengwynn/octokit')
|
204
|
-
def deploy_keys(repo, options={})
|
204
|
+
def deploy_keys(repo, options = {})
|
205
205
|
paginate "repos/#{Repository.new repo}/keys", options
|
206
206
|
end
|
207
207
|
alias :list_deploy_keys :deploy_keys
|
@@ -217,7 +217,7 @@ module Octokit
|
|
217
217
|
# @see http://developer.github.com/v3/repos/keys/#create
|
218
218
|
# @example
|
219
219
|
# @client.add_deploy_key('pengwynn/octokit', 'Staging server', 'ssh-rsa AAA...')
|
220
|
-
def add_deploy_key(repo, title, key, options={})
|
220
|
+
def add_deploy_key(repo, title, key, options = {})
|
221
221
|
post "repos/#{Repository.new repo}/keys", options.merge(:title => title, :key => key)
|
222
222
|
end
|
223
223
|
|
@@ -231,7 +231,7 @@ module Octokit
|
|
231
231
|
# @see http://developer.github.com/v3/repos/keys/#delete
|
232
232
|
# @example
|
233
233
|
# @client.remove_deploy_key('pengwynn/octokit', 100000)
|
234
|
-
def remove_deploy_key(repo, id, options={})
|
234
|
+
def remove_deploy_key(repo, id, options = {})
|
235
235
|
boolean_from_response :delete, "repos/#{Repository.new repo}/keys/#{id}", options
|
236
236
|
end
|
237
237
|
|
@@ -248,7 +248,7 @@ module Octokit
|
|
248
248
|
# Octokit.collabs('pengwynn/octokit')
|
249
249
|
# @example
|
250
250
|
# @client.collabs('pengwynn/octokit')
|
251
|
-
def collaborators(repo, options={})
|
251
|
+
def collaborators(repo, options = {})
|
252
252
|
paginate "repos/#{Repository.new repo}/collaborators", options
|
253
253
|
end
|
254
254
|
alias :collabs :collaborators
|
@@ -265,7 +265,7 @@ module Octokit
|
|
265
265
|
# @client.add_collaborator('pengwynn/octokit', 'holman')
|
266
266
|
# @example
|
267
267
|
# @client.add_collab('pengwynn/octokit', 'holman')
|
268
|
-
def add_collaborator(repo, collaborator, options={})
|
268
|
+
def add_collaborator(repo, collaborator, options = {})
|
269
269
|
boolean_from_response :put, "repos/#{Repository.new repo}/collaborators/#{collaborator}", options
|
270
270
|
end
|
271
271
|
alias :add_collab :add_collaborator
|
@@ -282,7 +282,7 @@ module Octokit
|
|
282
282
|
# @client.remove_collaborator('pengwynn/octokit', 'holman')
|
283
283
|
# @example
|
284
284
|
# @client.remove_collab('pengwynn/octokit', 'holman')
|
285
|
-
def remove_collaborator(repo, collaborator, options={})
|
285
|
+
def remove_collaborator(repo, collaborator, options = {})
|
286
286
|
boolean_from_response :delete, "repos/#{Repository.new repo}/collaborators/#{collaborator}", options
|
287
287
|
end
|
288
288
|
alias :remove_collab :remove_collaborator
|
@@ -300,7 +300,7 @@ module Octokit
|
|
300
300
|
# @client.repo_teams('octokit/pengwynn')
|
301
301
|
# @example
|
302
302
|
# @client.teams('octokit/pengwynn')
|
303
|
-
def repository_teams(repo, options={})
|
303
|
+
def repository_teams(repo, options = {})
|
304
304
|
paginate "repos/#{Repository.new repo}/teams", options
|
305
305
|
end
|
306
306
|
alias :repo_teams :repository_teams
|
@@ -320,7 +320,7 @@ module Octokit
|
|
320
320
|
# Octokit.contribs('pengwynn/octokit')
|
321
321
|
# @example
|
322
322
|
# @client.contribs('pengwynn/octokit')
|
323
|
-
def contributors(repo, anon = nil, options={})
|
323
|
+
def contributors(repo, anon = nil, options = {})
|
324
324
|
options[:anon] = 1 if anon.to_s[/1|true/]
|
325
325
|
paginate "repos/#{Repository.new repo}/contributors", options
|
326
326
|
end
|
@@ -337,7 +337,7 @@ module Octokit
|
|
337
337
|
# Octokit.stargazers('pengwynn/octokit')
|
338
338
|
# @example
|
339
339
|
# @client.stargazers('pengwynn/octokit')
|
340
|
-
def stargazers(repo, options={})
|
340
|
+
def stargazers(repo, options = {})
|
341
341
|
paginate "repos/#{Repository.new repo}/stargazers", options
|
342
342
|
end
|
343
343
|
|
@@ -354,7 +354,7 @@ module Octokit
|
|
354
354
|
# Octokit.watchers('pengwynn/octokit')
|
355
355
|
# @example
|
356
356
|
# @client.watchers('pengwynn/octokit')
|
357
|
-
def watchers(repo, options={})
|
357
|
+
def watchers(repo, options = {})
|
358
358
|
paginate "repos/#{Repository.new repo}/watchers", options
|
359
359
|
end
|
360
360
|
|
@@ -371,7 +371,7 @@ module Octokit
|
|
371
371
|
# Octokit.network('pengwynn/octokit')
|
372
372
|
# @example
|
373
373
|
# @client.forks('pengwynn/octokit')
|
374
|
-
def forks(repo, options={})
|
374
|
+
def forks(repo, options = {})
|
375
375
|
paginate "repos/#{Repository.new repo}/forks", options
|
376
376
|
end
|
377
377
|
alias :network :forks
|
@@ -387,7 +387,7 @@ module Octokit
|
|
387
387
|
# Octokit.langauges('pengwynn/octokit')
|
388
388
|
# @example
|
389
389
|
# @client.languages('pengwynn/octokit')
|
390
|
-
def languages(repo, options={})
|
390
|
+
def languages(repo, options = {})
|
391
391
|
paginate "repos/#{Repository.new repo}/languages", options
|
392
392
|
end
|
393
393
|
|
@@ -402,7 +402,7 @@ module Octokit
|
|
402
402
|
# Octokit.tags('pengwynn/octokit')
|
403
403
|
# @example
|
404
404
|
# @client.tags('pengwynn/octokit')
|
405
|
-
def tags(repo, options={})
|
405
|
+
def tags(repo, options = {})
|
406
406
|
paginate "repos/#{Repository.new repo}/tags", options
|
407
407
|
end
|
408
408
|
|
@@ -417,7 +417,7 @@ module Octokit
|
|
417
417
|
# Octokit.branches('pengwynn/octokit')
|
418
418
|
# @example
|
419
419
|
# @client.branches('pengwynn/octokit')
|
420
|
-
def branches(repo, options={})
|
420
|
+
def branches(repo, options = {})
|
421
421
|
paginate "repos/#{Repository.new repo}/branches", options
|
422
422
|
end
|
423
423
|
|
@@ -429,7 +429,7 @@ module Octokit
|
|
429
429
|
# @see http://developer.github.com/v3/repos/#get-branch
|
430
430
|
# @example Get branch 'master` from pengwynn/octokit
|
431
431
|
# Octokit.branch("pengwynn/octokit", "master")
|
432
|
-
def branch(repo, branch, options={})
|
432
|
+
def branch(repo, branch, options = {})
|
433
433
|
get "repos/#{Repository.new repo}/branches/#{branch}", options
|
434
434
|
end
|
435
435
|
alias :get_branch :branch
|
@@ -443,7 +443,7 @@ module Octokit
|
|
443
443
|
# @see http://developer.github.com/v3/repos/hooks/#list
|
444
444
|
# @example
|
445
445
|
# @client.hooks('pengwynn/octokit')
|
446
|
-
def hooks(repo, options={})
|
446
|
+
def hooks(repo, options = {})
|
447
447
|
paginate "repos/#{Repository.new repo}/hooks", options
|
448
448
|
end
|
449
449
|
|
@@ -457,7 +457,7 @@ module Octokit
|
|
457
457
|
# @see http://developer.github.com/v3/repos/hooks/#get-single-hook
|
458
458
|
# @example
|
459
459
|
# @client.hook('pengwynn/octokit', 100000)
|
460
|
-
def hook(repo, id, options={})
|
460
|
+
def hook(repo, id, options = {})
|
461
461
|
get "repos/#{Repository.new repo}/hooks/#{id}", options
|
462
462
|
end
|
463
463
|
|
@@ -492,7 +492,7 @@ module Octokit
|
|
492
492
|
# :active => true
|
493
493
|
# }
|
494
494
|
# )
|
495
|
-
def create_hook(repo, name, config, options={})
|
495
|
+
def create_hook(repo, name, config, options = {})
|
496
496
|
options = {:name => name, :config => config, :events => ["push"], :active => true}.merge(options)
|
497
497
|
post "repos/#{Repository.new repo}/hooks", options
|
498
498
|
end
|
@@ -534,7 +534,7 @@ module Octokit
|
|
534
534
|
# :active => true
|
535
535
|
# }
|
536
536
|
# )
|
537
|
-
def edit_hook(repo, id, name, config, options={})
|
537
|
+
def edit_hook(repo, id, name, config, options = {})
|
538
538
|
options = {:name => name, :config => config, :events => ["push"], :active => true}.merge(options)
|
539
539
|
patch "repos/#{Repository.new repo}/hooks/#{id}", options
|
540
540
|
end
|
@@ -549,7 +549,7 @@ module Octokit
|
|
549
549
|
# @see http://developer.github.com/v3/repos/hooks/#delete-a-hook
|
550
550
|
# @example
|
551
551
|
# @client.remove_hook('pengwynn/octokit', 1000000)
|
552
|
-
def remove_hook(repo, id, options={})
|
552
|
+
def remove_hook(repo, id, options = {})
|
553
553
|
boolean_from_response :delete, "repos/#{Repository.new repo}/hooks/#{id}", options
|
554
554
|
end
|
555
555
|
|
@@ -563,7 +563,7 @@ module Octokit
|
|
563
563
|
# @see http://developer.github.com/v3/repos/hooks/#test-a-hook
|
564
564
|
# @example
|
565
565
|
# @client.test_hook('pengwynn/octokit', 1000000)
|
566
|
-
def test_hook(repo, id, options={})
|
566
|
+
def test_hook(repo, id, options = {})
|
567
567
|
boolean_from_response :post, "repos/#{Repository.new repo}/hooks/#{id}/tests", options
|
568
568
|
end
|
569
569
|
|
@@ -580,7 +580,7 @@ module Octokit
|
|
580
580
|
# Octokit.repo_assignees('pengwynn/octokit')
|
581
581
|
# @example
|
582
582
|
# @client.repository_assignees('pengwynn/octokit')
|
583
|
-
def repository_assignees(repo, options={})
|
583
|
+
def repository_assignees(repo, options = {})
|
584
584
|
paginate "repos/#{Repository.new repo}/assignees", options
|
585
585
|
end
|
586
586
|
alias :repo_assignees :repository_assignees
|
@@ -593,7 +593,7 @@ module Octokit
|
|
593
593
|
# @see http://developer.github.com/v3/issues/assignees/#check-assignee
|
594
594
|
# @example
|
595
595
|
# Octokit.check_assignee('pengwynn/octokit', 'andrew')
|
596
|
-
def check_assignee(repo, assignee, options={})
|
596
|
+
def check_assignee(repo, assignee, options = {})
|
597
597
|
boolean_from_response :get, "repos/#{Repository.new repo}/assignees/#{assignee}", options
|
598
598
|
end
|
599
599
|
|
@@ -604,7 +604,7 @@ module Octokit
|
|
604
604
|
# @see http://developer.github.com/v3/activity/watching/#list-watchers
|
605
605
|
# @example
|
606
606
|
# @client.subscribers("pengwynn/octokit")
|
607
|
-
def subscribers(repo, options={})
|
607
|
+
def subscribers(repo, options = {})
|
608
608
|
paginate "repos/#{Repository.new repo}/subscribers", options
|
609
609
|
end
|
610
610
|
|
@@ -615,7 +615,7 @@ module Octokit
|
|
615
615
|
# @see http://developer.github.com/v3/activity/watching/#get-a-repository-subscription
|
616
616
|
# @example
|
617
617
|
# @client.subscription("pengwynn/octokit")
|
618
|
-
def subscription(repo, options={})
|
618
|
+
def subscription(repo, options = {})
|
619
619
|
get "repos/#{Repository.new repo}/subscription", options
|
620
620
|
end
|
621
621
|
|
@@ -632,7 +632,7 @@ module Octokit
|
|
632
632
|
# @see http://developer.github.com/v3/activity/watching/#set-a-repository-subscription
|
633
633
|
# @example Subscribe to notifications for a repository
|
634
634
|
# @client.update_subscription("pengwynn/octokit", {subscribed: true})
|
635
|
-
def update_subscription(repo, options={})
|
635
|
+
def update_subscription(repo, options = {})
|
636
636
|
put "repos/#{Repository.new repo}/subscription", options
|
637
637
|
end
|
638
638
|
|
@@ -644,7 +644,7 @@ module Octokit
|
|
644
644
|
#
|
645
645
|
# @example
|
646
646
|
# @client.delete_subscription("pengwynn/octokit")
|
647
|
-
def delete_subscription(repo, options={})
|
647
|
+
def delete_subscription(repo, options = {})
|
648
648
|
boolean_from_response :delete, "repos/#{Repository.new repo}/subscription", options
|
649
649
|
end
|
650
650
|
|