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,13 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'base64'
2
4
 
3
5
  module Octokit
4
6
  class Client
5
-
6
7
  # Methods for the Repo Contents API
7
8
  #
8
9
  # @see https://developer.github.com/v3/repos/contents/
9
10
  module Contents
10
-
11
11
  # Receive the default Readme for a repository
12
12
  #
13
13
  # @param repo [Integer, String, Repository, Hash] A GitHub repository
@@ -18,7 +18,7 @@ module Octokit
18
18
  # Octokit.readme("octokit/octokit.rb")
19
19
  # @example Get the readme file for a particular branch of the repo
20
20
  # Octokit.readme("octokit/octokit.rb", :query => {:ref => 'some-other-branch'})
21
- def readme(repo, options={})
21
+ def readme(repo, options = {})
22
22
  get "#{Repository.path repo}/readme", options
23
23
  end
24
24
 
@@ -33,13 +33,13 @@ module Octokit
33
33
  # Octokit.contents("octokit/octokit.rb", :path => 'lib/octokit.rb')
34
34
  # @example Lists the contents of lib /octokit.rb on a particular branch
35
35
  # Octokit.contents("octokit/octokit.rb", :path => 'lib/octokit.rb', :query => {:ref => 'some-other-branch'})
36
- def contents(repo, options={})
36
+ def contents(repo, options = {})
37
37
  options = options.dup
38
38
  repo_path = options.delete :path
39
39
  url = "#{Repository.path repo}/contents/#{repo_path}"
40
40
  get url, options
41
41
  end
42
- alias :content :contents
42
+ alias content contents
43
43
 
44
44
  # Add content to a repository
45
45
  #
@@ -59,7 +59,7 @@ module Octokit
59
59
  # "File content",
60
60
  # :branch => "my-new-feature")
61
61
  def create_contents(*args)
62
- args = args.map { |item| item && item.dup }
62
+ args = args.map { |item| item&.dup }
63
63
  options = args.last.is_a?(Hash) ? args.pop : {}
64
64
  repo = args.shift
65
65
  path = args.shift
@@ -69,7 +69,7 @@ module Octokit
69
69
  case file
70
70
  when String
71
71
  if File.exist?(file)
72
- file = File.open(file, "r")
72
+ file = File.open(file, 'r')
73
73
  content = file.read
74
74
  file.close
75
75
  end
@@ -78,17 +78,16 @@ module Octokit
78
78
  file.close
79
79
  end
80
80
  end
81
- raise ArgumentError.new("content or :file option required") if content.nil?
82
- options[:content] = Base64.respond_to?(:strict_encode64) ?
83
- Base64.strict_encode64(content) :
84
- Base64.encode64(content).delete("\n") # Ruby 1.9.2
81
+ raise ArgumentError, 'content or :file option required' if content.nil?
82
+
83
+ options[:content] = Base64.strict_encode64(content)
85
84
  options[:message] = message
86
85
  url = "#{Repository.path repo}/contents/#{path}"
87
86
  put url, options
88
87
  end
89
- alias :create_content :create_contents
90
- alias :add_content :create_contents
91
- alias :add_contents :create_contents
88
+ alias create_content create_contents
89
+ alias add_content create_contents
90
+ alias add_contents create_contents
92
91
 
93
92
  # Update content in a repository
94
93
  #
@@ -116,10 +115,10 @@ module Octokit
116
115
  message = args.shift
117
116
  sha = args.shift
118
117
  content = args.shift
119
- options.merge!(:sha => sha)
118
+ options.merge!(sha: sha)
120
119
  create_contents(repo, path, message, content, options)
121
120
  end
122
- alias :update_content :update_contents
121
+ alias update_content update_contents
123
122
 
124
123
  # Delete content in a repository
125
124
  #
@@ -142,9 +141,9 @@ module Octokit
142
141
  url = "#{Repository.path repo}/contents/#{path}"
143
142
  delete url, options
144
143
  end
145
- alias :delete_content :delete_contents
146
- alias :remove_content :delete_contents
147
- alias :remove_contents :delete_contents
144
+ alias delete_content delete_contents
145
+ alias remove_content delete_contents
146
+ alias remove_contents delete_contents
148
147
 
149
148
  # This method will provide a URL to download a tarball or zipball archive for a repository.
150
149
  #
@@ -155,8 +154,8 @@ module Octokit
155
154
  # @see https://developer.github.com/v3/repos/contents/#get-archive-link
156
155
  # @example Get archive link for octokit/octokit.rb
157
156
  # Octokit.archive_link("octokit/octokit.rb")
158
- def archive_link(repo, options={})
159
- repo_ref = ERB::Util.url_encode(options.delete :ref)
157
+ def archive_link(repo, options = {})
158
+ repo_ref = ERB::Util.url_encode(options.delete(:ref))
160
159
  format = (options.delete :format) || 'tarball'
161
160
  url = "#{Repository.path repo}/#{format}/#{repo_ref}"
162
161
 
@@ -1,11 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Octokit
2
4
  class Client
3
-
4
5
  # Methods for the Deployments API
5
6
  #
6
7
  # @see https://developer.github.com/v3/repos/commits/deployments/
7
8
  module Deployments
8
-
9
9
  # Fetch a single deployment for a repository
10
10
  #
11
11
  # @param repo [Integer, String, Repository, Hash] A GitHub repository
@@ -24,7 +24,7 @@ module Octokit
24
24
  def deployments(repo, options = {})
25
25
  get("#{Repository.path repo}/deployments", options)
26
26
  end
27
- alias :list_deployments :deployments
27
+ alias list_deployments deployments
28
28
 
29
29
  # Create a deployment for a ref
30
30
  #
@@ -59,10 +59,10 @@ module Octokit
59
59
  # @return [Array<Sawyer::Resource>] A list of deployment statuses
60
60
  # @see https://developer.github.com/v3/repos/deployments/#list-deployment-statuses
61
61
  def deployment_statuses(deployment_url, options = {})
62
- deployment = get(deployment_url, :accept => options[:accept])
62
+ deployment = get(deployment_url, accept: options[:accept])
63
63
  get(deployment.rels[:statuses].href, options)
64
64
  end
65
- alias :list_deployment_statuses :deployment_statuses
65
+ alias list_deployment_statuses deployment_statuses
66
66
 
67
67
  # Create a deployment status for a Deployment
68
68
  #
@@ -73,7 +73,7 @@ module Octokit
73
73
  # @return [Sawyer::Resource] A deployment status
74
74
  # @see https://developer.github.com/v3/repos/deployments/#create-a-deployment-status
75
75
  def create_deployment_status(deployment_url, state, options = {})
76
- deployment = get(deployment_url, :accept => options[:accept])
76
+ deployment = get(deployment_url, accept: options[:accept])
77
77
  options[:state] = state.to_s.downcase
78
78
  post(deployment.rels[:statuses].href, options)
79
79
  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 Repo Downloads API
5
6
  #
6
7
  # @see https://developer.github.com/v3/repos/downloads/
7
8
  module Downloads
8
-
9
9
  # List available downloads for a repository
10
10
  #
11
11
  # @param repo [Integer, String, Repository, Hash] A Github Repository
@@ -14,10 +14,10 @@ module Octokit
14
14
  # @see https://developer.github.com/v3/repos/downloads/#list-downloads-for-a-repository
15
15
  # @example List all downloads for Github/Hubot
16
16
  # Octokit.downloads("github/hubot")
17
- def downloads(repo, options={})
17
+ def downloads(repo, options = {})
18
18
  paginate "#{Repository.path repo}/downloads", options
19
19
  end
20
- alias :list_downloads :downloads
20
+ alias list_downloads downloads
21
21
 
22
22
  # Get single download for a repository
23
23
  #
@@ -28,7 +28,7 @@ module Octokit
28
28
  # @see https://developer.github.com/v3/repos/downloads/#get-a-single-download
29
29
  # @example Get the "Robawt" download from Github/Hubot
30
30
  # Octokit.download("github/hubot")
31
- def download(repo, id, options={})
31
+ def download(repo, id, options = {})
32
32
  get "#{Repository.path repo}/downloads/#{id}", options
33
33
  end
34
34
 
@@ -44,7 +44,6 @@ module Octokit
44
44
  def delete_download(repo, id, options = {})
45
45
  boolean_from_response :delete, "#{Repository.path repo}/downloads/#{id}", options
46
46
  end
47
-
48
47
  end
49
48
  end
50
49
  end
@@ -1,9 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Octokit
2
4
  class Client
3
-
4
5
  # Methods for the Emojis API
5
6
  module Emojis
6
-
7
7
  # List all emojis used on GitHub
8
8
  #
9
9
  # @return [Sawyer::Resource] A list of all emojis on GitHub
@@ -11,7 +11,7 @@ module Octokit
11
11
  # @example List all emojis
12
12
  # Octokit.emojis
13
13
  def emojis(options = {})
14
- get "emojis", options
14
+ get 'emojis', options
15
15
  end
16
16
  end
17
17
  end
@@ -1,12 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Octokit
2
4
  class Client
3
-
4
5
  # Method for the Events API
5
6
  #
6
7
  # @see https://developer.github.com/v3/activity/events/
7
8
  # @see https://developer.github.com/v3/issues/events/
8
9
  module Events
9
-
10
10
  # List all public events for GitHub
11
11
  #
12
12
  # @return [Array<Sawyer::Resource>] A list of all public events from GitHub
@@ -14,7 +14,7 @@ module Octokit
14
14
  # @example List all pubilc events
15
15
  # Octokit.public_events
16
16
  def public_events(options = {})
17
- paginate "events", options
17
+ paginate 'events', options
18
18
  end
19
19
 
20
20
  # List all user events
@@ -119,7 +119,7 @@ module Octokit
119
119
  def repository_issue_events(repo, options = {})
120
120
  paginate "#{Repository.path repo}/issues/events", options
121
121
  end
122
- alias :repo_issue_events :repository_issue_events
122
+ alias repo_issue_events repository_issue_events
123
123
 
124
124
  # List events for an Issue
125
125
  #
@@ -1,11 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Octokit
2
4
  class Client
3
-
4
5
  # Methods for the Feeds API
5
6
  #
6
7
  # @see https://developer.github.com/v3/activity/feeds/
7
8
  module Feeds
8
-
9
9
  # List Feeds
10
10
  #
11
11
  # The feeds returned depend on authentication, see the GitHub API docs
@@ -14,7 +14,7 @@ module Octokit
14
14
  # @return [Array<Sawyer::Resource>] list of feeds
15
15
  # @see https://developer.github.com/v3/activity/feeds/#list-feeds
16
16
  def feeds
17
- get "feeds"
17
+ get 'feeds'
18
18
  end
19
19
 
20
20
  # Get a Feed by name
@@ -24,10 +24,9 @@ module Octokit
24
24
  # parser.
25
25
  def feed(name, options = {})
26
26
  if rel = feeds._links[name]
27
- get rel.href, :accept => rel.type, :options => options
27
+ get rel.href, accept: rel.type, options: options
28
28
  end
29
29
  end
30
-
31
30
  end
32
31
  end
33
32
  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 Gists API
5
6
  #
6
7
  # @see https://developer.github.com/v3/gists/
7
8
  module Gists
8
-
9
9
  # List gists for a user or all public gists
10
10
  #
11
11
  # @param user [String] An optional user to filter listing
@@ -15,14 +15,14 @@ module Octokit
15
15
  # @example Fetch all public gists
16
16
  # Octokit.gists
17
17
  # @see https://developer.github.com/v3/gists/#list-gists
18
- def gists(user=nil, options = {})
18
+ def gists(user = nil, options = {})
19
19
  if user.nil?
20
20
  paginate 'gists', options
21
21
  else
22
22
  paginate "#{User.path user}/gists", options
23
23
  end
24
24
  end
25
- alias :list_gists :gists
25
+ alias list_gists gists
26
26
 
27
27
  # List public gists
28
28
  #
@@ -196,7 +196,7 @@ module Octokit
196
196
  # @example
197
197
  # @client.create_gist_comment('3528645', 'This is very helpful.')
198
198
  def create_gist_comment(gist_id, comment, options = {})
199
- options = options.merge({:body => comment})
199
+ options = options.merge({ body: comment })
200
200
  post "gists/#{gist_id}/comments", options
201
201
  end
202
202
 
@@ -212,7 +212,7 @@ module Octokit
212
212
  # @example
213
213
  # @client.update_gist_comment('208sdaz3', '3528645', ':heart:')
214
214
  def update_gist_comment(gist_id, gist_comment_id, comment, options = {})
215
- options = options.merge({:body => comment})
215
+ options = options.merge({ body: comment })
216
216
  patch "gists/#{gist_id}/comments/#{gist_comment_id}", options
217
217
  end
218
218
 
@@ -1,11 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Octokit
2
4
  class Client
3
-
4
5
  # Methods for the Gitignore API
5
6
  #
6
7
  # @see https://developer.github.com/v3/gitignore/
7
8
  module Gitignore
8
-
9
9
  # Listing available gitignore templates.
10
10
  #
11
11
  # These templates can be passed option when creating a repository.
@@ -17,7 +17,7 @@ module Octokit
17
17
  # @example Git all the gitignore templates
18
18
  # @client.gitignore_templates
19
19
  def gitignore_templates(options = {})
20
- get "gitignore/templates", options
20
+ get 'gitignore/templates', options
21
21
  end
22
22
 
23
23
  # Get a gitignore template.
@@ -1,9 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Octokit
2
4
  class Client
3
-
4
5
  # Methods for the Hooks API
5
6
  module Hooks
6
-
7
7
  # List all Service Hooks supported by GitHub
8
8
  #
9
9
  # @return [Sawyer::Resource] A list of all hooks on GitHub
@@ -11,7 +11,7 @@ module Octokit
11
11
  # @example List all hooks
12
12
  # Octokit.available_hooks
13
13
  def available_hooks(options = {})
14
- get "hooks", options
14
+ get 'hooks', options
15
15
  end
16
16
 
17
17
  # List repo hooks
@@ -73,7 +73,7 @@ module Octokit
73
73
  # }
74
74
  # )
75
75
  def create_hook(repo, name, config, options = {})
76
- options = {:name => name, :config => config, :events => ["push"], :active => true}.merge(options)
76
+ options = { name: name, config: config, events: ['push'], active: true }.merge(options)
77
77
  post "#{Repository.path repo}/hooks", options
78
78
  end
79
79
 
@@ -116,7 +116,7 @@ module Octokit
116
116
  # }
117
117
  # )
118
118
  def edit_hook(repo, id, name, config, options = {})
119
- options = {:name => name, :config => config}.merge(options)
119
+ options = { name: name, config: config }.merge(options)
120
120
  patch "#{Repository.path repo}/hooks/#{id}", options
121
121
  end
122
122
 
@@ -158,7 +158,7 @@ module Octokit
158
158
  # @see https://developer.github.com/v3/repos/hooks/#ping-a-hook
159
159
  # @example
160
160
  # @client.ping_hook('octokit/octokit.rb', 1000000)
161
- def ping_hook(repo, id, options={})
161
+ def ping_hook(repo, id, options = {})
162
162
  boolean_from_response :post, "#{Repository.path repo}/hooks/#{id}/pings", options
163
163
  end
164
164
 
@@ -174,7 +174,7 @@ module Octokit
174
174
  def org_hooks(org, options = {})
175
175
  paginate "#{Organization.path org}/hooks", options
176
176
  end
177
- alias :list_org_hooks :org_hooks
177
+ alias list_org_hooks org_hooks
178
178
 
179
179
  # Get an org hook
180
180
  #
@@ -217,7 +217,7 @@ module Octokit
217
217
  # }
218
218
  # )
219
219
  def create_org_hook(org, config, options = {})
220
- options = { :name => "web", :config => config }.merge(options)
220
+ options = { name: 'web', config: config }.merge(options)
221
221
  post "#{Organization.path org}/hooks", options
222
222
  end
223
223
 
@@ -250,10 +250,10 @@ module Octokit
250
250
  # }
251
251
  # )
252
252
  def edit_org_hook(org, id, config, options = {})
253
- options = { :config => config }.merge(options)
253
+ options = { config: config }.merge(options)
254
254
  patch "#{Organization.path org}/hooks/#{id}", options
255
255
  end
256
- alias :update_org_hook :edit_org_hook
256
+ alias update_org_hook edit_org_hook
257
257
 
258
258
  # Ping org hook
259
259
  #
@@ -1,11 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Octokit
2
4
  class Client
3
-
4
5
  # Methods for the Issues API
5
6
  #
6
7
  # @see https://developer.github.com/v3/issues/
7
8
  module Issues
8
-
9
9
  # List issues for the authenticated user or repository
10
10
  #
11
11
  # @param repository [Integer, String, Repository, Hash] A GitHub repository.
@@ -28,10 +28,10 @@ module Octokit
28
28
  # @client = Octokit::Client.new(:login => 'foo', :password => 'bar')
29
29
  # @client.list_issues
30
30
  def list_issues(repository = nil, options = {})
31
- path = repository ? "#{Repository.new(repository).path}/issues" : "issues"
31
+ path = repository ? "#{Repository.new(repository).path}/issues" : 'issues'
32
32
  paginate path, options
33
33
  end
34
- alias :issues :list_issues
34
+ alias issues list_issues
35
35
 
36
36
  # List all issues across owned and member repositories for the authenticated user
37
37
  #
@@ -91,17 +91,17 @@ module Octokit
91
91
  def create_issue(repo, title, body = nil, options = {})
92
92
  options[:labels] = case options[:labels]
93
93
  when String
94
- options[:labels].split(",").map(&:strip)
94
+ options[:labels].split(',').map(&:strip)
95
95
  when Array
96
96
  options[:labels]
97
97
  else
98
98
  []
99
99
  end
100
- parameters = { :title => title }
100
+ parameters = { title: title }
101
101
  parameters[:body] = body unless body.nil?
102
102
  post "#{Repository.path repo}/issues", options.merge(parameters)
103
103
  end
104
- alias :open_issue :create_issue
104
+ alias open_issue create_issue
105
105
 
106
106
  # Get a single issue from a repository
107
107
  #
@@ -129,7 +129,7 @@ module Octokit
129
129
  # @example Close Issue #25 from octokit/octokit.rb
130
130
  # Octokit.close_issue("octokit/octokit.rb", "25")
131
131
  def close_issue(repo, number, options = {})
132
- patch "#{Repository.path repo}/issues/#{number}", options.merge({:state => "closed"})
132
+ patch "#{Repository.path repo}/issues/#{number}", options.merge({ state: 'closed' })
133
133
  end
134
134
 
135
135
  # Reopen an issue
@@ -146,7 +146,7 @@ module Octokit
146
146
  # @example Reopen Issue #25 from octokit/octokit.rb
147
147
  # Octokit.reopen_issue("octokit/octokit.rb", "25")
148
148
  def reopen_issue(repo, number, options = {})
149
- patch "#{Repository.path repo}/issues/#{number}", options.merge({:state => "open"})
149
+ patch "#{Repository.path repo}/issues/#{number}", options.merge({ state: 'open' })
150
150
  end
151
151
 
152
152
  # Lock an issue's conversation, limiting it to collaborators
@@ -210,7 +210,7 @@ module Octokit
210
210
  arguments = Arguments.new(args)
211
211
  opts = arguments.options
212
212
 
213
- if arguments.length > 0
213
+ unless arguments.empty?
214
214
  opts[:title] = arguments.shift
215
215
  opts[:body] = arguments.shift
216
216
  end
@@ -281,7 +281,7 @@ module Octokit
281
281
  # @example Add the comment "Almost to v1" to Issue #23 on octokit/octokit.rb
282
282
  # Octokit.add_comment("octokit/octokit.rb", 23, "Almost to v1")
283
283
  def add_comment(repo, number, comment, options = {})
284
- post "#{Repository.path repo}/issues/#{number}/comments", options.merge({:body => comment})
284
+ post "#{Repository.path repo}/issues/#{number}/comments", options.merge({ body: comment })
285
285
  end
286
286
 
287
287
  # Update a single comment on an issue
@@ -294,7 +294,7 @@ module Octokit
294
294
  # @example Update the comment #1194549 with body "I've started this on my 25-issue-comments-v3 fork" on an issue on octokit/octokit.rb
295
295
  # Octokit.update_comment("octokit/octokit.rb", 1194549, "Almost to v1, added this on my fork")
296
296
  def update_comment(repo, number, comment, options = {})
297
- patch "#{Repository.path repo}/issues/comments/#{number}", options.merge({:body => comment})
297
+ patch "#{Repository.path repo}/issues/comments/#{number}", options.merge({ body: comment })
298
298
  end
299
299
 
300
300
  # Delete a single comment
@@ -343,7 +343,7 @@ module Octokit
343
343
  # @example Add assignees "pengwynn" and "joeyw" to Issue #23 on octokit/octokit.rb
344
344
  # Octokit.add_assignees("octokit/octokit.rb", 23, ["pengwynn", "joeyw"])
345
345
  def add_assignees(repo, number, assignees, options = {})
346
- post "#{Repository.path repo}/issues/#{number}/assignees", options.merge({:assignees => assignees})
346
+ post "#{Repository.path repo}/issues/#{number}/assignees", options.merge({ assignees: assignees })
347
347
  end
348
348
 
349
349
  # Remove assignees from an issue
@@ -361,7 +361,7 @@ module Octokit
361
361
  # Octokit.remove_assignees("octokit/octokit.rb", 23, ["pengwynn"],
362
362
  # :accept => "application/vnd.github.v3+json")
363
363
  def remove_assignees(repo, number, assignees, options = {})
364
- delete "#{Repository.path repo}/issues/#{number}/assignees", options.merge({:assignees => assignees})
364
+ delete "#{Repository.path repo}/issues/#{number}/assignees", options.merge({ assignees: assignees })
365
365
  end
366
366
  end
367
367
  end
@@ -1,13 +1,13 @@
1
- require "erb"
1
+ # frozen_string_literal: true
2
+
3
+ require 'erb'
2
4
 
3
5
  module Octokit
4
6
  class Client
5
-
6
7
  # Methods for the Issue Labels API
7
8
  #
8
9
  # @see https://developer.github.com/v3/issues/labels/
9
10
  module Labels
10
-
11
11
  # List available labels for a repository
12
12
  #
13
13
  # @param repo [Integer, String, Repository, Hash] A GitHub repository
@@ -40,8 +40,8 @@ module Octokit
40
40
  # @see https://developer.github.com/v3/issues/labels/#create-a-label
41
41
  # @example Add a new label "Version 1.0" with color "#cccccc"
42
42
  # Octokit.add_label("octokit/octokit.rb", "Version 1.0", "cccccc")
43
- def add_label(repo, label, color="ffffff", options = {})
44
- post "#{Repository.path repo}/labels", options.merge({:name => label, :color => color})
43
+ def add_label(repo, label, color = 'ffffff', options = {})
44
+ post "#{Repository.path repo}/labels", options.merge({ name: label, color: color })
45
45
  end
46
46
 
47
47
  # Update a label
@@ -136,7 +136,7 @@ module Octokit
136
136
  # @see https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue
137
137
  # @example Replace labels for octokit/octokit.rb Issue #10
138
138
  # Octokit.replace_all_labels("octokit/octokit.rb", 10, ['V3 Transition', 'Improvement'])
139
- def replace_all_labels(repo, number, labels, options = {})
139
+ def replace_all_labels(repo, number, labels, _options = {})
140
140
  put "#{Repository.path repo}/issues/#{number}/labels", labels
141
141
  end
142
142
 
@@ -1,11 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Octokit
2
4
  class Client
3
-
4
5
  # Methods for the Legacy Search API
5
6
  #
6
7
  # @see https://developer.github.com/v3/search/
7
8
  module LegacySearch
8
-
9
9
  # Legacy repository search
10
10
  #
11
11
  # @see https://developer.github.com/v3/search/#search-repositories
@@ -23,7 +23,7 @@ module Octokit
23
23
  # @return [Array<Sawyer::Resource>] A list of issues matching the search term and state
24
24
  # @example Search for 'test' in the open issues for sferik/rails_admin
25
25
  # Octokit.search_issues("sferik/rails_admin", 'test', 'open')
26
- def legacy_search_issues(repo, search_term, state='open', options = {})
26
+ def legacy_search_issues(repo, search_term, state = 'open', options = {})
27
27
  get("legacy/issues/search/#{Repository.new(repo)}/#{state}/#{search_term}", options)['issues']
28
28
  end
29
29
 
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Octokit
2
4
  class Client
3
-
4
5
  # Methods for licenses API
5
6
  #
6
7
  module Licenses
7
-
8
8
  # List all licenses
9
9
  #
10
10
  # @see https://developer.github.com/v3/licenses/#list-all-licenses
@@ -13,7 +13,7 @@ module Octokit
13
13
  # Octokit.licenses
14
14
  def licenses(options = {})
15
15
  options = ensure_api_media_type(:licenses, options)
16
- paginate "licenses", options
16
+ paginate 'licenses', options
17
17
  end
18
18
 
19
19
  # List an individual license
@@ -1,11 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Octokit
2
4
  class Client
3
-
4
5
  # Methods for the Markdown API
5
6
  #
6
7
  # @see https://developer.github.com/v3/markdown/
7
8
  module Markdown
8
-
9
9
  # Render an arbitrary Markdown document
10
10
  #
11
11
  # @param text [String] Markdown source
@@ -20,7 +20,7 @@ module Octokit
20
20
  options[:repo] = Repository.new(options[:repo]) if options[:repo]
21
21
  options[:accept] = 'application/vnd.github.raw'
22
22
 
23
- post "markdown", options
23
+ post 'markdown', options
24
24
  end
25
25
  end
26
26
  end