octokit 4.21.0 → 4.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +90 -63
- data/Rakefile +5 -3
- data/lib/ext/sawyer/relation.rb +4 -2
- data/lib/octokit/arguments.rb +2 -2
- data/lib/octokit/authentication.rb +10 -3
- data/lib/octokit/client/actions_secrets.rb +2 -3
- data/lib/octokit/client/actions_workflow_runs.rb +2 -0
- data/lib/octokit/client/actions_workflows.rb +2 -1
- data/lib/octokit/client/apps.rb +26 -26
- data/lib/octokit/client/authorizations.rb +20 -17
- data/lib/octokit/client/checks.rb +18 -9
- data/lib/octokit/client/commit_branches.rb +2 -2
- data/lib/octokit/client/commit_comments.rb +8 -8
- data/lib/octokit/client/commit_pulls.rb +2 -2
- data/lib/octokit/client/commits.rb +31 -34
- data/lib/octokit/client/community_profile.rb +2 -2
- data/lib/octokit/client/contents.rb +20 -21
- data/lib/octokit/client/deployments.rb +6 -6
- data/lib/octokit/client/downloads.rb +5 -6
- data/lib/octokit/client/emojis.rb +3 -3
- data/lib/octokit/client/events.rb +4 -4
- data/lib/octokit/client/feeds.rb +4 -5
- data/lib/octokit/client/gists.rb +6 -6
- data/lib/octokit/client/gitignore.rb +3 -3
- data/lib/octokit/client/hooks.rb +10 -10
- data/lib/octokit/client/issues.rb +14 -14
- data/lib/octokit/client/labels.rb +10 -10
- data/lib/octokit/client/legacy_search.rb +3 -3
- data/lib/octokit/client/licenses.rb +3 -3
- data/lib/octokit/client/markdown.rb +3 -3
- data/lib/octokit/client/marketplace.rb +4 -4
- data/lib/octokit/client/meta.rb +4 -5
- data/lib/octokit/client/milestones.rb +5 -5
- data/lib/octokit/client/notifications.rb +6 -6
- data/lib/octokit/client/oauth_applications.rb +0 -2
- data/lib/octokit/client/objects.rb +14 -14
- data/lib/octokit/client/organizations.rb +48 -48
- data/lib/octokit/client/pages.rb +3 -3
- data/lib/octokit/client/projects.rb +18 -19
- data/lib/octokit/client/pub_sub_hubbub.rb +16 -16
- data/lib/octokit/client/pull_requests.rb +41 -42
- data/lib/octokit/client/rate_limit.rb +9 -11
- data/lib/octokit/client/reactions.rb +6 -6
- data/lib/octokit/client/refs.rb +14 -15
- data/lib/octokit/client/releases.rb +13 -13
- data/lib/octokit/client/repositories.rb +36 -36
- data/lib/octokit/client/repository_invitations.rb +3 -3
- data/lib/octokit/client/reviews.rb +7 -7
- data/lib/octokit/client/say.rb +4 -5
- data/lib/octokit/client/search.rb +9 -9
- data/lib/octokit/client/service_status.rb +19 -9
- data/lib/octokit/client/source_import.rb +6 -6
- data/lib/octokit/client/stats.rb +10 -9
- data/lib/octokit/client/statuses.rb +5 -5
- data/lib/octokit/client/traffic.rb +2 -3
- data/lib/octokit/client/users.rb +27 -26
- data/lib/octokit/client.rb +28 -14
- data/lib/octokit/configurable.rb +33 -27
- data/lib/octokit/connection.rb +22 -23
- data/lib/octokit/default.rb +30 -18
- data/lib/octokit/enterprise_admin_client/admin_stats.rb +13 -14
- data/lib/octokit/enterprise_admin_client/license.rb +3 -4
- data/lib/octokit/enterprise_admin_client/orgs.rb +3 -4
- data/lib/octokit/enterprise_admin_client/search_indexing.rb +7 -8
- data/lib/octokit/enterprise_admin_client/users.rb +5 -4
- data/lib/octokit/enterprise_admin_client.rb +9 -3
- data/lib/octokit/enterprise_management_console_client/management_console.rb +32 -32
- data/lib/octokit/enterprise_management_console_client.rb +8 -2
- data/lib/octokit/error.rb +27 -23
- data/lib/octokit/gist.rb +2 -3
- data/lib/octokit/middleware/follow_redirects.rb +15 -11
- data/lib/octokit/organization.rb +3 -1
- data/lib/octokit/preview.rb +29 -29
- data/lib/octokit/rate_limit.rb +3 -3
- data/lib/octokit/repo_arguments.rb +2 -3
- data/lib/octokit/repository.rb +23 -24
- data/lib/octokit/response/base_middleware.rb +10 -0
- data/lib/octokit/response/feed_parser.rb +5 -7
- data/lib/octokit/response/raise_error.rb +4 -4
- data/lib/octokit/user.rb +4 -2
- data/lib/octokit/version.rb +3 -1
- data/lib/octokit/warnable.rb +4 -5
- data/lib/octokit.rb +15 -8
- data/octokit.gemspec +11 -9
- metadata +19 -17
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Repositories API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/repos/
|
7
8
|
module Repositories
|
8
|
-
|
9
9
|
# Check if a repository exists
|
10
10
|
#
|
11
11
|
# @see https://developer.github.com/v3/repos/#get
|
@@ -28,7 +28,7 @@ module Octokit
|
|
28
28
|
def repository(repo, options = {})
|
29
29
|
get Repository.path(repo), options
|
30
30
|
end
|
31
|
-
alias
|
31
|
+
alias repo repository
|
32
32
|
|
33
33
|
# Edit a repository
|
34
34
|
#
|
@@ -53,9 +53,9 @@ module Octokit
|
|
53
53
|
options[:name] ||= repo.name
|
54
54
|
patch "repos/#{repo}", options
|
55
55
|
end
|
56
|
-
alias
|
57
|
-
alias
|
58
|
-
alias
|
56
|
+
alias edit edit_repository
|
57
|
+
alias update_repository edit_repository
|
58
|
+
alias update edit_repository
|
59
59
|
|
60
60
|
# List user repositories
|
61
61
|
#
|
@@ -71,12 +71,12 @@ module Octokit
|
|
71
71
|
# @param user [Integer, String] Optional GitHub user login or id for which
|
72
72
|
# to list repos.
|
73
73
|
# @return [Array<Sawyer::Resource>] List of repositories
|
74
|
-
def repositories(user=nil, options = {})
|
74
|
+
def repositories(user = nil, options = {})
|
75
75
|
paginate "#{User.path user}/repos", options
|
76
76
|
end
|
77
|
-
alias
|
78
|
-
alias
|
79
|
-
alias
|
77
|
+
alias list_repositories repositories
|
78
|
+
alias list_repos repositories
|
79
|
+
alias repos repositories
|
80
80
|
|
81
81
|
# List all repositories
|
82
82
|
#
|
@@ -159,7 +159,7 @@ module Octokit
|
|
159
159
|
def create_repository(name, options = {})
|
160
160
|
opts = options.dup
|
161
161
|
organization = opts.delete :organization
|
162
|
-
opts.merge! :
|
162
|
+
opts.merge! name: name
|
163
163
|
if opts.include? :is_template
|
164
164
|
opts = ensure_api_media_type(:template_repositories, opts)
|
165
165
|
end
|
@@ -170,8 +170,8 @@ module Octokit
|
|
170
170
|
post "#{Organization.path organization}/repos", opts
|
171
171
|
end
|
172
172
|
end
|
173
|
-
alias
|
174
|
-
alias
|
173
|
+
alias create_repo create_repository
|
174
|
+
alias create create_repository
|
175
175
|
|
176
176
|
# Delete repository
|
177
177
|
#
|
@@ -183,7 +183,7 @@ module Octokit
|
|
183
183
|
def delete_repository(repo, options = {})
|
184
184
|
boolean_from_response :delete, Repository.path(repo), options
|
185
185
|
end
|
186
|
-
alias
|
186
|
+
alias delete_repo delete_repository
|
187
187
|
|
188
188
|
# Transfer repository
|
189
189
|
#
|
@@ -198,7 +198,7 @@ module Octokit
|
|
198
198
|
options = ensure_api_media_type(:transfer_repository, options)
|
199
199
|
post "#{Repository.path repo}/transfer", options.merge({ new_owner: new_owner })
|
200
200
|
end
|
201
|
-
alias
|
201
|
+
alias transfer_repo transfer_repository
|
202
202
|
|
203
203
|
# Create a repository for a user or organization generated from a template repository
|
204
204
|
#
|
@@ -210,11 +210,11 @@ module Octokit
|
|
210
210
|
# @option options [Boolean] :include_all_branches `true` copies all branches from the template repository, `false` (default) makes it only copy the master branch.
|
211
211
|
# @return [Sawyer::Resource] Repository info for the new repository
|
212
212
|
def create_repository_from_template(repo, name, options = {})
|
213
|
-
options.merge! :
|
213
|
+
options.merge! name: name
|
214
214
|
options = ensure_api_media_type(:template_repositories, options)
|
215
215
|
post "#{Repository.path repo}/generate", options
|
216
216
|
end
|
217
|
-
alias
|
217
|
+
alias create_repo_from_template create_repository_from_template
|
218
218
|
|
219
219
|
# Hide a public repository
|
220
220
|
#
|
@@ -222,7 +222,7 @@ module Octokit
|
|
222
222
|
# @return [Sawyer::Resource] Updated repository info
|
223
223
|
def set_private(repo, options = {})
|
224
224
|
# GitHub Api for setting private updated to use private attr, rather than public
|
225
|
-
update_repository repo, options.merge({ :
|
225
|
+
update_repository repo, options.merge({ private: true })
|
226
226
|
end
|
227
227
|
|
228
228
|
# Unhide a private repository
|
@@ -231,7 +231,7 @@ module Octokit
|
|
231
231
|
# @return [Sawyer::Resource] Updated repository info
|
232
232
|
def set_public(repo, options = {})
|
233
233
|
# GitHub Api for setting private updated to use private attr, rather than public
|
234
|
-
update_repository repo, options.merge({ :
|
234
|
+
update_repository repo, options.merge({ private: false })
|
235
235
|
end
|
236
236
|
|
237
237
|
# Get deploy keys on a repo
|
@@ -248,7 +248,7 @@ module Octokit
|
|
248
248
|
def deploy_keys(repo, options = {})
|
249
249
|
paginate "#{Repository.path repo}/keys", options
|
250
250
|
end
|
251
|
-
alias
|
251
|
+
alias list_deploy_keys deploy_keys
|
252
252
|
|
253
253
|
# Get a single deploy key for a repo
|
254
254
|
#
|
@@ -258,7 +258,7 @@ module Octokit
|
|
258
258
|
# @see https://developer.github.com/v3/repos/keys/#get-a-deploy-key
|
259
259
|
# @example
|
260
260
|
# @client.deploy_key('octokit/octokit.rb', 8675309)
|
261
|
-
def deploy_key(repo, id, options={})
|
261
|
+
def deploy_key(repo, id, options = {})
|
262
262
|
get "#{Repository.path repo}/keys/#{id}", options
|
263
263
|
end
|
264
264
|
|
@@ -274,7 +274,7 @@ module Octokit
|
|
274
274
|
# @example
|
275
275
|
# @client.add_deploy_key('octokit/octokit.rb', 'Staging server', 'ssh-rsa AAA...')
|
276
276
|
def add_deploy_key(repo, title, key, options = {})
|
277
|
-
post "#{Repository.path repo}/keys", options.merge(:
|
277
|
+
post "#{Repository.path repo}/keys", options.merge(title: title, key: key)
|
278
278
|
end
|
279
279
|
|
280
280
|
# Edit a deploy key
|
@@ -295,7 +295,7 @@ module Octokit
|
|
295
295
|
def edit_deploy_key(repo, id, options)
|
296
296
|
patch "#{Repository.path repo}/keys/#{id}", options
|
297
297
|
end
|
298
|
-
alias
|
298
|
+
alias update_deploy_key edit_deploy_key
|
299
299
|
|
300
300
|
# Remove deploy key from a repo
|
301
301
|
#
|
@@ -330,7 +330,7 @@ module Octokit
|
|
330
330
|
def collaborators(repo, options = {})
|
331
331
|
paginate "#{Repository.path repo}/collaborators", options
|
332
332
|
end
|
333
|
-
alias
|
333
|
+
alias collabs collaborators
|
334
334
|
|
335
335
|
# Add collaborator to repo
|
336
336
|
#
|
@@ -355,7 +355,7 @@ module Octokit
|
|
355
355
|
def add_collaborator(repo, collaborator, options = {})
|
356
356
|
boolean_from_response :put, "#{Repository.path repo}/collaborators/#{collaborator}", options
|
357
357
|
end
|
358
|
-
alias
|
358
|
+
alias add_collab add_collaborator
|
359
359
|
|
360
360
|
# Remove collaborator from repo.
|
361
361
|
#
|
@@ -372,7 +372,7 @@ module Octokit
|
|
372
372
|
def remove_collaborator(repo, collaborator, options = {})
|
373
373
|
boolean_from_response :delete, "#{Repository.path repo}/collaborators/#{collaborator}", options
|
374
374
|
end
|
375
|
-
alias
|
375
|
+
alias remove_collab remove_collaborator
|
376
376
|
|
377
377
|
# Checks if a user is a collaborator for a repo.
|
378
378
|
#
|
@@ -384,7 +384,7 @@ module Octokit
|
|
384
384
|
# @see https://developer.github.com/v3/repos/collaborators/#check-if-a-user-is-a-collaborator
|
385
385
|
# @example
|
386
386
|
# @client.collaborator?('octokit/octokit.rb', 'holman')
|
387
|
-
def collaborator?(repo, collaborator, options={})
|
387
|
+
def collaborator?(repo, collaborator, options = {})
|
388
388
|
boolean_from_response :get, "#{Repository.path repo}/collaborators/#{collaborator}", options
|
389
389
|
end
|
390
390
|
|
@@ -396,7 +396,7 @@ module Octokit
|
|
396
396
|
# @see https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level
|
397
397
|
# @example
|
398
398
|
# @client.permission_level('octokit/octokit.rb', 'lizzhale')
|
399
|
-
def permission_level(repo, collaborator, options={})
|
399
|
+
def permission_level(repo, collaborator, options = {})
|
400
400
|
get "#{Repository.path repo}/collaborators/#{collaborator}/permission", options
|
401
401
|
end
|
402
402
|
|
@@ -416,8 +416,8 @@ module Octokit
|
|
416
416
|
def repository_teams(repo, options = {})
|
417
417
|
paginate "#{Repository.path repo}/teams", options
|
418
418
|
end
|
419
|
-
alias
|
420
|
-
alias
|
419
|
+
alias repo_teams repository_teams
|
420
|
+
alias teams repository_teams
|
421
421
|
|
422
422
|
# List all topics for a repository
|
423
423
|
#
|
@@ -449,7 +449,7 @@ module Octokit
|
|
449
449
|
# client.replace_all_topics('octokit/octokit.rb', [])
|
450
450
|
def replace_all_topics(repo, names, options = {})
|
451
451
|
opts = ensure_api_media_type(:topics, options)
|
452
|
-
put "#{Repository.path repo}/topics", opts.merge(:
|
452
|
+
put "#{Repository.path repo}/topics", opts.merge(names: names)
|
453
453
|
end
|
454
454
|
|
455
455
|
# List contributors to a repo
|
@@ -470,7 +470,7 @@ module Octokit
|
|
470
470
|
options[:anon] = 1 if anon.to_s[/1|true/]
|
471
471
|
paginate "#{Repository.path repo}/contributors", options
|
472
472
|
end
|
473
|
-
alias
|
473
|
+
alias contribs contributors
|
474
474
|
|
475
475
|
# List stargazers of a repo
|
476
476
|
#
|
@@ -520,7 +520,7 @@ module Octokit
|
|
520
520
|
def forks(repo, options = {})
|
521
521
|
paginate "#{Repository.path repo}/forks", options
|
522
522
|
end
|
523
|
-
alias
|
523
|
+
alias network forks
|
524
524
|
|
525
525
|
# List languages of code in the repo.
|
526
526
|
#
|
@@ -578,7 +578,7 @@ module Octokit
|
|
578
578
|
def branch(repo, branch, options = {})
|
579
579
|
get "#{Repository.path repo}/branches/#{branch}", options
|
580
580
|
end
|
581
|
-
alias
|
581
|
+
alias get_branch branch
|
582
582
|
|
583
583
|
# Lock a single branch from a repository
|
584
584
|
#
|
@@ -653,7 +653,7 @@ module Octokit
|
|
653
653
|
# @client.rename_branch('octokit/octokit.rb', 'master', 'main')
|
654
654
|
def rename_branch(repo, branch, new_name, options = {})
|
655
655
|
params = {
|
656
|
-
new_name: new_name
|
656
|
+
new_name: new_name
|
657
657
|
}
|
658
658
|
post "#{Repository.path repo}/branches/#{branch}/rename", params.merge(options)
|
659
659
|
end
|
@@ -674,7 +674,7 @@ module Octokit
|
|
674
674
|
def repository_assignees(repo, options = {})
|
675
675
|
paginate "#{Repository.path repo}/assignees", options
|
676
676
|
end
|
677
|
-
alias
|
677
|
+
alias repo_assignees repository_assignees
|
678
678
|
|
679
679
|
# Check to see if a particular user is an assignee for a repository.
|
680
680
|
#
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Repository Invitations API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/repos/invitations/
|
7
8
|
module RepositoryInvitations
|
8
|
-
|
9
9
|
# Invite a user to a repository
|
10
10
|
#
|
11
11
|
# Requires authenticated client
|
@@ -64,7 +64,7 @@ module Octokit
|
|
64
64
|
# @return [Array<Sawyer::Resource>] The users repository invitations
|
65
65
|
# @see https://developer.github.com/v3/repos/invitations/#list-a-users-repository-invitations
|
66
66
|
def user_repository_invitations(options = {})
|
67
|
-
paginate
|
67
|
+
paginate '/user/repository_invitations', options
|
68
68
|
end
|
69
69
|
alias user_repo_invitations user_repository_invitations
|
70
70
|
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Reviews API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/pulls/reviews/
|
7
8
|
module Reviews
|
8
|
-
|
9
9
|
# List reviews on a pull request
|
10
10
|
#
|
11
11
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -161,9 +161,9 @@ module Octokit
|
|
161
161
|
# TODO(5.0): remove deprecated behavior
|
162
162
|
if reviewers.is_a?(Array)
|
163
163
|
octokit_warn(
|
164
|
-
|
164
|
+
'Deprecated: Octokit::Client#request_pull_request_review '\
|
165
165
|
"no longer takes a separate :reviewers argument.\n" \
|
166
|
-
|
166
|
+
'Please update your call to pass :reviewers and :team_reviewers as part of the options hash.'
|
167
167
|
)
|
168
168
|
options = options.merge(reviewers: reviewers)
|
169
169
|
else
|
@@ -190,13 +190,13 @@ module Octokit
|
|
190
190
|
# @client.delete_pull_request_review_request('octokit/octokit.rb', 2, options)
|
191
191
|
#
|
192
192
|
# @return [Sawyer::Resource>] Hash representing the pull request
|
193
|
-
def delete_pull_request_review_request(repo, id, reviewers={}, options = {})
|
193
|
+
def delete_pull_request_review_request(repo, id, reviewers = {}, options = {})
|
194
194
|
# TODO(5.0): remove deprecated behavior
|
195
195
|
if !reviewers.empty? && !options.empty?
|
196
196
|
octokit_warn(
|
197
|
-
|
197
|
+
'Deprecated: Octokit::Client#delete_pull_request_review_request '\
|
198
198
|
"no longer takes a separate :reviewers argument.\n" \
|
199
|
-
|
199
|
+
'Please update your call to pass :reviewers and :team_reviewers as part of the options hash.'
|
200
200
|
)
|
201
201
|
end
|
202
202
|
# For backwards compatibility, this endpoint can be called with a separate reviewers hash.
|
data/lib/octokit/client/say.rb
CHANGED
@@ -1,19 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the unpublished Octocat API
|
5
6
|
module Say
|
6
|
-
|
7
7
|
# Return a nifty ASCII Octocat with GitHub wisdom
|
8
8
|
# or your own
|
9
9
|
#
|
10
10
|
# @return [String]
|
11
11
|
def say(text = nil, options = {})
|
12
12
|
options[:s] = text if text
|
13
|
-
get
|
13
|
+
get 'octocat', options
|
14
14
|
end
|
15
|
-
alias
|
16
|
-
|
15
|
+
alias octocat say
|
17
16
|
end
|
18
17
|
end
|
19
18
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Search API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/search/
|
7
8
|
module Search
|
8
|
-
|
9
9
|
# Search code
|
10
10
|
#
|
11
11
|
# @param query [String] Search term and qualifiers
|
@@ -17,7 +17,7 @@ module Octokit
|
|
17
17
|
# @return [Sawyer::Resource] Search results object
|
18
18
|
# @see https://developer.github.com/v3/search/#search-code
|
19
19
|
def search_code(query, options = {})
|
20
|
-
search
|
20
|
+
search 'search/code', query, options
|
21
21
|
end
|
22
22
|
|
23
23
|
# Search commits
|
@@ -32,7 +32,7 @@ module Octokit
|
|
32
32
|
# @see https://developer.github.com/v3/search/#search-commits
|
33
33
|
def search_commits(query, options = {})
|
34
34
|
options = ensure_api_media_type(:commit_search, options)
|
35
|
-
search
|
35
|
+
search 'search/commits', query, options
|
36
36
|
end
|
37
37
|
|
38
38
|
# Search issues
|
@@ -46,7 +46,7 @@ module Octokit
|
|
46
46
|
# @return [Sawyer::Resource] Search results object
|
47
47
|
# @see https://developer.github.com/v3/search/#search-issues-and-pull-requests
|
48
48
|
def search_issues(query, options = {})
|
49
|
-
search
|
49
|
+
search 'search/issues', query, options
|
50
50
|
end
|
51
51
|
|
52
52
|
# Search repositories
|
@@ -60,9 +60,9 @@ module Octokit
|
|
60
60
|
# @return [Sawyer::Resource] Search results object
|
61
61
|
# @see https://developer.github.com/v3/search/#search-repositories
|
62
62
|
def search_repositories(query, options = {})
|
63
|
-
search
|
63
|
+
search 'search/repositories', query, options
|
64
64
|
end
|
65
|
-
alias
|
65
|
+
alias search_repos search_repositories
|
66
66
|
|
67
67
|
# Search users
|
68
68
|
#
|
@@ -75,13 +75,13 @@ module Octokit
|
|
75
75
|
# @return [Sawyer::Resource] Search results object
|
76
76
|
# @see https://developer.github.com/v3/search/#search-users
|
77
77
|
def search_users(query, options = {})
|
78
|
-
search
|
78
|
+
search 'search/users', query, options
|
79
79
|
end
|
80
80
|
|
81
81
|
private
|
82
82
|
|
83
83
|
def search(path, query, options = {})
|
84
|
-
opts = options.merge(:
|
84
|
+
opts = options.merge(q: query)
|
85
85
|
paginate(path, opts) do |data, last_response|
|
86
86
|
data.items.concat last_response.data.items
|
87
87
|
end
|
@@ -1,37 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the GitHub Status API
|
5
6
|
#
|
6
7
|
# @see https://status.github.com/api
|
7
8
|
module ServiceStatus
|
8
|
-
|
9
9
|
# Root for status API
|
10
10
|
# @private
|
11
|
-
|
11
|
+
SUMMARY_ROOT = 'https://www.githubstatus.com/api/v2/summary.json'
|
12
|
+
STATUS_ROOT = 'https://www.githubstatus.com/api/v2/status.json'
|
13
|
+
COMPONENTS_ROOT = 'https://www.githubstatus.com/api/v2/components.json'
|
14
|
+
|
15
|
+
# Returns a summary with the current status and the last status messages.
|
16
|
+
#
|
17
|
+
# @return [<Sawyer::Resource>] GitHub status summary
|
18
|
+
# @see https://www.githubstatus.com/api#summory
|
19
|
+
def github_status_summary
|
20
|
+
get(SUMMARY_ROOT)
|
21
|
+
end
|
12
22
|
|
13
23
|
# Returns the current system status
|
14
24
|
#
|
15
25
|
# @return [Sawyer::Resource] GitHub status
|
16
|
-
# @see https://
|
26
|
+
# @see https://www.githubstatus.com/api#status
|
17
27
|
def github_status
|
18
|
-
get(STATUS_ROOT)
|
28
|
+
get(STATUS_ROOT)
|
19
29
|
end
|
20
30
|
|
21
31
|
# Returns the last human communication, status, and timestamp.
|
22
32
|
#
|
23
33
|
# @return [Sawyer::Resource] GitHub status last message
|
24
|
-
# @see https://
|
34
|
+
# @see https://www.githubstatus.com/api/#components
|
25
35
|
def github_status_last_message
|
26
|
-
get(
|
36
|
+
get(COMPONENTS_ROOT).components.first
|
27
37
|
end
|
28
38
|
|
29
39
|
# Returns the most recent human communications with status and timestamp.
|
30
40
|
#
|
31
41
|
# @return [Array<Sawyer::Resource>] GitHub status messages
|
32
|
-
# @see https://
|
42
|
+
# @see https://www.githubstatus.com/api#components
|
33
43
|
def github_status_messages
|
34
|
-
get(
|
44
|
+
get(COMPONENTS_ROOT).components
|
35
45
|
end
|
36
46
|
end
|
37
47
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Source Import API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/migration/source_imports
|
7
8
|
module SourceImport
|
8
|
-
|
9
9
|
# Start a source import to a GitHub repository using GitHub Importer.
|
10
10
|
#
|
11
11
|
# @overload start_source_import(repo, vcs, vcs_url, options = {})
|
@@ -39,10 +39,10 @@ module Octokit
|
|
39
39
|
vcs_url = arguments.pop
|
40
40
|
vcs = arguments.pop
|
41
41
|
if vcs
|
42
|
-
octokit_warn
|
43
|
-
arguments.options.merge!(:
|
42
|
+
octokit_warn 'Octokit#start_source_import vcs parameter is now an option, please update your call before the next major Octokit version update.'
|
43
|
+
arguments.options.merge!(vcs: vcs)
|
44
44
|
end
|
45
|
-
options = ensure_api_media_type(:source_imports, arguments.options.merge(:
|
45
|
+
options = ensure_api_media_type(:source_imports, arguments.options.merge(vcs_url: vcs_url))
|
46
46
|
put "#{Repository.path arguments.repo}/import", options
|
47
47
|
end
|
48
48
|
|
@@ -153,7 +153,7 @@ module Octokit
|
|
153
153
|
# @example
|
154
154
|
# @client.opt_in_source_import_lfs("octokit/octokit.rb", "opt_in")
|
155
155
|
def set_source_import_lfs_preference(repo, use_lfs, options = {})
|
156
|
-
options = ensure_api_media_type(:source_imports, options.merge(:
|
156
|
+
options = ensure_api_media_type(:source_imports, options.merge(use_lfs: use_lfs))
|
157
157
|
patch "#{Repository.path repo}/import/lfs", options
|
158
158
|
end
|
159
159
|
end
|
data/lib/octokit/client/stats.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Repository Statistics API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/repos/statistics/
|
7
8
|
module Stats
|
8
|
-
|
9
9
|
# Get contributors list with additions, deletions, and commit counts
|
10
10
|
#
|
11
11
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -16,9 +16,9 @@ module Octokit
|
|
16
16
|
# @example Get contributor stats for octokit
|
17
17
|
# @client.contributors_stats('octokit/octokit.rb')
|
18
18
|
def contributors_stats(repo, options = {})
|
19
|
-
get_stats(repo,
|
19
|
+
get_stats(repo, 'contributors', options)
|
20
20
|
end
|
21
|
-
alias
|
21
|
+
alias contributor_stats contributors_stats
|
22
22
|
|
23
23
|
# Get the last year of commit activity data
|
24
24
|
#
|
@@ -31,7 +31,7 @@ module Octokit
|
|
31
31
|
# @example Get commit activity for octokit
|
32
32
|
# @client.commit_activity_stats('octokit/octokit.rb')
|
33
33
|
def commit_activity_stats(repo, options = {})
|
34
|
-
get_stats(repo,
|
34
|
+
get_stats(repo, 'commit_activity', options)
|
35
35
|
end
|
36
36
|
|
37
37
|
# Get the number of additions and deletions per week
|
@@ -45,7 +45,7 @@ module Octokit
|
|
45
45
|
# @example Get code frequency stats for octokit
|
46
46
|
# @client.code_frequency_stats('octokit/octokit.rb')
|
47
47
|
def code_frequency_stats(repo, options = {})
|
48
|
-
get_stats(repo,
|
48
|
+
get_stats(repo, 'code_frequency', options)
|
49
49
|
end
|
50
50
|
|
51
51
|
# Get the weekly commit count for the repo owner and everyone else
|
@@ -61,7 +61,7 @@ module Octokit
|
|
61
61
|
# @example Get weekly commit counts for octokit
|
62
62
|
# @client.participation_stats("octokit/octokit.rb")
|
63
63
|
def participation_stats(repo, options = {})
|
64
|
-
get_stats(repo,
|
64
|
+
get_stats(repo, 'participation', options)
|
65
65
|
end
|
66
66
|
|
67
67
|
# Get the number of commits per hour in each day
|
@@ -75,9 +75,9 @@ module Octokit
|
|
75
75
|
# @example Get octokit punch card
|
76
76
|
# @octokit.punch_card_stats
|
77
77
|
def punch_card_stats(repo, options = {})
|
78
|
-
get_stats(repo,
|
78
|
+
get_stats(repo, 'punch_card', options)
|
79
79
|
end
|
80
|
-
alias
|
80
|
+
alias punch_card punch_card_stats
|
81
81
|
|
82
82
|
private
|
83
83
|
|
@@ -99,6 +99,7 @@ module Octokit
|
|
99
99
|
return [] if last_response.status == 204
|
100
100
|
return nil unless retry_timeout
|
101
101
|
return nil if Time.now >= timeout
|
102
|
+
|
102
103
|
sleep retry_wait if retry_wait
|
103
104
|
end
|
104
105
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Commit Statuses API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/repos/statuses/
|
7
8
|
module Statuses
|
8
|
-
|
9
9
|
# List all statuses for a given commit
|
10
10
|
#
|
11
11
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
@@ -15,7 +15,7 @@ module Octokit
|
|
15
15
|
def statuses(repo, sha, options = {})
|
16
16
|
paginate "#{Repository.path repo}/statuses/#{sha}", options
|
17
17
|
end
|
18
|
-
alias
|
18
|
+
alias list_statuses statuses
|
19
19
|
|
20
20
|
# Get the combined status for a ref
|
21
21
|
#
|
@@ -26,7 +26,7 @@ module Octokit
|
|
26
26
|
def combined_status(repo, ref, options = {})
|
27
27
|
get "#{Repository.path repo}/commits/#{ref}/status", options
|
28
28
|
end
|
29
|
-
alias
|
29
|
+
alias status combined_status
|
30
30
|
|
31
31
|
# Create status for a commit
|
32
32
|
#
|
@@ -39,7 +39,7 @@ module Octokit
|
|
39
39
|
# @return [Sawyer::Resource] A status
|
40
40
|
# @see https://developer.github.com/v3/repos/statuses/#create-a-status
|
41
41
|
def create_status(repo, sha, state, options = {})
|
42
|
-
options = options.merge(:
|
42
|
+
options = options.merge(state: state)
|
43
43
|
post "#{Repository.path repo}/statuses/#{sha}", options
|
44
44
|
end
|
45
45
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Traffic API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/repos/traffic/
|
7
8
|
module Traffic
|
8
|
-
|
9
9
|
# Get the top 10 referrers over the last 14 days
|
10
10
|
#
|
11
11
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
@@ -63,7 +63,6 @@ module Octokit
|
|
63
63
|
opts = ensure_api_media_type(:traffic, options)
|
64
64
|
get "#{Repository.path repo}/traffic/clones", opts
|
65
65
|
end
|
66
|
-
|
67
66
|
end
|
68
67
|
end
|
69
68
|
end
|