octokit 4.24.0 → 5.0.0

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.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -2
  3. data/Rakefile +5 -3
  4. data/lib/ext/sawyer/relation.rb +4 -2
  5. data/lib/octokit/arguments.rb +2 -2
  6. data/lib/octokit/authentication.rb +4 -5
  7. data/lib/octokit/client/actions_secrets.rb +2 -3
  8. data/lib/octokit/client/actions_workflow_runs.rb +2 -0
  9. data/lib/octokit/client/actions_workflows.rb +2 -1
  10. data/lib/octokit/client/apps.rb +26 -26
  11. data/lib/octokit/client/authorizations.rb +20 -17
  12. data/lib/octokit/client/checks.rb +5 -5
  13. data/lib/octokit/client/commit_branches.rb +2 -2
  14. data/lib/octokit/client/commit_comments.rb +8 -8
  15. data/lib/octokit/client/commit_pulls.rb +2 -2
  16. data/lib/octokit/client/commits.rb +25 -33
  17. data/lib/octokit/client/community_profile.rb +2 -2
  18. data/lib/octokit/client/contents.rb +20 -21
  19. data/lib/octokit/client/deployments.rb +6 -6
  20. data/lib/octokit/client/downloads.rb +5 -6
  21. data/lib/octokit/client/emojis.rb +3 -3
  22. data/lib/octokit/client/events.rb +4 -4
  23. data/lib/octokit/client/feeds.rb +4 -5
  24. data/lib/octokit/client/gists.rb +6 -6
  25. data/lib/octokit/client/gitignore.rb +3 -3
  26. data/lib/octokit/client/hooks.rb +10 -10
  27. data/lib/octokit/client/issues.rb +14 -14
  28. data/lib/octokit/client/labels.rb +6 -6
  29. data/lib/octokit/client/legacy_search.rb +3 -3
  30. data/lib/octokit/client/licenses.rb +3 -3
  31. data/lib/octokit/client/markdown.rb +3 -3
  32. data/lib/octokit/client/marketplace.rb +4 -4
  33. data/lib/octokit/client/meta.rb +4 -5
  34. data/lib/octokit/client/milestones.rb +5 -5
  35. data/lib/octokit/client/notifications.rb +6 -6
  36. data/lib/octokit/client/oauth_applications.rb +0 -2
  37. data/lib/octokit/client/objects.rb +14 -14
  38. data/lib/octokit/client/organizations.rb +42 -42
  39. data/lib/octokit/client/pages.rb +3 -3
  40. data/lib/octokit/client/projects.rb +18 -19
  41. data/lib/octokit/client/pub_sub_hubbub.rb +15 -15
  42. data/lib/octokit/client/pull_requests.rb +41 -42
  43. data/lib/octokit/client/rate_limit.rb +9 -11
  44. data/lib/octokit/client/reactions.rb +6 -6
  45. data/lib/octokit/client/refs.rb +13 -14
  46. data/lib/octokit/client/releases.rb +13 -13
  47. data/lib/octokit/client/repositories.rb +36 -36
  48. data/lib/octokit/client/repository_invitations.rb +3 -3
  49. data/lib/octokit/client/reviews.rb +7 -7
  50. data/lib/octokit/client/say.rb +4 -5
  51. data/lib/octokit/client/search.rb +9 -9
  52. data/lib/octokit/client/service_status.rb +2 -2
  53. data/lib/octokit/client/source_import.rb +6 -6
  54. data/lib/octokit/client/stats.rb +10 -9
  55. data/lib/octokit/client/statuses.rb +5 -5
  56. data/lib/octokit/client/traffic.rb +2 -3
  57. data/lib/octokit/client/users.rb +27 -26
  58. data/lib/octokit/client.rb +25 -11
  59. data/lib/octokit/configurable.rb +33 -27
  60. data/lib/octokit/connection.rb +19 -20
  61. data/lib/octokit/default.rb +16 -15
  62. data/lib/octokit/enterprise_admin_client/admin_stats.rb +13 -14
  63. data/lib/octokit/enterprise_admin_client/license.rb +3 -4
  64. data/lib/octokit/enterprise_admin_client/orgs.rb +3 -4
  65. data/lib/octokit/enterprise_admin_client/search_indexing.rb +7 -8
  66. data/lib/octokit/enterprise_admin_client/users.rb +5 -4
  67. data/lib/octokit/enterprise_admin_client.rb +9 -3
  68. data/lib/octokit/enterprise_management_console_client/management_console.rb +30 -30
  69. data/lib/octokit/enterprise_management_console_client.rb +8 -2
  70. data/lib/octokit/error.rb +23 -21
  71. data/lib/octokit/gist.rb +2 -3
  72. data/lib/octokit/middleware/follow_redirects.rb +12 -11
  73. data/lib/octokit/organization.rb +3 -1
  74. data/lib/octokit/preview.rb +29 -29
  75. data/lib/octokit/rate_limit.rb +3 -3
  76. data/lib/octokit/repo_arguments.rb +2 -3
  77. data/lib/octokit/repository.rb +23 -24
  78. data/lib/octokit/response/base_middleware.rb +2 -0
  79. data/lib/octokit/response/feed_parser.rb +3 -5
  80. data/lib/octokit/response/raise_error.rb +2 -2
  81. data/lib/octokit/user.rb +4 -2
  82. data/lib/octokit/version.rb +4 -2
  83. data/lib/octokit/warnable.rb +3 -6
  84. data/lib/octokit.rb +14 -6
  85. data/octokit.gemspec +11 -9
  86. metadata +23 -22
@@ -1,11 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Octokit
2
4
  class Client
3
-
4
5
  # Methods for the Releases API
5
6
  #
6
7
  # @see https://developer.github.com/v3/repos/releases/
7
8
  module Releases
8
-
9
9
  # List releases for a repository
10
10
  #
11
11
  # @param repo [Integer, String, Repository, Hash] A GitHub repository
@@ -14,7 +14,7 @@ module Octokit
14
14
  def releases(repo, options = {})
15
15
  paginate "#{Repository.path repo}/releases", options
16
16
  end
17
- alias :list_releases :releases
17
+ alias list_releases releases
18
18
 
19
19
  # Create a release
20
20
  #
@@ -28,7 +28,7 @@ module Octokit
28
28
  # @return [Sawyer::Resource] The release
29
29
  # @see https://developer.github.com/v3/repos/releases/#create-a-release
30
30
  def create_release(repo, tag_name, options = {})
31
- opts = options.merge(:tag_name => tag_name)
31
+ opts = options.merge(tag_name: tag_name)
32
32
  post "#{Repository.path repo}/releases", opts
33
33
  end
34
34
 
@@ -55,7 +55,7 @@ module Octokit
55
55
  def update_release(url, options = {})
56
56
  patch url, options
57
57
  end
58
- alias :edit_release :update_release
58
+ alias edit_release update_release
59
59
 
60
60
  # Delete a release
61
61
  #
@@ -84,17 +84,18 @@ module Octokit
84
84
  # @return [Sawyer::Resource] The release asset
85
85
  # @see https://developer.github.com/v3/repos/releases/#upload-a-release-asset
86
86
  def upload_asset(release_url, path_or_file, options = {})
87
- file = path_or_file.respond_to?(:read) ? path_or_file : File.new(path_or_file, "rb")
87
+ file = path_or_file.respond_to?(:read) ? path_or_file : File.new(path_or_file, 'rb')
88
88
  options[:content_type] ||= content_type_from_file(file)
89
- raise Octokit::MissingContentType.new if options[:content_type].nil?
89
+ raise Octokit::MissingContentType if options[:content_type].nil?
90
+
90
91
  unless name = options[:name]
91
92
  name = File.basename(file.path)
92
93
  end
93
- upload_url = release(release_url).rels[:upload].href_template.expand(:name => name)
94
+ upload_url = release(release_url).rels[:upload].href_template.expand(name: name)
94
95
 
95
96
  request :post, upload_url, file.read, parse_query_and_convenience_headers(options)
96
97
  ensure
97
- file.close if file
98
+ file&.close
98
99
  end
99
100
 
100
101
  # Get a single release asset
@@ -117,7 +118,7 @@ module Octokit
117
118
  def update_release_asset(asset_url, options = {})
118
119
  patch(asset_url, options)
119
120
  end
120
- alias :edit_release_asset :update_release_asset
121
+ alias edit_release_asset update_release_asset
121
122
 
122
123
  # Delete a release asset
123
124
  #
@@ -155,10 +156,9 @@ module Octokit
155
156
  mime_type.content_type
156
157
  end
157
158
  rescue LoadError
158
- msg = "Please pass content_type or install mime-types gem to guess content type from file"
159
- raise Octokit::MissingContentType.new(msg)
159
+ msg = 'Please pass content_type or install mime-types gem to guess content type from file'
160
+ raise Octokit::MissingContentType, msg
160
161
  end
161
-
162
162
  end
163
163
  end
164
164
  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 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 :repo :repository
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 :edit :edit_repository
57
- alias :update_repository :edit_repository
58
- alias :update :edit_repository
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 :list_repositories :repositories
78
- alias :list_repos :repositories
79
- alias :repos :repositories
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! :name => name
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 :create_repo :create_repository
174
- alias :create :create_repository
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 :delete_repo :delete_repository
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 :transfer_repo :transfer_repository
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! :name => name
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 :create_repo_from_template :create_repository_from_template
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({ :private => true })
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({ :private => false })
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 :list_deploy_keys :deploy_keys
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(:title => title, :key => key)
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 :update_deploy_key :edit_deploy_key
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 :collabs :collaborators
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 :add_collab :add_collaborator
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 :remove_collab :remove_collaborator
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 :repo_teams :repository_teams
420
- alias :teams :repository_teams
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(:names => names)
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 :contribs :contributors
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 :network :forks
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 :get_branch :branch
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 :repo_assignees :repository_assignees
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 "/user/repository_invitations", options
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
- "Deprecated: Octokit::Client#request_pull_request_review "\
164
+ 'Deprecated: Octokit::Client#request_pull_request_review '\
165
165
  "no longer takes a separate :reviewers argument.\n" \
166
- "Please update your call to pass :reviewers and :team_reviewers as part of the options hash."
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
- "Deprecated: Octokit::Client#delete_pull_request_review_request "\
197
+ 'Deprecated: Octokit::Client#delete_pull_request_review_request '\
198
198
  "no longer takes a separate :reviewers argument.\n" \
199
- "Please update your call to pass :reviewers and :team_reviewers as part of the options hash."
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.
@@ -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 "octocat", options
13
+ get 'octocat', options
14
14
  end
15
- alias :octocat :say
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 "search/code", query, options
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 "search/commits", query, options
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 "search/issues", query, options
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 "search/repositories", query, options
63
+ search 'search/repositories', query, options
64
64
  end
65
- alias :search_repos :search_repositories
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 "search/users", query, options
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(:q => query)
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,11 +1,11 @@
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'
@@ -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 "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)
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(:vcs_url => vcs_url))
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(:use_lfs => use_lfs))
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
@@ -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, "contributors", options)
19
+ get_stats(repo, 'contributors', options)
20
20
  end
21
- alias :contributor_stats :contributors_stats
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, "commit_activity", options)
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, "code_frequency", options)
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, "participation", options)
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, "punch_card", options)
78
+ get_stats(repo, 'punch_card', options)
79
79
  end
80
- alias :punch_card :punch_card_stats
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 :list_statuses :statuses
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 :status :combined_status
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(:state => state)
42
+ options = options.merge(state: state)
43
43
  post "#{Repository.path repo}/statuses/#{sha}", options
44
44
  end
45
45
  end