octokit 4.6.0 → 4.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +5 -5
  2. data/CONTRIBUTING.md +14 -13
  3. data/LICENSE.md +1 -1
  4. data/README.md +141 -60
  5. data/lib/ext/sawyer/relation.rb +10 -0
  6. data/lib/octokit/authentication.rb +10 -11
  7. data/lib/octokit/client/actions_secrets.rb +58 -0
  8. data/lib/octokit/client/actions_workflow_runs.rb +105 -0
  9. data/lib/octokit/client/actions_workflows.rb +43 -0
  10. data/lib/octokit/client/apps.rb +222 -0
  11. data/lib/octokit/client/authorizations.rb +12 -74
  12. data/lib/octokit/client/checks.rb +191 -0
  13. data/lib/octokit/client/commit_branches.rb +20 -0
  14. data/lib/octokit/client/commit_pulls.rb +20 -0
  15. data/lib/octokit/client/community_profile.rb +22 -0
  16. data/lib/octokit/client/contents.rb +6 -0
  17. data/lib/octokit/client/deployments.rb +20 -0
  18. data/lib/octokit/client/events.rb +1 -0
  19. data/lib/octokit/client/gists.rb +3 -2
  20. data/lib/octokit/client/issues.rb +48 -1
  21. data/lib/octokit/client/labels.rb +7 -7
  22. data/lib/octokit/client/licenses.rb +1 -1
  23. data/lib/octokit/client/marketplace.rb +56 -0
  24. data/lib/octokit/client/notifications.rb +0 -4
  25. data/lib/octokit/client/oauth_applications.rb +122 -0
  26. data/lib/octokit/client/organizations.rb +149 -16
  27. data/lib/octokit/client/projects.rb +7 -7
  28. data/lib/octokit/client/pull_requests.rb +7 -5
  29. data/lib/octokit/client/rate_limit.rb +2 -2
  30. data/lib/octokit/client/refs.rb +19 -3
  31. data/lib/octokit/client/releases.rb +1 -0
  32. data/lib/octokit/client/repositories.rb +169 -8
  33. data/lib/octokit/client/repository_invitations.rb +1 -8
  34. data/lib/octokit/client/reviews.rb +227 -0
  35. data/lib/octokit/client/search.rb +24 -9
  36. data/lib/octokit/client/source_import.rb +1 -1
  37. data/lib/octokit/client/stats.rb +2 -0
  38. data/lib/octokit/client/statuses.rb +2 -2
  39. data/lib/octokit/client/users.rb +88 -1
  40. data/lib/octokit/client.rb +41 -9
  41. data/lib/octokit/configurable.rb +10 -2
  42. data/lib/octokit/connection.rb +19 -4
  43. data/lib/octokit/default.rb +17 -1
  44. data/lib/octokit/enterprise_admin_client/admin_stats.rb +1 -1
  45. data/lib/octokit/enterprise_admin_client/license.rb +1 -1
  46. data/lib/octokit/enterprise_admin_client/orgs.rb +2 -2
  47. data/lib/octokit/enterprise_admin_client/search_indexing.rb +1 -1
  48. data/lib/octokit/enterprise_admin_client/users.rb +12 -12
  49. data/lib/octokit/enterprise_management_console_client/management_console.rb +1 -1
  50. data/lib/octokit/enterprise_management_console_client.rb +1 -1
  51. data/lib/octokit/error.rb +74 -4
  52. data/lib/octokit/gist.rb +1 -1
  53. data/lib/octokit/middleware/follow_redirects.rb +2 -2
  54. data/lib/octokit/preview.rb +14 -3
  55. data/lib/octokit/rate_limit.rb +4 -4
  56. data/lib/octokit/repository.rb +10 -8
  57. data/lib/octokit/response/feed_parser.rb +0 -2
  58. data/lib/octokit/response/raise_error.rb +0 -2
  59. data/lib/octokit/version.rb +1 -1
  60. data/octokit.gemspec +2 -1
  61. metadata +39 -9
@@ -0,0 +1,105 @@
1
+ module Octokit
2
+ class Client
3
+ module ActionsWorkflowRuns
4
+ # List all runs for a repository workflow
5
+ #
6
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
7
+ # @param workflow [Integer, String] Id or file name of the workflow
8
+ # @option options [String] :actor Optional filtering by a user
9
+ # @option options [String] :branch Optional filtering by a branch
10
+ # @option options [String] :event Optional filtering by the event type
11
+ # @option options [String] :status Optional filtering by a status or conclusion
12
+ #
13
+ # @return [Sawyer::Resource] the total count and an array of workflows
14
+ # @see https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs
15
+ def workflow_runs(repo, workflow, options = {})
16
+ paginate "#{Repository.path repo}/actions/workflows/#{workflow}/runs", options
17
+ end
18
+ alias list_workflow_runs workflow_runs
19
+
20
+ # List all workflow runs for a repository
21
+ #
22
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
23
+ # @option options [String] :actor Optional filtering by the login of a user
24
+ # @option options [String] :branch Optional filtering by a branch
25
+ # @option options [String] :event Optional filtering by the event type (e.g. push, pull_request, issue)
26
+ # @option options [String] :status Optional filtering by a status or conclusion (e.g. success, completed...)
27
+ #
28
+ # @return [Sawyer::Resource] the total count and an array of workflows
29
+ # @see https://developer.github.com/v3/actions/workflow-runs/#list-repository-workflow-runs
30
+ def repository_workflow_runs(repo, options = {})
31
+ paginate "#{Repository.path repo}/actions/runs", options
32
+ end
33
+ alias list_repository_workflow_runs repository_workflow_runs
34
+
35
+ # Get a workflow run
36
+ #
37
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
38
+ # @param id [Integer] Id of a workflow run
39
+ #
40
+ # @return [Sawyer::Resource] Run information
41
+ # @see https://developer.github.com/v3/actions/workflow-runs/#get-a-workflow-run
42
+ def workflow_run(repo, id, options = {})
43
+ get "#{Repository.path repo}/actions/runs/#{id}", options
44
+ end
45
+
46
+ # Re-runs a workflow run
47
+ #
48
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
49
+ # @param id [Integer] Id of a workflow run
50
+ #
51
+ # @return [Boolean] Returns true if the re-run request was accepted
52
+ # @see https://developer.github.com/v3/actions/workflow-runs/#re-run-a-workflow
53
+ def rerun_workflow_run(repo, id, options = {})
54
+ boolean_from_response :post, "#{Repository.path repo}/actions/runs/#{id}/rerun", options
55
+ end
56
+
57
+ # Cancels a workflow run
58
+ #
59
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
60
+ # @param id [Integer] Id of a workflow run
61
+ #
62
+ # @return [Boolean] Returns true if the cancellation was accepted
63
+ # @see https://developer.github.com/v3/actions/workflow-runs/#cancel-a-workflow-run
64
+ def cancel_workflow_run(repo, id, options = {})
65
+ boolean_from_response :post, "#{Repository.path repo}/actions/runs/#{id}/cancel", options
66
+ end
67
+
68
+ # Deletes a workflow run
69
+ #
70
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
71
+ # @param id [Integer] Id of a workflow run
72
+ #
73
+ # @return [Boolean] Returns true if the run is deleted
74
+ # @see https://docs.github.com/en/rest/reference/actions#delete-a-workflow-run
75
+ def delete_workflow_run(repo, id, options = {})
76
+ boolean_from_response :delete, "#{Repository.path repo}/actions/runs/#{id}", options
77
+ end
78
+
79
+ # Get a download url for archived log files of a workflow run
80
+ #
81
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
82
+ # @param id [Integer] Id of a workflow run
83
+ #
84
+ # @return [String] URL to the archived log files of the run
85
+ # @see https://developer.github.com/v3/actions/workflow-runs/#download-workflow-run-logs
86
+ def workflow_run_logs(repo, id, options = {})
87
+ url = "#{Repository.path repo}/actions/runs/#{id}/logs"
88
+
89
+ response = client_without_redirects.head(url, options)
90
+ response.headers['Location']
91
+ end
92
+
93
+ # Delets all log files of a workflow run
94
+ #
95
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
96
+ # @param id [Integer] Id of a workflow run
97
+ #
98
+ # @return [Boolean] Returns true if the logs are deleted
99
+ # @see https://developer.github.com/v3/actions/workflow-runs/#delete-workflow-run-logs
100
+ def delete_workflow_run_logs(repo, id, options = {})
101
+ boolean_from_response :delete, "#{Repository.path repo}/actions/runs/#{id}/logs", options
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,43 @@
1
+ module Octokit
2
+ class Client
3
+ # Methods for the Actions Workflows API
4
+ #
5
+ # @see https://developer.github.com/v3/actions/workflows
6
+ module ActionsWorkflows
7
+
8
+ # Get the workflows in a repository
9
+ #
10
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
11
+ #
12
+ # @return [Sawyer::Resource] the total count and an array of workflows
13
+ # @see https://developer.github.com/v3/actions/workflows/#list-repository-workflows
14
+ def workflows(repo, options = {})
15
+ paginate "#{Repository.path repo}/actions/workflows", options
16
+ end
17
+ alias list_workflows workflows
18
+
19
+ # Get single workflow in a repository
20
+ #
21
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
22
+ # @param id [Integer, String] Id or file name of the workflow
23
+ #
24
+ # @return [Sawyer::Resource] A single workflow
25
+ # @see https://developer.github.com/v3/actions/workflows/#get-a-workflow
26
+ def workflow(repo, id, options = {})
27
+ get "#{Repository.path repo}/actions/workflows/#{id}", options
28
+ end
29
+
30
+ # Create a workflow dispatch event
31
+ #
32
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
33
+ # @param id [Integer, String] Id or file name of the workflow
34
+ # @param ref [String] A SHA, branch name, or tag name
35
+ #
36
+ # @return [Boolean] True if event was dispatched, false otherwise
37
+ # @see https://docs.github.com/en/rest/reference/actions#create-a-workflow-dispatch-event
38
+ def workflow_dispatch(repo, id, ref, options = {})
39
+ boolean_from_response :post, "#{Repository.path repo}/actions/workflows/#{id}/dispatches", options.merge({ ref: ref })
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,222 @@
1
+ module Octokit
2
+ class Client
3
+
4
+ # Methods for the Apps API
5
+ module Apps
6
+
7
+ # Get the authenticated App
8
+ #
9
+ # @param options [Hash] A customizable set of options
10
+ #
11
+ # @see https://developer.github.com/v3/apps/#get-the-authenticated-app
12
+ #
13
+ # @return [Sawyer::Resource] App information
14
+ def app(options = {})
15
+ get "app", options
16
+ end
17
+
18
+ # Find all installations that belong to an App
19
+ #
20
+ # @param options [Hash] A customizable set of options
21
+ #
22
+ # @see https://developer.github.com/v3/apps/#list-installations
23
+ #
24
+ # @return [Array<Sawyer::Resource>] the total_count and an array of installations
25
+ def find_app_installations(options = {})
26
+ paginate "app/installations", options
27
+ end
28
+ alias find_installations find_app_installations
29
+
30
+ def find_integration_installations(options = {})
31
+ octokit_warn(
32
+ "Deprecated: Octokit::Client::Apps#find_integration_installations "\
33
+ "method is deprecated. Please update your call to use "\
34
+ "Octokit::Client::Apps#find_app_installations before the next major "\
35
+ "Octokit version update."
36
+ )
37
+ find_app_installations(options)
38
+ end
39
+
40
+ # Find all installations that are accessible to the authenticated user
41
+ #
42
+ # @param options [Hash] A customizable set of options
43
+ #
44
+ # @see https://developer.github.com/v3/apps/installations/#list-installations-for-a-user
45
+ #
46
+ # @return [Sawyer::Resource] the total_count and an array of installations
47
+ def find_user_installations(options = {})
48
+ paginate("user/installations", options) do |data, last_response|
49
+ data.installations.concat last_response.data.installations
50
+ end
51
+ end
52
+
53
+ # Get a single installation
54
+ #
55
+ # @param id [Integer] Installation id
56
+ #
57
+ # @see https://developer.github.com/v3/apps/#get-an-installation
58
+ #
59
+ # @return [Sawyer::Resource] Installation information
60
+ def installation(id, options = {})
61
+ get "app/installations/#{id}", options
62
+ end
63
+
64
+ # Create a new installation token
65
+ #
66
+ # @param installation [Integer] The id of a GitHub App Installation
67
+ # @param options [Hash] A customizable set of options
68
+ #
69
+ # @see https://developer.github.com/v3/apps/#create-a-new-installation-token
70
+ #
71
+ # @return [<Sawyer::Resource>] An installation token
72
+ def create_app_installation_access_token(installation, options = {})
73
+ post "app/installations/#{installation}/access_tokens", options
74
+ end
75
+ alias create_installation_access_token create_app_installation_access_token
76
+
77
+ def create_integration_installation_access_token(installation, options = {})
78
+ octokit_warn(
79
+ "Deprecated: Octokit::Client::Apps#create_integration_installation_access_token "\
80
+ "method is deprecated. Please update your call to use "\
81
+ "Octokit::Client::Apps#create_app_installation_access_token before the next major "\
82
+ "Octokit version update."
83
+ )
84
+ create_app_installation_access_token(installation, options)
85
+ end
86
+
87
+ # Enables an app to find the organization's installation information.
88
+ #
89
+ # @param organization [String] Organization GitHub login
90
+ # @param options [Hash] A customizable set of options
91
+ #
92
+ # @see https://developer.github.com/v3/apps/#get-an-organization-installation
93
+ #
94
+ # @return [Sawyer::Resource] Installation information
95
+ def find_organization_installation(organization, options = {})
96
+ get "#{Organization.path(organization)}/installation", options
97
+ end
98
+
99
+ # Enables an app to find the repository's installation information.
100
+ #
101
+ # @param repo [String] A GitHub repository
102
+ # @param options [Hash] A customizable set of options
103
+ #
104
+ # @see https://developer.github.com/v3/apps/#get-a-repository-installation
105
+ #
106
+ # @return [Sawyer::Resource] Installation information
107
+ def find_repository_installation(repo, options = {})
108
+ get "#{Repository.path(repo)}/installation", options
109
+ end
110
+
111
+ # Enables an app to find the user's installation information.
112
+ #
113
+ # @param user [String] GitHub user login
114
+ # @param options [Hash] A customizable set of options
115
+ #
116
+ # @see https://developer.github.com/v3/apps/#get-a-user-installation
117
+ #
118
+ # @return [Sawyer::Resource] Installation information
119
+ def find_user_installation(user, options = {})
120
+ get "#{User.path(user)}/installation", options
121
+ end
122
+
123
+ # List repositories that are accessible to the authenticated installation
124
+ #
125
+ # @param options [Hash] A customizable set of options
126
+ #
127
+ # @see https://developer.github.com/v3/apps/installations/#list-repositories
128
+ #
129
+ # @return [Sawyer::Resource] the total_count and an array of repositories
130
+ def list_app_installation_repositories(options = {})
131
+ paginate("installation/repositories", options) do |data, last_response|
132
+ data.repositories.concat last_response.data.repositories
133
+ end
134
+ end
135
+ alias list_installation_repos list_app_installation_repositories
136
+
137
+ def list_integration_installation_repositories(options = {})
138
+ octokit_warn(
139
+ "Deprecated: Octokit::Client::Apps#list_integration_installation_repositories "\
140
+ "method is deprecated. Please update your call to use "\
141
+ "Octokit::Client::Apps#list_app_installation_repositories before the next major "\
142
+ "Octokit version update."
143
+ )
144
+ list_app_installation_repositories(options)
145
+ end
146
+
147
+ # Add a single repository to an installation
148
+ #
149
+ # @param installation [Integer] The id of a GitHub App Installation
150
+ # @param repo [Integer] The id of the GitHub repository
151
+ # @param options [Hash] A customizable set of options
152
+ #
153
+ # @see https://developer.github.com/v3/apps/installations/#add-repository-to-installation
154
+ #
155
+ # @return [Boolean] Success
156
+ def add_repository_to_app_installation(installation, repo, options = {})
157
+ boolean_from_response :put, "user/installations/#{installation}/repositories/#{repo}", options
158
+ end
159
+ alias add_repo_to_installation add_repository_to_app_installation
160
+
161
+ def add_repository_to_integration_installation(installation, repo, options = {})
162
+ octokit_warn(
163
+ "Deprecated: Octokit::Client::Apps#add_repository_to_integration_installation "\
164
+ "method is deprecated. Please update your call to use "\
165
+ "Octokit::Client::Apps#add_repository_to_app_installation before the next major "\
166
+ "Octokit version update."
167
+ )
168
+ add_repository_to_app_installation(installation, repo, options)
169
+ end
170
+
171
+ # Remove a single repository to an installation
172
+ #
173
+ # @param installation [Integer] The id of a GitHub App Installation
174
+ # @param repo [Integer] The id of the GitHub repository
175
+ # @param options [Hash] A customizable set of options
176
+ #
177
+ # @see https://developer.github.com/v3/apps/installations/#remove-repository-from-installation
178
+ #
179
+ # @return [Boolean] Success
180
+ def remove_repository_from_app_installation(installation, repo, options = {})
181
+ boolean_from_response :delete, "user/installations/#{installation}/repositories/#{repo}", options
182
+ end
183
+ alias remove_repo_from_installation remove_repository_from_app_installation
184
+
185
+ def remove_repository_from_integration_installation(installation, repo, options = {})
186
+ octokit_warn(
187
+ "Deprecated: Octokit::Client::Apps#remove_repository_from_integration_installation "\
188
+ "method is deprecated. Please update your call to use "\
189
+ "Octokit::Client::Apps#remove_repository_from_app_installation before the next major "\
190
+ "Octokit version update."
191
+ )
192
+ remove_repository_from_app_installation(installation, repo, options)
193
+ end
194
+
195
+ # List repositories accessible to the user for an installation
196
+ #
197
+ # @param installation [Integer] The id of a GitHub App Installation
198
+ # @param options [Hash] A customizable set of options
199
+ #
200
+ # @see https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-for-an-installation
201
+ #
202
+ # @return [Sawyer::Resource] the total_count and an array of repositories
203
+ def find_installation_repositories_for_user(installation, options = {})
204
+ paginate("user/installations/#{installation}/repositories", options) do |data, last_response|
205
+ data.repositories.concat last_response.data.repositories
206
+ end
207
+ end
208
+
209
+ # Delete an installation and uninstall a GitHub App
210
+ #
211
+ # @param installation [Integer] The id of a GitHub App Installation
212
+ # @param options [Hash] A customizable set of options
213
+ #
214
+ # @see https://developer.github.com/v3/apps/#delete-an-installation
215
+ #
216
+ # @return [Boolean] Success
217
+ def delete_installation(installation, options = {})
218
+ boolean_from_response :delete, "app/installations/#{installation}", options
219
+ end
220
+ end
221
+ end
222
+ end
@@ -59,14 +59,18 @@ module Octokit
59
59
  # client = Octokit::Client.new(:login => 'ctshryock', :password => 'secret')
60
60
  # client.create_authorization({:idempotent => true, :client_id => 'xxxx', :client_secret => 'yyyy', :scopes => ["user"]})
61
61
  def create_authorization(options = {})
62
- # Techincally we can omit scopes as GitHub has a default, however the
62
+ # Technically we can omit scopes as GitHub has a default, however the
63
63
  # API will reject us if we send a POST request with an empty body.
64
-
64
+ options = options.dup
65
65
  if options.delete :idempotent
66
66
  client_id, client_secret = fetch_client_id_and_secret(options)
67
67
  raise ArgumentError.new("Client ID and Secret required for idempotent authorizations") unless client_id && client_secret
68
68
 
69
- if fingerprint = options.delete(:fingerprint)
69
+ # Remove the client_id from the body otherwise
70
+ # this will result in a 422.
71
+ options.delete(:client_id)
72
+
73
+ if (fingerprint = options.delete(:fingerprint))
70
74
  put "authorizations/clients/#{client_id}/#{fingerprint}", options.merge(:client_secret => client_secret)
71
75
  else
72
76
  put "authorizations/clients/#{client_id}", options.merge(:client_secret => client_secret)
@@ -122,6 +126,7 @@ module Octokit
122
126
  # @return [Array<String>] OAuth scopes
123
127
  # @see https://developer.github.com/v3/oauth/#scopes
124
128
  def scopes(token = @access_token, options = {})
129
+ options= options.dup
125
130
  raise ArgumentError.new("Access token required") if token.nil?
126
131
 
127
132
  auth = { "Authorization" => "token #{token}" }
@@ -135,74 +140,6 @@ module Octokit
135
140
  sort
136
141
  end
137
142
 
138
- # Check if a token is valid.
139
- #
140
- # Applications can check if a token is valid without rate limits.
141
- #
142
- # @param token [String] 40 character GitHub OAuth access token
143
- #
144
- # @return [Sawyer::Resource] A single authorization for the authenticated user
145
- # @see https://developer.github.com/v3/oauth_authorizations/#check-an-authorization
146
- # @example
147
- # client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
148
- # client.check_application_authorization('deadbeef1234567890deadbeef987654321')
149
- def check_application_authorization(token, options = {})
150
- opts = options.dup
151
- key = opts.delete(:client_id) || client_id
152
- secret = opts.delete(:client_secret) || client_secret
153
-
154
- as_app(key, secret) do |app_client|
155
- app_client.get "/applications/#{client_id}/tokens/#{token}", opts
156
- end
157
- end
158
-
159
- # Reset a token
160
- #
161
- # Applications can reset a token without requiring a user to re-authorize.
162
- #
163
- # @param token [String] 40 character GitHub OAuth access token
164
- #
165
- # @return [Sawyer::Resource] A single authorization for the authenticated user
166
- # @see https://developer.github.com/v3/oauth_authorizations/#reset-an-authorization
167
- # @example
168
- # client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
169
- # client.reset_application_authorization('deadbeef1234567890deadbeef987654321')
170
- def reset_application_authorization(token, options = {})
171
- opts = options.dup
172
- key = opts.delete(:client_id) || client_id
173
- secret = opts.delete(:client_secret) || client_secret
174
-
175
- as_app(key, secret) do |app_client|
176
- app_client.post "/applications/#{client_id}/tokens/#{token}", opts
177
- end
178
- end
179
-
180
- # Revoke a token
181
- #
182
- # Applications can revoke (delete) a token
183
- #
184
- # @param token [String] 40 character GitHub OAuth access token
185
- #
186
- # @return [Boolean] Result
187
- # @see https://developer.github.com/v3/oauth_authorizations/#revoke-an-authorization-for-an-application
188
- # @example
189
- # client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
190
- # client.revoke_application_authorization('deadbeef1234567890deadbeef987654321')
191
- def revoke_application_authorization(token, options = {})
192
- opts = options.dup
193
- key = opts.delete(:client_id) || client_id
194
- secret = opts.delete(:client_secret) || client_secret
195
-
196
- as_app(key, secret) do |app_client|
197
- app_client.delete "/applications/#{client_id}/tokens/#{token}", opts
198
-
199
- app_client.last_response.status == 204
200
- end
201
- rescue Octokit::NotFound
202
- false
203
- end
204
- alias :delete_application_authorization :revoke_application_authorization
205
-
206
143
  # Revoke all tokens for an app
207
144
  #
208
145
  # Applications can revoke all of their tokens in a single request
@@ -226,14 +163,15 @@ module Octokit
226
163
  # @example
227
164
  # @client.authorize_url('xxxx')
228
165
  def authorize_url(app_id = client_id, options = {})
166
+ opts = options.dup
229
167
  if app_id.to_s.empty?
230
- raise Octokit::ApplicationCredentialsRequired.new "client_id required"
168
+ raise Octokit::ApplicationCredentialsRequired, "client_id required"
231
169
  end
232
- authorize_url = options.delete(:endpoint) || Octokit.web_endpoint
170
+ authorize_url = opts.delete(:endpoint) || Octokit.web_endpoint
233
171
  authorize_url << "login/oauth/authorize?client_id=#{app_id}"
234
172
 
235
173
  require 'cgi'
236
- options.each do |key, value|
174
+ opts.each do |key, value|
237
175
  authorize_url << "&#{key}=#{CGI.escape value}"
238
176
  end
239
177