octokit 4.6.0 → 4.21.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.
- checksums.yaml +5 -5
- data/CONTRIBUTING.md +14 -13
- data/LICENSE.md +1 -1
- data/README.md +141 -60
- data/lib/ext/sawyer/relation.rb +10 -0
- data/lib/octokit/authentication.rb +10 -11
- data/lib/octokit/client/actions_secrets.rb +58 -0
- data/lib/octokit/client/actions_workflow_runs.rb +105 -0
- data/lib/octokit/client/actions_workflows.rb +43 -0
- data/lib/octokit/client/apps.rb +222 -0
- data/lib/octokit/client/authorizations.rb +12 -74
- data/lib/octokit/client/checks.rb +191 -0
- data/lib/octokit/client/commit_branches.rb +20 -0
- data/lib/octokit/client/commit_pulls.rb +20 -0
- data/lib/octokit/client/community_profile.rb +22 -0
- data/lib/octokit/client/contents.rb +6 -0
- data/lib/octokit/client/deployments.rb +20 -0
- data/lib/octokit/client/events.rb +1 -0
- data/lib/octokit/client/gists.rb +3 -2
- data/lib/octokit/client/issues.rb +48 -1
- data/lib/octokit/client/labels.rb +7 -7
- data/lib/octokit/client/licenses.rb +1 -1
- data/lib/octokit/client/marketplace.rb +56 -0
- data/lib/octokit/client/notifications.rb +0 -4
- data/lib/octokit/client/oauth_applications.rb +122 -0
- data/lib/octokit/client/organizations.rb +149 -16
- data/lib/octokit/client/projects.rb +7 -7
- data/lib/octokit/client/pull_requests.rb +7 -5
- data/lib/octokit/client/rate_limit.rb +2 -2
- data/lib/octokit/client/refs.rb +19 -3
- data/lib/octokit/client/releases.rb +1 -0
- data/lib/octokit/client/repositories.rb +169 -8
- data/lib/octokit/client/repository_invitations.rb +1 -8
- data/lib/octokit/client/reviews.rb +227 -0
- data/lib/octokit/client/search.rb +24 -9
- data/lib/octokit/client/source_import.rb +1 -1
- data/lib/octokit/client/stats.rb +2 -0
- data/lib/octokit/client/statuses.rb +2 -2
- data/lib/octokit/client/users.rb +88 -1
- data/lib/octokit/client.rb +41 -9
- data/lib/octokit/configurable.rb +10 -2
- data/lib/octokit/connection.rb +19 -4
- data/lib/octokit/default.rb +17 -1
- data/lib/octokit/enterprise_admin_client/admin_stats.rb +1 -1
- data/lib/octokit/enterprise_admin_client/license.rb +1 -1
- data/lib/octokit/enterprise_admin_client/orgs.rb +2 -2
- data/lib/octokit/enterprise_admin_client/search_indexing.rb +1 -1
- data/lib/octokit/enterprise_admin_client/users.rb +12 -12
- data/lib/octokit/enterprise_management_console_client/management_console.rb +1 -1
- data/lib/octokit/enterprise_management_console_client.rb +1 -1
- data/lib/octokit/error.rb +74 -4
- data/lib/octokit/gist.rb +1 -1
- data/lib/octokit/middleware/follow_redirects.rb +2 -2
- data/lib/octokit/preview.rb +14 -3
- data/lib/octokit/rate_limit.rb +4 -4
- data/lib/octokit/repository.rb +10 -8
- data/lib/octokit/response/feed_parser.rb +0 -2
- data/lib/octokit/response/raise_error.rb +0 -2
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +2 -1
- metadata +39 -9
data/lib/octokit/client/users.rb
CHANGED
@@ -44,7 +44,7 @@ module Octokit
|
|
44
44
|
# @example
|
45
45
|
# Octokit.exchange_code_for_token('aaaa', 'xxxx', 'yyyy', {:accept => 'application/json'})
|
46
46
|
def exchange_code_for_token(code, app_id = client_id, app_secret = client_secret, options = {})
|
47
|
-
options.merge
|
47
|
+
options = options.merge({
|
48
48
|
:code => code,
|
49
49
|
:client_id => app_id,
|
50
50
|
:client_secret => app_secret,
|
@@ -53,6 +53,7 @@ module Octokit
|
|
53
53
|
:accept => 'application/json'
|
54
54
|
}
|
55
55
|
})
|
56
|
+
|
56
57
|
post "#{web_endpoint}login/oauth/access_token", options
|
57
58
|
end
|
58
59
|
|
@@ -339,6 +340,92 @@ module Octokit
|
|
339
340
|
end
|
340
341
|
alias :watched :subscriptions
|
341
342
|
|
343
|
+
# Initiates the generation of a migration archive.
|
344
|
+
#
|
345
|
+
# Requires authenticated user.
|
346
|
+
#
|
347
|
+
# @param repositories [Array<String>] :repositories Repositories for the organization.
|
348
|
+
# @option options [Boolean, optional] :lock_repositories Indicates whether repositories should be locked during migration
|
349
|
+
# @option options [Boolean, optional] :exclude_attachments Exclude attachments fro the migration data
|
350
|
+
# @return [Sawyer::Resource] Hash representing the new migration.
|
351
|
+
# @example
|
352
|
+
# @client.start_migration(['octocat/hello-world'])
|
353
|
+
# @see https://docs.github.com/en/rest/reference/migrations#start-a-user-migration
|
354
|
+
def start_user_migration(repositories, options = {})
|
355
|
+
options = ensure_api_media_type(:migrations, options)
|
356
|
+
options[:repositories] = repositories
|
357
|
+
post "user/migrations", options
|
358
|
+
end
|
359
|
+
|
360
|
+
# Lists the most recent migrations.
|
361
|
+
#
|
362
|
+
# Requires authenticated user.
|
363
|
+
#
|
364
|
+
# @return [Array<Sawyer::Resource>] Array of migration resources.
|
365
|
+
# @see https://docs.github.com/en/rest/reference/migrations#list-user-migrations
|
366
|
+
def user_migrations(options = {})
|
367
|
+
options = ensure_api_media_type(:migrations, options)
|
368
|
+
paginate "user/migrations", options
|
369
|
+
end
|
370
|
+
|
371
|
+
# Fetches the status of a migration.
|
372
|
+
#
|
373
|
+
# Requires authenticated user.
|
374
|
+
#
|
375
|
+
# @param id [Integer] ID number of the migration.
|
376
|
+
# @see https://docs.github.com/en/rest/reference/migrations#get-a-user-migration-status
|
377
|
+
def user_migration_status(id, options = {})
|
378
|
+
options = ensure_api_media_type(:migrations, options)
|
379
|
+
get "user/migrations/#{id}", options
|
380
|
+
end
|
381
|
+
|
382
|
+
# Fetches the URL to a migration archive.
|
383
|
+
#
|
384
|
+
# Requires authenticated user.
|
385
|
+
#
|
386
|
+
# @param id [Integer] ID number of the migration.
|
387
|
+
# @see https://docs.github.com/en/rest/reference/migrations#download-a-user-migration-archive
|
388
|
+
def user_migration_archive_url(id, options = {})
|
389
|
+
options = ensure_api_media_type(:migrations, options)
|
390
|
+
url = "user/migrations/#{id}/archive"
|
391
|
+
|
392
|
+
response = client_without_redirects(options).get(url)
|
393
|
+
response.headers['location']
|
394
|
+
end
|
395
|
+
|
396
|
+
# Deletes a previous migration archive.
|
397
|
+
#
|
398
|
+
# Requires authenticated user.
|
399
|
+
#
|
400
|
+
# @param id [Integer] ID number of the migration.
|
401
|
+
# @see https://docs.github.com/en/rest/reference/migrations#delete-a-user-migration-archive
|
402
|
+
def delete_user_migration_archive(id, options = {})
|
403
|
+
options = ensure_api_media_type(:migrations, options)
|
404
|
+
delete "user/migrations/#{id}/archive", options
|
405
|
+
end
|
406
|
+
|
407
|
+
# List repositories for a user migration.
|
408
|
+
#
|
409
|
+
# Requires authenticated user.
|
410
|
+
#
|
411
|
+
# @param id [Integer] ID number of the migration.
|
412
|
+
# @see https://docs.github.com/en/rest/reference/migrations#list-repositories-for-a-user-migration
|
413
|
+
def user_migration_repositories(id, options = {})
|
414
|
+
options = ensure_api_media_type(:migrations, options)
|
415
|
+
get "user/migrations/#{id}/repositories", options
|
416
|
+
end
|
417
|
+
|
418
|
+
# Unlock a user repository which has been locked by a migration.
|
419
|
+
#
|
420
|
+
# Requires authenticated user.
|
421
|
+
#
|
422
|
+
# @param id [Integer] ID number of the migration.
|
423
|
+
# @param repo [String] Name of the repository.
|
424
|
+
# @see https://docs.github.com/en/rest/reference/migrations#unlock-a-user-repository
|
425
|
+
def unlock_user_repository(id, repo, options = {})
|
426
|
+
options = ensure_api_media_type(:migrations, options)
|
427
|
+
delete "user/migrations/#{id}/repos/#{repo}/lock", options
|
428
|
+
end
|
342
429
|
end
|
343
430
|
|
344
431
|
private
|
data/lib/octokit/client.rb
CHANGED
@@ -10,9 +10,17 @@ require 'octokit/repository'
|
|
10
10
|
require 'octokit/user'
|
11
11
|
require 'octokit/organization'
|
12
12
|
require 'octokit/preview'
|
13
|
+
require 'octokit/client/actions_secrets'
|
14
|
+
require 'octokit/client/actions_workflows'
|
15
|
+
require 'octokit/client/actions_workflow_runs'
|
16
|
+
require 'octokit/client/apps'
|
13
17
|
require 'octokit/client/authorizations'
|
18
|
+
require 'octokit/client/checks'
|
14
19
|
require 'octokit/client/commits'
|
15
20
|
require 'octokit/client/commit_comments'
|
21
|
+
require 'octokit/client/commit_pulls'
|
22
|
+
require 'octokit/client/commit_branches'
|
23
|
+
require 'octokit/client/community_profile'
|
16
24
|
require 'octokit/client/contents'
|
17
25
|
require 'octokit/client/downloads'
|
18
26
|
require 'octokit/client/deployments'
|
@@ -28,8 +36,10 @@ require 'octokit/client/legacy_search'
|
|
28
36
|
require 'octokit/client/licenses'
|
29
37
|
require 'octokit/client/meta'
|
30
38
|
require 'octokit/client/markdown'
|
39
|
+
require 'octokit/client/marketplace'
|
31
40
|
require 'octokit/client/milestones'
|
32
41
|
require 'octokit/client/notifications'
|
42
|
+
require 'octokit/client/oauth_applications'
|
33
43
|
require 'octokit/client/objects'
|
34
44
|
require 'octokit/client/organizations'
|
35
45
|
require 'octokit/client/pages'
|
@@ -42,6 +52,7 @@ require 'octokit/client/refs'
|
|
42
52
|
require 'octokit/client/releases'
|
43
53
|
require 'octokit/client/repositories'
|
44
54
|
require 'octokit/client/repository_invitations'
|
55
|
+
require 'octokit/client/reviews'
|
45
56
|
require 'octokit/client/say'
|
46
57
|
require 'octokit/client/search'
|
47
58
|
require 'octokit/client/service_status'
|
@@ -50,6 +61,7 @@ require 'octokit/client/stats'
|
|
50
61
|
require 'octokit/client/statuses'
|
51
62
|
require 'octokit/client/traffic'
|
52
63
|
require 'octokit/client/users'
|
64
|
+
require 'ext/sawyer/relation'
|
53
65
|
|
54
66
|
module Octokit
|
55
67
|
|
@@ -63,9 +75,14 @@ module Octokit
|
|
63
75
|
include Octokit::Connection
|
64
76
|
include Octokit::Preview
|
65
77
|
include Octokit::Warnable
|
78
|
+
include Octokit::Client::ActionsSecrets
|
66
79
|
include Octokit::Client::Authorizations
|
80
|
+
include Octokit::Client::Checks
|
67
81
|
include Octokit::Client::Commits
|
68
82
|
include Octokit::Client::CommitComments
|
83
|
+
include Octokit::Client::CommitPulls
|
84
|
+
include Octokit::Client::CommitBranches
|
85
|
+
include Octokit::Client::CommunityProfile
|
69
86
|
include Octokit::Client::Contents
|
70
87
|
include Octokit::Client::Deployments
|
71
88
|
include Octokit::Client::Downloads
|
@@ -75,14 +92,19 @@ module Octokit
|
|
75
92
|
include Octokit::Client::Gists
|
76
93
|
include Octokit::Client::Gitignore
|
77
94
|
include Octokit::Client::Hooks
|
95
|
+
include Octokit::Client::ActionsWorkflows
|
96
|
+
include Octokit::Client::ActionsWorkflowRuns
|
97
|
+
include Octokit::Client::Apps
|
78
98
|
include Octokit::Client::Issues
|
79
99
|
include Octokit::Client::Labels
|
80
100
|
include Octokit::Client::LegacySearch
|
81
101
|
include Octokit::Client::Licenses
|
82
102
|
include Octokit::Client::Meta
|
83
103
|
include Octokit::Client::Markdown
|
104
|
+
include Octokit::Client::Marketplace
|
84
105
|
include Octokit::Client::Milestones
|
85
106
|
include Octokit::Client::Notifications
|
107
|
+
include Octokit::Client::OauthApplications
|
86
108
|
include Octokit::Client::Objects
|
87
109
|
include Octokit::Client::Organizations
|
88
110
|
include Octokit::Client::Pages
|
@@ -95,6 +117,7 @@ module Octokit
|
|
95
117
|
include Octokit::Client::Releases
|
96
118
|
include Octokit::Client::Repositories
|
97
119
|
include Octokit::Client::RepositoryInvitations
|
120
|
+
include Octokit::Client::Reviews
|
98
121
|
include Octokit::Client::Say
|
99
122
|
include Octokit::Client::Search
|
100
123
|
include Octokit::Client::ServiceStatus
|
@@ -110,7 +133,8 @@ module Octokit
|
|
110
133
|
def initialize(options = {})
|
111
134
|
# Use options passed in, but fall back to module defaults
|
112
135
|
Octokit::Configurable.keys.each do |key|
|
113
|
-
|
136
|
+
value = options.key?(key) ? options[key] : Octokit.instance_variable_get(:"@#{key}")
|
137
|
+
instance_variable_set(:"@#{key}", value)
|
114
138
|
end
|
115
139
|
|
116
140
|
login_from_netrc unless user_authenticated? || application_authenticated?
|
@@ -123,15 +147,12 @@ module Octokit
|
|
123
147
|
inspected = super
|
124
148
|
|
125
149
|
# mask password
|
126
|
-
inspected
|
127
|
-
inspected
|
150
|
+
inspected.gsub! @password, '*******' if @password
|
151
|
+
inspected.gsub! @management_console_password, '*******' if @management_console_password
|
152
|
+
inspected.gsub! @bearer_token, '********' if @bearer_token
|
128
153
|
# Only show last 4 of token, secret
|
129
|
-
if @access_token
|
130
|
-
|
131
|
-
end
|
132
|
-
if @client_secret
|
133
|
-
inspected = inspected.gsub! @client_secret, "#{'*'*36}#{@client_secret[36..-1]}"
|
134
|
-
end
|
154
|
+
inspected.gsub! @access_token, "#{'*'*36}#{@access_token[36..-1]}" if @access_token
|
155
|
+
inspected.gsub! @client_secret, "#{'*'*36}#{@client_secret[36..-1]}" if @client_secret
|
135
156
|
|
136
157
|
inspected
|
137
158
|
end
|
@@ -185,6 +206,14 @@ module Octokit
|
|
185
206
|
@access_token = value
|
186
207
|
end
|
187
208
|
|
209
|
+
# Set Bearer Token for authentication
|
210
|
+
#
|
211
|
+
# @param value [String] JWT
|
212
|
+
def bearer_token=(value)
|
213
|
+
reset_agent
|
214
|
+
@bearer_token = value
|
215
|
+
end
|
216
|
+
|
188
217
|
# Set OAuth app client_id
|
189
218
|
#
|
190
219
|
# @param value [String] 20 character GitHub OAuth app client_id
|
@@ -206,11 +235,14 @@ module Octokit
|
|
206
235
|
conn_opts[:url] = @api_endpoint
|
207
236
|
conn_opts[:builder] = @middleware.dup if @middleware
|
208
237
|
conn_opts[:proxy] = @proxy if @proxy
|
238
|
+
conn_opts[:ssl] = { :verify_mode => @ssl_verify_mode } if @ssl_verify_mode
|
209
239
|
conn = Faraday.new(conn_opts) do |http|
|
210
240
|
if basic_authenticated?
|
211
241
|
http.basic_auth(@login, @password)
|
212
242
|
elsif token_authenticated?
|
213
243
|
http.authorization 'token', @access_token
|
244
|
+
elsif bearer_authenticated?
|
245
|
+
http.authorization 'Bearer', @bearer_token
|
214
246
|
end
|
215
247
|
http.headers['accept'] = options[:accept] if options.key?(:accept)
|
216
248
|
end
|
data/lib/octokit/configurable.rb
CHANGED
@@ -10,6 +10,9 @@ module Octokit
|
|
10
10
|
# @return [String] Base URL for API requests. default: https://api.github.com/
|
11
11
|
# @!attribute auto_paginate
|
12
12
|
# @return [Boolean] Auto fetch next page of results until rate limit reached
|
13
|
+
# @!attribute [w] bearer_token
|
14
|
+
# @see https://developer.github.com/early-access/integrations/authentication/#as-an-integration
|
15
|
+
# @return [String] JWT bearer token for authentication
|
13
16
|
# @!attribute client_id
|
14
17
|
# @see https://developer.github.com/v3/oauth/
|
15
18
|
# @return [String] Configure OAuth app key
|
@@ -42,15 +45,18 @@ module Octokit
|
|
42
45
|
# @!attribute proxy
|
43
46
|
# @see https://github.com/lostisland/faraday
|
44
47
|
# @return [String] URI for proxy server
|
48
|
+
# @!attribute ssl_verify_mode
|
49
|
+
# @see https://github.com/lostisland/faraday
|
50
|
+
# @return [String] SSL verify mode for ssl connections
|
45
51
|
# @!attribute user_agent
|
46
52
|
# @return [String] Configure User-Agent header for requests.
|
47
53
|
# @!attribute web_endpoint
|
48
54
|
# @return [String] Base URL for web URLs. default: https://github.com/
|
49
55
|
|
50
|
-
attr_accessor :access_token, :auto_paginate, :client_id,
|
56
|
+
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id,
|
51
57
|
:client_secret, :default_media_type, :connection_options,
|
52
58
|
:middleware, :netrc, :netrc_file,
|
53
|
-
:per_page, :proxy, :user_agent
|
59
|
+
:per_page, :proxy, :ssl_verify_mode, :user_agent
|
54
60
|
attr_writer :password, :web_endpoint, :api_endpoint, :login,
|
55
61
|
:management_console_endpoint, :management_console_password
|
56
62
|
|
@@ -63,6 +69,7 @@ module Octokit
|
|
63
69
|
:access_token,
|
64
70
|
:api_endpoint,
|
65
71
|
:auto_paginate,
|
72
|
+
:bearer_token,
|
66
73
|
:client_id,
|
67
74
|
:client_secret,
|
68
75
|
:connection_options,
|
@@ -76,6 +83,7 @@ module Octokit
|
|
76
83
|
:per_page,
|
77
84
|
:password,
|
78
85
|
:proxy,
|
86
|
+
:ssl_verify_mode,
|
79
87
|
:user_agent,
|
80
88
|
:web_endpoint
|
81
89
|
]
|
data/lib/octokit/connection.rb
CHANGED
@@ -76,7 +76,7 @@ module Octokit
|
|
76
76
|
# contains the latest response.
|
77
77
|
# @return [Sawyer::Resource]
|
78
78
|
def paginate(url, options = {}, &block)
|
79
|
-
opts = parse_query_and_convenience_headers(options
|
79
|
+
opts = parse_query_and_convenience_headers(options)
|
80
80
|
if @auto_paginate || @per_page
|
81
81
|
opts[:query][:per_page] ||= @per_page || (@auto_paginate ? 100 : nil)
|
82
82
|
end
|
@@ -110,8 +110,10 @@ module Octokit
|
|
110
110
|
http.basic_auth(@login, @password)
|
111
111
|
elsif token_authenticated?
|
112
112
|
http.authorization 'token', @access_token
|
113
|
+
elsif bearer_authenticated?
|
114
|
+
http.authorization 'Bearer', @bearer_token
|
113
115
|
elsif application_authenticated?
|
114
|
-
http.
|
116
|
+
http.basic_auth(@client_id, @client_secret)
|
115
117
|
end
|
116
118
|
end
|
117
119
|
end
|
@@ -151,8 +153,11 @@ module Octokit
|
|
151
153
|
end
|
152
154
|
end
|
153
155
|
|
154
|
-
@last_response = response = agent.call(method, URI
|
156
|
+
@last_response = response = agent.call(method, Addressable::URI.parse(path.to_s).normalize.to_s, data, options)
|
155
157
|
response.data
|
158
|
+
rescue Octokit::Error => error
|
159
|
+
@last_response = nil
|
160
|
+
raise error
|
156
161
|
end
|
157
162
|
|
158
163
|
# Executes the request, checking if it was successful
|
@@ -160,7 +165,7 @@ module Octokit
|
|
160
165
|
# @return [Boolean] True on success, false otherwise
|
161
166
|
def boolean_from_response(method, path, options = {})
|
162
167
|
request(method, path, options)
|
163
|
-
@last_response.status
|
168
|
+
[201, 202, 204].include? @last_response.status
|
164
169
|
rescue Octokit::NotFound
|
165
170
|
false
|
166
171
|
end
|
@@ -173,12 +178,22 @@ module Octokit
|
|
173
178
|
conn_opts = @connection_options
|
174
179
|
conn_opts[:builder] = @middleware if @middleware
|
175
180
|
conn_opts[:proxy] = @proxy if @proxy
|
181
|
+
if conn_opts[:ssl].nil?
|
182
|
+
conn_opts[:ssl] = { :verify_mode => @ssl_verify_mode } if @ssl_verify_mode
|
183
|
+
else
|
184
|
+
verify = @connection_options[:ssl][:verify]
|
185
|
+
conn_opts[:ssl] = {
|
186
|
+
:verify => verify,
|
187
|
+
:verify_mode => verify == false ? 0 : @ssl_verify_mode
|
188
|
+
}
|
189
|
+
end
|
176
190
|
opts[:faraday] = Faraday.new(conn_opts)
|
177
191
|
|
178
192
|
opts
|
179
193
|
end
|
180
194
|
|
181
195
|
def parse_query_and_convenience_headers(options)
|
196
|
+
options = options.dup
|
182
197
|
headers = options.delete(:headers) { Hash.new }
|
183
198
|
CONVENIENCE_HEADERS.each do |h|
|
184
199
|
if header = options.delete(h)
|
data/lib/octokit/default.rb
CHANGED
@@ -25,6 +25,7 @@ module Octokit
|
|
25
25
|
|
26
26
|
# Default Faraday middleware stack
|
27
27
|
MIDDLEWARE = RACK_BUILDER_CLASS.new do |builder|
|
28
|
+
builder.use Faraday::Request::Retry, exceptions: [Octokit::ServerError]
|
28
29
|
builder.use Octokit::Middleware::FollowRedirects
|
29
30
|
builder.use Octokit::Response::RaiseError
|
30
31
|
builder.use Octokit::Response::FeedParser
|
@@ -57,6 +58,12 @@ module Octokit
|
|
57
58
|
ENV['OCTOKIT_AUTO_PAGINATE']
|
58
59
|
end
|
59
60
|
|
61
|
+
# Default bearer token from ENV
|
62
|
+
# @return [String]
|
63
|
+
def bearer_token
|
64
|
+
ENV['OCTOKIT_BEARER_TOKEN']
|
65
|
+
end
|
66
|
+
|
60
67
|
# Default OAuth app key from ENV
|
61
68
|
# @return [String]
|
62
69
|
def client_id
|
@@ -118,7 +125,7 @@ module Octokit
|
|
118
125
|
end
|
119
126
|
|
120
127
|
# Default pagination page size from ENV
|
121
|
-
# @return [
|
128
|
+
# @return [Integer] Page size
|
122
129
|
def per_page
|
123
130
|
page_size = ENV['OCTOKIT_PER_PAGE']
|
124
131
|
|
@@ -131,6 +138,15 @@ module Octokit
|
|
131
138
|
ENV['OCTOKIT_PROXY']
|
132
139
|
end
|
133
140
|
|
141
|
+
# Default SSL verify mode from ENV
|
142
|
+
# @return [Integer]
|
143
|
+
def ssl_verify_mode
|
144
|
+
# 0 is OpenSSL::SSL::VERIFY_NONE
|
145
|
+
# 1 is OpenSSL::SSL::SSL_VERIFY_PEER
|
146
|
+
# the standard default for SSL is SSL_VERIFY_PEER which requires a server certificate check on the client
|
147
|
+
ENV.fetch('OCTOKIT_SSL_VERIFY_MODE', 1).to_i
|
148
|
+
end
|
149
|
+
|
134
150
|
# Default User-Agent header string from ENV or {USER_AGENT}
|
135
151
|
# @return [String]
|
136
152
|
def user_agent
|
@@ -3,7 +3,7 @@ module Octokit
|
|
3
3
|
|
4
4
|
# Methods for the Enterprise Orgs API
|
5
5
|
#
|
6
|
-
# @see https://developer.github.com/v3/enterprise/orgs/
|
6
|
+
# @see https://developer.github.com/v3/enterprise-admin/orgs/
|
7
7
|
module Orgs
|
8
8
|
|
9
9
|
# Create a new organization on the instance.
|
@@ -13,7 +13,7 @@ module Octokit
|
|
13
13
|
# @param options [Hash] A set of options.
|
14
14
|
# @option options [String] :profile_name The organization's display name.
|
15
15
|
# @return [nil]
|
16
|
-
# @see https://developer.github.com/v3/enterprise/orgs/#create-an-organization
|
16
|
+
# @see https://developer.github.com/v3/enterprise-admin/orgs/#create-an-organization
|
17
17
|
# @example
|
18
18
|
# @admin_client.create_organization('SuchAGreatOrg', 'gjtorikian')
|
19
19
|
def create_organization(login, admin, options = {})
|
@@ -3,7 +3,7 @@ module Octokit
|
|
3
3
|
|
4
4
|
# Methods for the Enterprise Search Indexing API
|
5
5
|
#
|
6
|
-
# @see https://developer.github.com/v3/enterprise/search_indexing/
|
6
|
+
# @see https://developer.github.com/v3/enterprise-admin/search_indexing/
|
7
7
|
module SearchIndexing
|
8
8
|
|
9
9
|
# Queue a User or Organization to be indexed
|
@@ -3,13 +3,13 @@ module Octokit
|
|
3
3
|
|
4
4
|
# Methods for the Enterprise User Administration API
|
5
5
|
#
|
6
|
-
# @see https://developer.github.com/v3/users/
|
6
|
+
# @see https://developer.github.com/enterprise/v3/enterprise-admin/users/
|
7
7
|
module Users
|
8
8
|
# Create a new user.
|
9
9
|
#
|
10
10
|
# @param login [String] The user's username.
|
11
11
|
# @param email [String] The user's email address.
|
12
|
-
# @see https://developer.github.com/v3/users
|
12
|
+
# @see https://developer.github.com/enterprise/v3/enterprise-admin/users#create-a-new-user
|
13
13
|
# @example
|
14
14
|
# @admin_client.create_user('foobar', 'notreal@foo.bar')
|
15
15
|
def create_user(login, email, options = {})
|
@@ -22,7 +22,7 @@ module Octokit
|
|
22
22
|
#
|
23
23
|
# @param user [String] Username of the user to promote.
|
24
24
|
# @return [Boolean] True if promote was successful, false otherwise.
|
25
|
-
# @see https://developer.github.com/v3/users
|
25
|
+
# @see https://developer.github.com/enterprise/v3/enterprise-admin/users/#promote-an-ordinary-user-to-a-site-administrator
|
26
26
|
# @example
|
27
27
|
# @admin_client.promote('holman')
|
28
28
|
def promote(user, options = {})
|
@@ -33,7 +33,7 @@ module Octokit
|
|
33
33
|
#
|
34
34
|
# @param user [String] Username of the user to demote.
|
35
35
|
# @return [Boolean] True if demote was successful, false otherwise.
|
36
|
-
# @see https://developer.github.com/v3/users
|
36
|
+
# @see https://developer.github.com/enterprise/v3/enterprise-admin/users/#demote-a-site-administrator-to-an-ordinary-user
|
37
37
|
# @example
|
38
38
|
# @admin_client.demote('holman')
|
39
39
|
def demote(user, options = {})
|
@@ -44,7 +44,7 @@ module Octokit
|
|
44
44
|
#
|
45
45
|
# @param old_login [String] The user's old username.
|
46
46
|
# @param new_login [String] The user's new username.
|
47
|
-
# @see https://developer.github.com/v3/users
|
47
|
+
# @see https://developer.github.com/enterprise/v3/enterprise-admin/users/#rename-an-existing-user
|
48
48
|
# @example
|
49
49
|
# @admin_client.rename_user('foobar', 'foofoobar')
|
50
50
|
def rename_user(old_login, new_login, options = {})
|
@@ -55,7 +55,7 @@ module Octokit
|
|
55
55
|
# Deletes a user.
|
56
56
|
#
|
57
57
|
# @param username [String] The username to delete.
|
58
|
-
# @see https://developer.github.com/v3/users
|
58
|
+
# @see https://developer.github.com/enterprise/v3/enterprise-admin/users/#delete-a-user
|
59
59
|
# @example
|
60
60
|
# @admin_client.delete_key(1)
|
61
61
|
def delete_user(username, options = {})
|
@@ -66,7 +66,7 @@ module Octokit
|
|
66
66
|
#
|
67
67
|
# @param user [String] Username of the user to suspend.
|
68
68
|
# @return [Boolean] True if suspend was successful, false otherwise.
|
69
|
-
# @see https://developer.github.com/v3/users
|
69
|
+
# @see https://developer.github.com/enterprise/v3/enterprise-admin/users/#suspend-a-user
|
70
70
|
# @example
|
71
71
|
# @admin_client.suspend('holman')
|
72
72
|
def suspend(user, options = {})
|
@@ -77,7 +77,7 @@ module Octokit
|
|
77
77
|
#
|
78
78
|
# @param user [String] Username of the user to unsuspend.
|
79
79
|
# @return [Boolean] True if unsuspend was successful, false otherwise.
|
80
|
-
# @see https://developer.github.com/v3/users
|
80
|
+
# @see https://developer.github.com/enterprise/v3/enterprise-admin/users/#unsuspend-a-user
|
81
81
|
# @example
|
82
82
|
# @admin_client.unsuspend('holman')
|
83
83
|
def unsuspend(user, options = {})
|
@@ -88,7 +88,7 @@ module Octokit
|
|
88
88
|
#
|
89
89
|
# @param login [String] The user to create a token for.
|
90
90
|
# @param options [Array<String>] :scopes The scopes to apply.
|
91
|
-
# @see https://developer.github.com/v3/users
|
91
|
+
# @see https://developer.github.com/enterprise/v3/enterprise-admin/users/#create-an-impersonation-oauth-token
|
92
92
|
# @example
|
93
93
|
# @admin_client.create_impersonation_token('foobar', {:scopes => ['repo:write']})
|
94
94
|
def create_impersonation_token(login, options = {})
|
@@ -98,7 +98,7 @@ module Octokit
|
|
98
98
|
# Deletes an impersonation OAuth token.
|
99
99
|
#
|
100
100
|
# @param login [String] The user whose token should be deleted.
|
101
|
-
# @see https://developer.github.com/v3/users
|
101
|
+
# @see https://developer.github.com/enterprise/v3/enterprise-admin/users/#delete-an-impersonation-oauth-token
|
102
102
|
# @example
|
103
103
|
# @admin_client.delete_impersonation_token('foobar')
|
104
104
|
def delete_impersonation_token(login, options = {})
|
@@ -107,7 +107,7 @@ module Octokit
|
|
107
107
|
|
108
108
|
# Lists all the public SSH keys.
|
109
109
|
#
|
110
|
-
# @see https://developer.github.com/v3/users
|
110
|
+
# @see https://developer.github.com/enterprise/v3/enterprise-admin/users/#list-all-public-keys
|
111
111
|
# @example
|
112
112
|
# @admin_client.list_all_keys
|
113
113
|
def list_all_keys(options = {})
|
@@ -117,7 +117,7 @@ module Octokit
|
|
117
117
|
# Deletes a public SSH keys.
|
118
118
|
#
|
119
119
|
# @param id [Number] The ID of the key to delete.
|
120
|
-
# @see https://developer.github.com/v3/users
|
120
|
+
# @see https://developer.github.com/enterprise/v3/enterprise-admin/users/#delete-a-public-key
|
121
121
|
# @example
|
122
122
|
# @admin_client.delete_key(1)
|
123
123
|
def delete_key(id, options = {})
|
@@ -3,7 +3,7 @@ module Octokit
|
|
3
3
|
|
4
4
|
# Methods for the Enterprise Management Console API
|
5
5
|
#
|
6
|
-
# @see https://developer.github.com/v3/enterprise/management_console
|
6
|
+
# @see https://developer.github.com/v3/enterprise-admin/management_console/
|
7
7
|
module ManagementConsole
|
8
8
|
|
9
9
|
# Uploads a license for the first time
|
@@ -10,7 +10,7 @@ module Octokit
|
|
10
10
|
#
|
11
11
|
# @see Octokit::Client Use Octokit::Client for regular API use for GitHub
|
12
12
|
# and GitHub Enterprise.
|
13
|
-
# @see https://developer.github.com/v3/enterprise/management_console/
|
13
|
+
# @see https://developer.github.com/v3/enterprise-admin/management_console/
|
14
14
|
class EnterpriseManagementConsoleClient
|
15
15
|
|
16
16
|
include Octokit::Configurable
|