octokit 4.7.0 → 4.8.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 +4 -4
- data/LICENSE.md +1 -1
- data/README.md +28 -2
- data/lib/octokit/client.rb +4 -2
- data/lib/octokit/client/apps.rb +164 -0
- data/lib/octokit/client/issues.rb +13 -0
- data/lib/octokit/client/licenses.rb +1 -1
- data/lib/octokit/client/marketplace.rb +60 -0
- data/lib/octokit/client/notifications.rb +0 -4
- data/lib/octokit/client/organizations.rb +23 -6
- data/lib/octokit/client/repositories.rb +1 -2
- data/lib/octokit/client/reviews.rb +3 -12
- data/lib/octokit/error.rb +14 -0
- data/lib/octokit/preview.rb +4 -3
- data/lib/octokit/repository.rb +10 -8
- data/lib/octokit/version.rb +1 -1
- metadata +5 -5
- data/lib/octokit/client/integrations.rb +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f3b264edbac32970be83bf7b14081732f130d12
|
4
|
+
data.tar.gz: 15af8a2c6a80cfe94fdd14bb56a68dfbc772cb45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a77fc4d18fbc0dac671774e2486ba93aee5a434490db33579afa768a0386fbf12fcc251ff19fa514fa4f0bf564c643538b6b6a33360311bd05d789bfa6914e0
|
7
|
+
data.tar.gz: 134a0f49e4ade9f5b0ffc377b9394d4597c6fe69a871d27b2c90912024b4cd52ab1efc7de6019fcf3140fb756a2a9023f1fa742443227f63888113217ede8a16
|
data/LICENSE.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2009-
|
1
|
+
Copyright (c) 2009-2017 Wynn Netherland, Adam Stacoviak, Erik Michaels-Ober
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -96,6 +96,21 @@ client = Octokit::Client.new(:login => 'defunkt', :password => 'c0d3b4ssssss!')
|
|
96
96
|
client.user
|
97
97
|
```
|
98
98
|
|
99
|
+
### Additional Query Parameters
|
100
|
+
|
101
|
+
When passing additional parameters to GET based request use the following syntax:
|
102
|
+
|
103
|
+
```ruby
|
104
|
+
# query: { parameter_name: 'value' }
|
105
|
+
# Example: Get repository listing by owner in ascending order
|
106
|
+
client.repos({}, query: {type: 'owner', sort: 'asc'})
|
107
|
+
|
108
|
+
# Example: Get contents of a repository by ref
|
109
|
+
# https://api.github.com/repos/octokit/octokit.rb/contents/path/to/file.rb?ref=some-other-branch
|
110
|
+
client.contents('octokit/octokit.rb', path: 'path/to/file.rb', query: {ref: 'some-other-branch'})
|
111
|
+
|
112
|
+
```
|
113
|
+
|
99
114
|
[API methods]: http://octokit.github.io/octokit.rb/method_list.html
|
100
115
|
|
101
116
|
### Consuming resources
|
@@ -262,6 +277,14 @@ user = client.user 'defunkt'
|
|
262
277
|
[access scopes]: http://developer.github.com/v3/oauth/#scopes
|
263
278
|
[app-creds]: http://developer.github.com/v3/#increasing-the-unauthenticated-rate-limit-for-oauth-applications
|
264
279
|
|
280
|
+
## Default results per_page
|
281
|
+
|
282
|
+
Default results from the GitHub API are 30, if you wish to add more you must do so during Octokit configuration.
|
283
|
+
|
284
|
+
```ruby
|
285
|
+
Octokit::Client.new(access_token: "<your 40 char token>", per_page: 100)
|
286
|
+
```
|
287
|
+
|
265
288
|
## Pagination
|
266
289
|
|
267
290
|
Many GitHub API resources are [paginated][]. While you may be tempted to start
|
@@ -270,7 +293,7 @@ previous, and last pages for you in the `Link` response header as [Hypermedia
|
|
270
293
|
link relations](#hypermedia-agent).
|
271
294
|
|
272
295
|
```ruby
|
273
|
-
issues = Octokit.issues 'rails/rails'
|
296
|
+
issues = Octokit.issues 'rails/rails'
|
274
297
|
issues.concat Octokit.last_response.rels[:next].get.data
|
275
298
|
```
|
276
299
|
|
@@ -526,8 +549,10 @@ traffic:
|
|
526
549
|
|
527
550
|
```ruby
|
528
551
|
stack = Faraday::RackBuilder.new do |builder|
|
529
|
-
builder.
|
552
|
+
builder.use Octokit::Middleware::FollowRedirects
|
530
553
|
builder.use Octokit::Response::RaiseError
|
554
|
+
builder.use Octokit::Response::FeedParser
|
555
|
+
builder.response :logger
|
531
556
|
builder.adapter Faraday.default_adapter
|
532
557
|
end
|
533
558
|
Octokit.middleware = stack
|
@@ -655,6 +680,7 @@ implementations:
|
|
655
680
|
* Ruby 2.1
|
656
681
|
* Ruby 2.2
|
657
682
|
* Ruby 2.3
|
683
|
+
* Ruby 2.4
|
658
684
|
|
659
685
|
If something doesn't work on one of these Ruby versions, it's a bug.
|
660
686
|
|
data/lib/octokit/client.rb
CHANGED
@@ -10,6 +10,7 @@ require 'octokit/repository'
|
|
10
10
|
require 'octokit/user'
|
11
11
|
require 'octokit/organization'
|
12
12
|
require 'octokit/preview'
|
13
|
+
require 'octokit/client/apps'
|
13
14
|
require 'octokit/client/authorizations'
|
14
15
|
require 'octokit/client/commits'
|
15
16
|
require 'octokit/client/commit_comments'
|
@@ -22,13 +23,13 @@ require 'octokit/client/feeds'
|
|
22
23
|
require 'octokit/client/gists'
|
23
24
|
require 'octokit/client/gitignore'
|
24
25
|
require 'octokit/client/hooks'
|
25
|
-
require 'octokit/client/integrations'
|
26
26
|
require 'octokit/client/issues'
|
27
27
|
require 'octokit/client/labels'
|
28
28
|
require 'octokit/client/legacy_search'
|
29
29
|
require 'octokit/client/licenses'
|
30
30
|
require 'octokit/client/meta'
|
31
31
|
require 'octokit/client/markdown'
|
32
|
+
require 'octokit/client/marketplace'
|
32
33
|
require 'octokit/client/milestones'
|
33
34
|
require 'octokit/client/notifications'
|
34
35
|
require 'octokit/client/objects'
|
@@ -78,13 +79,14 @@ module Octokit
|
|
78
79
|
include Octokit::Client::Gists
|
79
80
|
include Octokit::Client::Gitignore
|
80
81
|
include Octokit::Client::Hooks
|
81
|
-
include Octokit::Client::
|
82
|
+
include Octokit::Client::Apps
|
82
83
|
include Octokit::Client::Issues
|
83
84
|
include Octokit::Client::Labels
|
84
85
|
include Octokit::Client::LegacySearch
|
85
86
|
include Octokit::Client::Licenses
|
86
87
|
include Octokit::Client::Meta
|
87
88
|
include Octokit::Client::Markdown
|
89
|
+
include Octokit::Client::Marketplace
|
88
90
|
include Octokit::Client::Milestones
|
89
91
|
include Octokit::Client::Notifications
|
90
92
|
include Octokit::Client::Objects
|
@@ -0,0 +1,164 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Apps API
|
5
|
+
module Apps
|
6
|
+
|
7
|
+
# Find all installations that belong to an App
|
8
|
+
#
|
9
|
+
# @param options [Hash] A customizable set of options
|
10
|
+
#
|
11
|
+
# @see https://developer.github.com/v3/apps/#find-installations
|
12
|
+
#
|
13
|
+
# @return [Array<Sawyer::Resource>] A list of installations
|
14
|
+
def find_app_installations(options = {})
|
15
|
+
opts = ensure_api_media_type(:integrations, options)
|
16
|
+
paginate "app/installations", opts
|
17
|
+
end
|
18
|
+
alias find_installations find_app_installations
|
19
|
+
|
20
|
+
def find_integration_installations(options = {})
|
21
|
+
octokit_warn(
|
22
|
+
"Deprecated: Octokit::Client::Apps#find_integration_installations "\
|
23
|
+
"method is deprecated. Please update your call to use "\
|
24
|
+
"Octokit::Client::Apps#find_app_installations before the next major "\
|
25
|
+
"Octokit version update."
|
26
|
+
)
|
27
|
+
find_app_installations(options)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Find all installations that are accessible to the authenticated user
|
31
|
+
#
|
32
|
+
# @param options [Hash] A customizable set of options
|
33
|
+
#
|
34
|
+
# @see https://developer.github.com/v3/apps/#list-installations-for-user
|
35
|
+
#
|
36
|
+
# @return [Array<Sawyer::Resource>] A list of installations
|
37
|
+
def find_user_installations(options = {})
|
38
|
+
opts = ensure_api_media_type(:integrations, options)
|
39
|
+
paginate "user/installations", opts
|
40
|
+
end
|
41
|
+
|
42
|
+
# Get a single installation
|
43
|
+
#
|
44
|
+
# @param id [Integer] Installation id
|
45
|
+
#
|
46
|
+
# @see https://developer.github.com/v3/apps/#get-a-single-installation
|
47
|
+
#
|
48
|
+
# @return [Sawyer::Resource] Installation information
|
49
|
+
def installation(id, options = {})
|
50
|
+
opts = ensure_api_media_type(:integrations, options)
|
51
|
+
get "app/installations/#{id}", opts
|
52
|
+
end
|
53
|
+
|
54
|
+
# Create a new installation token
|
55
|
+
#
|
56
|
+
# @param installation [Integer] The id of a GitHub App Installation
|
57
|
+
# @param options [Hash] A customizable set of options
|
58
|
+
#
|
59
|
+
# @see https://developer.github.com/v3/apps/#find-installations
|
60
|
+
#
|
61
|
+
# @return [<Sawyer::Resource>] An installation token
|
62
|
+
def create_app_installation_access_token(installation, options = {})
|
63
|
+
opts = ensure_api_media_type(:integrations, options)
|
64
|
+
post "installations/#{installation}/access_tokens", opts
|
65
|
+
end
|
66
|
+
alias create_installation_access_token create_app_installation_access_token
|
67
|
+
|
68
|
+
def create_integration_installation_access_token(installation, options = {})
|
69
|
+
octokit_warn(
|
70
|
+
"Deprecated: Octokit::Client::Apps#create_integration_installation_access_token "\
|
71
|
+
"method is deprecated. Please update your call to use "\
|
72
|
+
"Octokit::Client::Apps#create_app_installation_access_token before the next major "\
|
73
|
+
"Octokit version update."
|
74
|
+
)
|
75
|
+
create_app_installation_access_token(installation, options)
|
76
|
+
end
|
77
|
+
|
78
|
+
# List repositories that are accessible to the authenticated installation
|
79
|
+
#
|
80
|
+
# @param options [Hash] A customizable set of options
|
81
|
+
# @see https://developer.github.com/v3/apps/installations/#list-repositories
|
82
|
+
#
|
83
|
+
# @return [Array<Sawyer::Resource>] A list of repositories
|
84
|
+
def list_app_installation_repositories(options = {})
|
85
|
+
opts = ensure_api_media_type(:integrations, options)
|
86
|
+
paginate "installation/repositories", opts
|
87
|
+
end
|
88
|
+
alias list_installation_repos list_app_installation_repositories
|
89
|
+
|
90
|
+
def list_integration_installation_repositories(options = {})
|
91
|
+
octokit_warn(
|
92
|
+
"Deprecated: Octokit::Client::Apps#list_integration_installation_repositories "\
|
93
|
+
"method is deprecated. Please update your call to use "\
|
94
|
+
"Octokit::Client::Apps#list_app_installation_repositories before the next major "\
|
95
|
+
"Octokit version update."
|
96
|
+
)
|
97
|
+
list_app_installation_repositories(options)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Add a single repository to an installation
|
101
|
+
#
|
102
|
+
# @param installation [Integer] The id of a GitHub App Installation
|
103
|
+
# @param repo [Integer] The id of the GitHub repository
|
104
|
+
# @param options [Hash] A customizable set of options
|
105
|
+
#
|
106
|
+
# @see https://developer.github.com/v3/apps/installations/#add-repository-to-installation
|
107
|
+
#
|
108
|
+
# @return [Boolean] Success
|
109
|
+
def add_repository_to_app_installation(installation, repo, options = {})
|
110
|
+
opts = ensure_api_media_type(:integrations, options)
|
111
|
+
boolean_from_response :put, "user/installations/#{installation}/repositories/#{repo}", opts
|
112
|
+
end
|
113
|
+
alias add_repo_to_installation add_repository_to_app_installation
|
114
|
+
|
115
|
+
def add_repository_to_integration_installation(installation, repo, options = {})
|
116
|
+
octokit_warn(
|
117
|
+
"Deprecated: Octokit::Client::Apps#add_repository_to_integration_installation "\
|
118
|
+
"method is deprecated. Please update your call to use "\
|
119
|
+
"Octokit::Client::Apps#add_repository_to_app_installation before the next major "\
|
120
|
+
"Octokit version update."
|
121
|
+
)
|
122
|
+
add_repository_to_app_installation(installation, repo, options)
|
123
|
+
end
|
124
|
+
|
125
|
+
# Remove a single repository to an installation
|
126
|
+
#
|
127
|
+
# @param installation [Integer] The id of a GitHub App Installation
|
128
|
+
# @param repo [Integer] The id of the GitHub repository
|
129
|
+
# @param options [Hash] A customizable set of options
|
130
|
+
#
|
131
|
+
# @see https://developer.github.com/v3/apps/installations/#remove-repository-from-installation
|
132
|
+
#
|
133
|
+
# @return [Boolean] Success
|
134
|
+
def remove_repository_from_app_installation(installation, repo, options = {})
|
135
|
+
opts = ensure_api_media_type(:integrations, options)
|
136
|
+
boolean_from_response :delete, "user/installations/#{installation}/repositories/#{repo}", opts
|
137
|
+
end
|
138
|
+
alias remove_repo_from_installation remove_repository_from_app_installation
|
139
|
+
|
140
|
+
def remove_repository_from_integration_installation(installation, repo, options = {})
|
141
|
+
octokit_warn(
|
142
|
+
"Deprecated: Octokit::Client::Apps#remove_repository_from_integration_installation "\
|
143
|
+
"method is deprecated. Please update your call to use "\
|
144
|
+
"Octokit::Client::Apps#remove_repository_from_app_installation before the next major "\
|
145
|
+
"Octokit version update."
|
146
|
+
)
|
147
|
+
remove_repository_from_app_installation(installation, repo, options)
|
148
|
+
end
|
149
|
+
|
150
|
+
# List repositories accessible to the user for an installation
|
151
|
+
#
|
152
|
+
# @param installation [Integer] The id of a GitHub App Installation
|
153
|
+
# @param options [Hash] A customizable set of options
|
154
|
+
#
|
155
|
+
# @see https://developer.github.com/apps/building-integrations/setting-up-and-registering-github-apps/identifying-users-for-github-apps/
|
156
|
+
#
|
157
|
+
# @return [Array<Sawyer::Resource>] A list of repositories
|
158
|
+
def find_installation_repositories_for_user(installation, options = {})
|
159
|
+
opts = ensure_api_media_type(:integrations, options)
|
160
|
+
paginate "user/installations/#{installation}/repositories", opts
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
@@ -316,6 +316,19 @@ module Octokit
|
|
316
316
|
options = ensure_api_media_type(:issue_timelines, options)
|
317
317
|
paginate "#{Repository.path repo}/issues/#{number}/timeline", options
|
318
318
|
end
|
319
|
+
|
320
|
+
# Add assignees to an issue
|
321
|
+
#
|
322
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
323
|
+
# @param number [Integer] Issue number
|
324
|
+
# @param assignees [Array] Assignees to be added
|
325
|
+
# @return [Sawyer::Resource] Issue
|
326
|
+
# @see https://developer.github.com/v3/issues/assignees/#add-assignees-to-an-issue
|
327
|
+
# @example Add assignees "pengwynn" and "joeyw" to Issue #23 on octokit/octokit.rb
|
328
|
+
# Octokit.add_assignees("octokit/octokit.rb", 23, ["pengwynn", "joeyw"])
|
329
|
+
def add_assignees(repo, number, assignees, options = {})
|
330
|
+
post "#{Repository.path repo}/issues/#{number}/assignees", options.merge({:assignees => assignees})
|
331
|
+
end
|
319
332
|
end
|
320
333
|
end
|
321
334
|
end
|
@@ -35,7 +35,7 @@ module Octokit
|
|
35
35
|
# @option options [String] :ref name of the Commit/Branch/Tag. Defaults to 'master'.
|
36
36
|
# @return [Sawyer::Resource] The detail of the license file
|
37
37
|
# @example
|
38
|
-
# Octokit.
|
38
|
+
# Octokit.repository_license_contents 'benbalter/licensee'
|
39
39
|
def repository_license_contents(repo, options = {})
|
40
40
|
options = ensure_api_media_type(:licenses, options)
|
41
41
|
get "#{Repository.path repo}/license", options
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Marketplace Listing API
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/apps/marketplace/
|
7
|
+
module Marketplace
|
8
|
+
|
9
|
+
# List all plans for an app's marketplace listing
|
10
|
+
#
|
11
|
+
# @param options [Hash] A customizable set of options
|
12
|
+
#
|
13
|
+
# @see https://developer.github.com/v3/apps/marketplace/#list-all-plans-for-your-marketplace-listing
|
14
|
+
#
|
15
|
+
# @return [Array<Sawyer::Resource>] A list of plans
|
16
|
+
def list_plans(options = {})
|
17
|
+
opts = ensure_api_media_type(:marketplace, options)
|
18
|
+
paginate "/marketplace_listing/plans", opts
|
19
|
+
end
|
20
|
+
|
21
|
+
# List all GitHub accounts on a specific plan
|
22
|
+
#
|
23
|
+
# @param plan_id [Integer] The id of the GitHub plan
|
24
|
+
# @param options [Hash] A customizable set of options
|
25
|
+
#
|
26
|
+
# @see https://developer.github.com/v3/apps/marketplace/#list-all-github-accounts-user-or-organization-on-a-specific-plan
|
27
|
+
#
|
28
|
+
# @return [Array<Sawyer::Resource>] A list of accounts
|
29
|
+
def list_accounts_for_plan(plan_id, options = {})
|
30
|
+
opts = ensure_api_media_type(:marketplace, options)
|
31
|
+
paginate "/marketplace_listing/plans/#{plan_id}/accounts", opts
|
32
|
+
end
|
33
|
+
|
34
|
+
# Get the plan associated with a given GitHub account
|
35
|
+
#
|
36
|
+
# @param account_id [Integer] The id of the GitHub account
|
37
|
+
# @param options [Hash] A customizable set of options
|
38
|
+
#
|
39
|
+
# @see https://developer.github.com/v3/apps/marketplace/#check-if-a-github-account-is-associated-with-any-marketplace-listing
|
40
|
+
#
|
41
|
+
# @return <Sawyer::Resource> Account with plan details, or nil
|
42
|
+
def plan_for_account(account_id, options = {})
|
43
|
+
opts = ensure_api_media_type(:marketplace, options)
|
44
|
+
get "/marketplace_listing/accounts/#{account_id}", opts
|
45
|
+
end
|
46
|
+
|
47
|
+
# Get user's Marketplace purchases
|
48
|
+
#
|
49
|
+
# @param options [Hash] A customizable set of options
|
50
|
+
#
|
51
|
+
# @see https://developer.github.com/v3/apps/marketplace/#get-a-users-marketplace-purchases
|
52
|
+
#
|
53
|
+
# @return [Array<Sawyer::Resource>] A list of Marketplace purchases
|
54
|
+
def marketplace_purchases(options = {})
|
55
|
+
opts = ensure_api_media_type(:marketplace, options)
|
56
|
+
get "/user/marketplace_purchases", opts
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -108,10 +108,6 @@ module Octokit
|
|
108
108
|
# Mark thread as read
|
109
109
|
#
|
110
110
|
# @param thread_id [Integer] Id of the thread to update.
|
111
|
-
# @param options [Hash] Optional parameters.
|
112
|
-
# @option options [Boolean] :unread Changes the unread status of the
|
113
|
-
# threads.
|
114
|
-
# @option options [Boolean] :read Inverse of 'unread'.
|
115
111
|
# @return [Boolean] True if updated, false otherwise.
|
116
112
|
# @see https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read
|
117
113
|
# @example
|
@@ -220,7 +220,6 @@ module Octokit
|
|
220
220
|
# @example
|
221
221
|
# @client.organization_invitations('github')
|
222
222
|
def organization_invitations(org, options = {})
|
223
|
-
options = ensure_api_media_type(:org_memberships, options)
|
224
223
|
get "#{Organization.path org}/invitations", options
|
225
224
|
end
|
226
225
|
alias :org_invitations :organization_invitations
|
@@ -236,7 +235,6 @@ module Octokit
|
|
236
235
|
# @example
|
237
236
|
# @client.outside_collaborators('github')
|
238
237
|
def outside_collaborators(org, options={})
|
239
|
-
options = ensure_api_media_type(:org_memberships, options)
|
240
238
|
get "#{Organization.path org}/outside_collaborators", options
|
241
239
|
end
|
242
240
|
|
@@ -252,7 +250,6 @@ module Octokit
|
|
252
250
|
# @example
|
253
251
|
# @client.remove_outside_collaborator('github', 'lizzhale')
|
254
252
|
def remove_outside_collaborator(org, user, options={})
|
255
|
-
options = ensure_api_media_type(:org_memberships, options)
|
256
253
|
boolean_from_response :delete, "#{Organization.path org}/outside_collaborators/#{user}", options
|
257
254
|
end
|
258
255
|
|
@@ -268,7 +265,6 @@ module Octokit
|
|
268
265
|
# @example
|
269
266
|
# @client.convert_to_outside_collaborator('github', 'lizzhale')
|
270
267
|
def convert_to_outside_collaborator(org, user, options={})
|
271
|
-
options = ensure_api_media_type(:org_memberships, options)
|
272
268
|
boolean_from_response :put, "#{Organization.path org}/outside_collaborators/#{user}", options
|
273
269
|
end
|
274
270
|
|
@@ -296,6 +292,7 @@ module Octokit
|
|
296
292
|
# @option options [String] :name Team name.
|
297
293
|
# @option options [Array<String>] :repo_names Repositories for the team.
|
298
294
|
# @option options [Array<String>] :maintainers Maintainers for the team.
|
295
|
+
# @option options [Integer] :parent_team_id ID of a team to set as the parent team.
|
299
296
|
# @return [Sawyer::Resource] Hash representing new team.
|
300
297
|
# @see https://developer.github.com/v3/orgs/teams/#create-team
|
301
298
|
# @example
|
@@ -307,6 +304,9 @@ module Octokit
|
|
307
304
|
if options.key?(:permission)
|
308
305
|
octokit_warn "Deprecated: Passing :permission option to #create_team. Assign team repository permission by passing :permission to #add_team_repository instead."
|
309
306
|
end
|
307
|
+
if options.key?(:parent_team_id)
|
308
|
+
options = ensure_api_media_type(:nested_teams, options)
|
309
|
+
end
|
310
310
|
post "#{Organization.path org}/teams", options
|
311
311
|
end
|
312
312
|
|
@@ -323,6 +323,20 @@ module Octokit
|
|
323
323
|
get "teams/#{team_id}", options
|
324
324
|
end
|
325
325
|
|
326
|
+
# List child teams
|
327
|
+
#
|
328
|
+
# Requires authenticated organization member.
|
329
|
+
#
|
330
|
+
# @param team_id [Integer] Team id.
|
331
|
+
# @return [Sawyer::Resource] Hash representing team.
|
332
|
+
# @see https://developer.github.com/v3/orgs/teams/#list-child-teams
|
333
|
+
# @example
|
334
|
+
# @client.child_teams(100000, :accept => "application/vnd.github.hellcat-preview+json")
|
335
|
+
def child_teams(team_id, options = {})
|
336
|
+
options = ensure_api_media_type(:nested_teams, options)
|
337
|
+
paginate "teams/#{team_id}/teams", options
|
338
|
+
end
|
339
|
+
|
326
340
|
# Update team
|
327
341
|
#
|
328
342
|
# Requires authenticated organization owner.
|
@@ -334,6 +348,7 @@ module Octokit
|
|
334
348
|
# `pull` - team members can pull, but not push to or administer these repositories.
|
335
349
|
# `push` - team members can pull and push, but not administer these repositories.
|
336
350
|
# `admin` - team members can pull, push and administer these repositories.
|
351
|
+
# @option options [Integer] :parent_team_id ID of a team to set as the parent team.
|
337
352
|
# @return [Sawyer::Resource] Hash representing updated team.
|
338
353
|
# @see https://developer.github.com/v3/orgs/teams/#edit-team
|
339
354
|
# @example
|
@@ -342,6 +357,9 @@ module Octokit
|
|
342
357
|
# :permission => 'push'
|
343
358
|
# })
|
344
359
|
def update_team(team_id, options = {})
|
360
|
+
if options.key?(:parent_team_id)
|
361
|
+
options = ensure_api_media_type(:nested_teams, options)
|
362
|
+
end
|
345
363
|
patch "teams/#{team_id}", options
|
346
364
|
end
|
347
365
|
|
@@ -444,7 +462,6 @@ module Octokit
|
|
444
462
|
# @example
|
445
463
|
# @client.team_invitations('github')
|
446
464
|
def team_invitations(team_id, options = {})
|
447
|
-
options = ensure_api_media_type(:org_memberships, options)
|
448
465
|
get "teams/#{team_id}/invitations", options
|
449
466
|
end
|
450
467
|
|
@@ -610,7 +627,7 @@ module Octokit
|
|
610
627
|
#
|
611
628
|
# @return [Sawyer::Resource] Hash of team membership info
|
612
629
|
#
|
613
|
-
# @see https://developer.github.com/v3/orgs/teams/#add-team-membership
|
630
|
+
# @see https://developer.github.com/v3/orgs/teams/#add-or-update-team-membership
|
614
631
|
#
|
615
632
|
# @example Check if a user has a membership for a team
|
616
633
|
# @client.add_team_membership(1234, 'pengwynn')
|
@@ -358,7 +358,6 @@ module Octokit
|
|
358
358
|
# @example
|
359
359
|
# @client.permission_level('octokit/octokit.rb', 'lizzhale')
|
360
360
|
def permission_level(repo, collaborator, options={})
|
361
|
-
options = ensure_api_media_type(:org_memberships, options)
|
362
361
|
get "#{Repository.path repo}/collaborators/#{collaborator}/permission", options
|
363
362
|
end
|
364
363
|
|
@@ -516,7 +515,7 @@ module Octokit
|
|
516
515
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository.
|
517
516
|
# @param branch [String] Branch name
|
518
517
|
# @option options [Hash] :required_status_checks If not null, the following keys are required:
|
519
|
-
# <tt>:
|
518
|
+
# <tt>:enforce_admins [boolean] Enforce required status checks for repository administrators.</tt>
|
520
519
|
# <tt>:strict [boolean] Require branches to be up to date before merging.</tt>
|
521
520
|
# <tt>:contexts [Array] The list of status checks to require in order to merge into this branch</tt>
|
522
521
|
#
|
@@ -17,8 +17,7 @@ module Octokit
|
|
17
17
|
#
|
18
18
|
# @return [Array<Sawyer::Resource>] Array of Hashes representing the reviews
|
19
19
|
def pull_request_reviews(repo, id, options = {})
|
20
|
-
|
21
|
-
get "#{Repository.path repo}/pulls/#{id}/reviews", options
|
20
|
+
paginate "#{Repository.path repo}/pulls/#{id}/reviews", options
|
22
21
|
end
|
23
22
|
|
24
23
|
# Get a single review
|
@@ -33,7 +32,6 @@ module Octokit
|
|
33
32
|
#
|
34
33
|
# @return [Sawyer::Resource] Hash representing the review
|
35
34
|
def pull_request_review(repo, number, review, options = {})
|
36
|
-
options = ensure_api_media_type(:reviews, options)
|
37
35
|
get "#{Repository.path repo}/pulls/#{number}/reviews/#{review}", options
|
38
36
|
end
|
39
37
|
|
@@ -49,7 +47,6 @@ module Octokit
|
|
49
47
|
#
|
50
48
|
# @return [Sawyer::Resource] Hash representing the deleted review
|
51
49
|
def delete_pull_request_review(repo, number, review, options = {})
|
52
|
-
options = ensure_api_media_type(:reviews, options)
|
53
50
|
delete "#{Repository.path repo}/pulls/#{number}/reviews/#{review}", options
|
54
51
|
end
|
55
52
|
|
@@ -65,8 +62,7 @@ module Octokit
|
|
65
62
|
#
|
66
63
|
# @return [Array<Sawyer::Resource>] Array of Hashes representing the review comments
|
67
64
|
def pull_request_review_comments(repo, number, review, options = {})
|
68
|
-
|
69
|
-
get "#{Repository.path repo}/pulls/#{number}/reviews/#{review}/comments", options
|
65
|
+
paginate "#{Repository.path repo}/pulls/#{number}/reviews/#{review}/comments", options
|
70
66
|
end
|
71
67
|
|
72
68
|
# Create a pull request review
|
@@ -94,7 +90,6 @@ module Octokit
|
|
94
90
|
#
|
95
91
|
# @return [Sawyer::Resource>] Hash respresenting the review
|
96
92
|
def create_pull_request_review(repo, id, options = {})
|
97
|
-
options = ensure_api_media_type(:reviews, options)
|
98
93
|
post "#{Repository.path repo}/pulls/#{id}/reviews", options
|
99
94
|
end
|
100
95
|
|
@@ -116,7 +111,6 @@ module Octokit
|
|
116
111
|
# @return [Sawyer::Resource] Hash respresenting the review
|
117
112
|
def submit_pull_request_review(repo, number, review, event, options = {})
|
118
113
|
options = options.merge(event: event)
|
119
|
-
options = ensure_api_media_type(:reviews, options)
|
120
114
|
post "#{Repository.path repo}/pulls/#{number}/reviews/#{review}/events", options
|
121
115
|
end
|
122
116
|
|
@@ -134,7 +128,6 @@ module Octokit
|
|
134
128
|
# @return [Sawyer::Resource] Hash representing the dismissed review
|
135
129
|
def dismiss_pull_request_review(repo, number, review, message, options = {})
|
136
130
|
options = options.merge(message: message)
|
137
|
-
options = ensure_api_media_type(:reviews, options)
|
138
131
|
put "#{Repository.path repo}/pulls/#{number}/reviews/#{review}/dismissals", options
|
139
132
|
end
|
140
133
|
|
@@ -149,8 +142,7 @@ module Octokit
|
|
149
142
|
#
|
150
143
|
# @return [Array<Sawyer::Resource>] Array of Hashes representing the review requests
|
151
144
|
def pull_request_review_requests(repo, id, options = {})
|
152
|
-
|
153
|
-
get "#{Repository.path repo}/pulls/#{id}/requested_reviewers", options
|
145
|
+
paginate "#{Repository.path repo}/pulls/#{id}/requested_reviewers", options
|
154
146
|
end
|
155
147
|
|
156
148
|
# Create a review request
|
@@ -166,7 +158,6 @@ module Octokit
|
|
166
158
|
# @return [Sawyer::Resource>] Hash respresenting the pull request
|
167
159
|
def request_pull_request_review(repo, id, reviewers, options = {})
|
168
160
|
options = options.merge(reviewers: reviewers)
|
169
|
-
options = ensure_api_media_type(:reviews, options)
|
170
161
|
post "#{Repository.path repo}/pulls/#{id}/requested_reviewers", options
|
171
162
|
end
|
172
163
|
end
|
data/lib/octokit/error.rb
CHANGED
@@ -103,6 +103,20 @@ module Octokit
|
|
103
103
|
@response[:status]
|
104
104
|
end
|
105
105
|
|
106
|
+
# Headers returned by the GitHub server.
|
107
|
+
#
|
108
|
+
# @return [Hash]
|
109
|
+
def response_headers
|
110
|
+
@response[:response_headers]
|
111
|
+
end
|
112
|
+
|
113
|
+
# Body returned by the GitHub server.
|
114
|
+
#
|
115
|
+
# @return [String]
|
116
|
+
def response_body
|
117
|
+
@response[:body]
|
118
|
+
end
|
119
|
+
|
106
120
|
private
|
107
121
|
|
108
122
|
def data
|
data/lib/octokit/preview.rb
CHANGED
@@ -11,12 +11,13 @@ module Octokit
|
|
11
11
|
:reactions => 'application/vnd.github.squirrel-girl-preview'.freeze,
|
12
12
|
:repository_invitations => 'application/vnd.github.swamp-thing-preview+json'.freeze,
|
13
13
|
:issue_timelines => 'application/vnd.github.mockingbird-preview+json'.freeze,
|
14
|
+
:nested_teams => 'application/vnd.github.hellcat-preview+json'.freeze,
|
14
15
|
:pages => 'application/vnd.github.mister-fantastic-preview+json'.freeze,
|
15
16
|
:projects => 'application/vnd.github.inertia-preview+json'.freeze,
|
16
17
|
:traffic => 'application/vnd.github.spiderman-preview'.freeze,
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
18
|
+
:integrations => 'application/vnd.github.machine-man-preview+json'.freeze,
|
19
|
+
:marketplace => 'application/vnd.github.valkyrie-preview+json'.freeze,
|
20
|
+
:topics => 'application/vnd.github.mercy-preview+json'.freeze
|
20
21
|
}
|
21
22
|
|
22
23
|
def ensure_api_media_type(type, options)
|
data/lib/octokit/repository.rb
CHANGED
@@ -28,13 +28,13 @@ module Octokit
|
|
28
28
|
@owner = repo.owner
|
29
29
|
@name = repo.name
|
30
30
|
when Hash
|
31
|
-
@name = repo[:repo]
|
32
|
-
@owner = repo[:owner]
|
31
|
+
@name = repo[:repo] || repo[:name]
|
32
|
+
@owner = repo[:owner] || repo[:user] || repo[:username]
|
33
33
|
else
|
34
|
-
raise_invalid_repository!
|
34
|
+
raise_invalid_repository!(repo)
|
35
35
|
end
|
36
36
|
if @owner && @name
|
37
|
-
validate_owner_and_name!
|
37
|
+
validate_owner_and_name!(repo)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -80,14 +80,16 @@ module Octokit
|
|
80
80
|
|
81
81
|
private
|
82
82
|
|
83
|
-
def validate_owner_and_name!
|
83
|
+
def validate_owner_and_name!(repo)
|
84
84
|
if @owner.include?('/') || @name.include?('/') || !url.match(URI::ABS_URI)
|
85
|
-
raise_invalid_repository!
|
85
|
+
raise_invalid_repository!(repo)
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
-
def raise_invalid_repository!
|
90
|
-
|
89
|
+
def raise_invalid_repository!(repo)
|
90
|
+
msg = "#{repo.inspect} is invalid as a repository identifier. " +
|
91
|
+
"Use the repo/user (String) format, or the repository ID (Integer), or a hash containing :repo and :user keys."
|
92
|
+
raise Octokit::InvalidRepository, msg
|
91
93
|
end
|
92
94
|
end
|
93
95
|
end
|
data/lib/octokit/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octokit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wynn Netherland
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-12-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- lib/octokit/arguments.rb
|
66
66
|
- lib/octokit/authentication.rb
|
67
67
|
- lib/octokit/client.rb
|
68
|
+
- lib/octokit/client/apps.rb
|
68
69
|
- lib/octokit/client/authorizations.rb
|
69
70
|
- lib/octokit/client/commit_comments.rb
|
70
71
|
- lib/octokit/client/commits.rb
|
@@ -77,12 +78,12 @@ files:
|
|
77
78
|
- lib/octokit/client/gists.rb
|
78
79
|
- lib/octokit/client/gitignore.rb
|
79
80
|
- lib/octokit/client/hooks.rb
|
80
|
-
- lib/octokit/client/integrations.rb
|
81
81
|
- lib/octokit/client/issues.rb
|
82
82
|
- lib/octokit/client/labels.rb
|
83
83
|
- lib/octokit/client/legacy_search.rb
|
84
84
|
- lib/octokit/client/licenses.rb
|
85
85
|
- lib/octokit/client/markdown.rb
|
86
|
+
- lib/octokit/client/marketplace.rb
|
86
87
|
- lib/octokit/client/meta.rb
|
87
88
|
- lib/octokit/client/milestones.rb
|
88
89
|
- lib/octokit/client/notifications.rb
|
@@ -152,9 +153,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
153
|
version: 1.3.5
|
153
154
|
requirements: []
|
154
155
|
rubyforge_project:
|
155
|
-
rubygems_version: 2.
|
156
|
+
rubygems_version: 2.5.2
|
156
157
|
signing_key:
|
157
158
|
specification_version: 4
|
158
159
|
summary: Ruby toolkit for working with the GitHub API
|
159
160
|
test_files: []
|
160
|
-
has_rdoc:
|
@@ -1,77 +0,0 @@
|
|
1
|
-
module Octokit
|
2
|
-
class Client
|
3
|
-
|
4
|
-
# Methods for the Integrations API
|
5
|
-
module Integrations
|
6
|
-
|
7
|
-
# Find all installations that belong to an Integration
|
8
|
-
#
|
9
|
-
# @param options [Hash] An customizable set of options
|
10
|
-
#
|
11
|
-
# @see https://developer.github.com/v3/integrations/#find-installations
|
12
|
-
#
|
13
|
-
# @return [Array<Sawyer::Resource>] A list of installations
|
14
|
-
def find_integration_installations(options = {})
|
15
|
-
opts = ensure_api_media_type(:integrations, options)
|
16
|
-
paginate "/integration/installations", opts
|
17
|
-
end
|
18
|
-
alias find_installations find_integration_installations
|
19
|
-
|
20
|
-
# Create a new installation token
|
21
|
-
#
|
22
|
-
# @param installation [Integer] The id of a a GitHub Integration Installation
|
23
|
-
# @param options [Hash] An customizable set of options
|
24
|
-
#
|
25
|
-
# @see https://developer.github.com/v3/integrations/#find-installations
|
26
|
-
#
|
27
|
-
# @return [<Sawyer::Resource>] An installation token
|
28
|
-
def create_integration_installation_access_token(installation, options = {})
|
29
|
-
opts = ensure_api_media_type(:integrations, options)
|
30
|
-
post "/installations/#{installation}/access_tokens", opts
|
31
|
-
end
|
32
|
-
alias create_installation_access_token create_integration_installation_access_token
|
33
|
-
|
34
|
-
# List repositories that are accessible to the authenticated installation
|
35
|
-
#
|
36
|
-
# @param options [Hash] An customizable set of options
|
37
|
-
# @see https://developer.github.com/v3/integrations/installations/#list-repositories
|
38
|
-
#
|
39
|
-
# @return [Array<Sawyer::Resource>] A list of repositories
|
40
|
-
def list_integration_installation_repositories(options = {})
|
41
|
-
opts = ensure_api_media_type(:integrations, options)
|
42
|
-
paginate "/installation/repositories", opts
|
43
|
-
end
|
44
|
-
alias list_installation_repos list_integration_installation_repositories
|
45
|
-
|
46
|
-
# Add a single repository to an installation
|
47
|
-
#
|
48
|
-
# @param installation [Integer] The id of a a GitHub Integration Installation
|
49
|
-
# @param repo [Integer] The id of the GitHub repository
|
50
|
-
# @param options [Hash] An customizable set of options
|
51
|
-
#
|
52
|
-
# @see https://developer.github.com/v3/integrations/installations/#add-repository-to-installation
|
53
|
-
#
|
54
|
-
# @return [Boolean] Success
|
55
|
-
def add_repository_to_integration_installation(installation, repo, options = {})
|
56
|
-
opts = ensure_api_media_type(:integrations, options)
|
57
|
-
boolean_from_response :put, "/installations/#{installation}/repositories/#{repo}", opts
|
58
|
-
end
|
59
|
-
alias add_repo_to_installation add_repository_to_integration_installation
|
60
|
-
|
61
|
-
# Remove a single repository to an installation
|
62
|
-
#
|
63
|
-
# @param installation [Integer] The id of a a GitHub Integration Installation
|
64
|
-
# @param repo [Integer] The id of the GitHub repository
|
65
|
-
# @param options [Hash] An customizable set of options
|
66
|
-
#
|
67
|
-
# @see https://developer.github.com/v3/integrations/installations/#remove-repository-from-installation
|
68
|
-
#
|
69
|
-
# @return [Boolean] Success
|
70
|
-
def remove_repository_from_integration_installation(installation, repo, options = {})
|
71
|
-
opts = ensure_api_media_type(:integrations, options)
|
72
|
-
boolean_from_response :delete, "/installations/#{installation}/repositories/#{repo}", opts
|
73
|
-
end
|
74
|
-
alias remove_repo_from_installation remove_repository_from_integration_installation
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|