octokit 4.24.0 → 4.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +5 -3
- data/lib/ext/sawyer/relation.rb +4 -2
- data/lib/octokit/arguments.rb +2 -2
- data/lib/octokit/authentication.rb +4 -5
- data/lib/octokit/client/actions_secrets.rb +2 -3
- data/lib/octokit/client/actions_workflow_runs.rb +2 -0
- data/lib/octokit/client/actions_workflows.rb +2 -1
- data/lib/octokit/client/apps.rb +26 -26
- data/lib/octokit/client/authorizations.rb +20 -17
- data/lib/octokit/client/checks.rb +5 -5
- data/lib/octokit/client/commit_branches.rb +2 -2
- data/lib/octokit/client/commit_comments.rb +8 -8
- data/lib/octokit/client/commit_pulls.rb +2 -2
- data/lib/octokit/client/commits.rb +25 -33
- data/lib/octokit/client/community_profile.rb +2 -2
- data/lib/octokit/client/contents.rb +20 -21
- data/lib/octokit/client/deployments.rb +6 -6
- data/lib/octokit/client/downloads.rb +5 -6
- data/lib/octokit/client/emojis.rb +3 -3
- data/lib/octokit/client/events.rb +4 -4
- data/lib/octokit/client/feeds.rb +4 -5
- data/lib/octokit/client/gists.rb +6 -6
- data/lib/octokit/client/gitignore.rb +3 -3
- data/lib/octokit/client/hooks.rb +10 -10
- data/lib/octokit/client/issues.rb +14 -14
- data/lib/octokit/client/labels.rb +6 -6
- data/lib/octokit/client/legacy_search.rb +3 -3
- data/lib/octokit/client/licenses.rb +3 -3
- data/lib/octokit/client/markdown.rb +3 -3
- data/lib/octokit/client/marketplace.rb +4 -4
- data/lib/octokit/client/meta.rb +4 -5
- data/lib/octokit/client/milestones.rb +5 -5
- data/lib/octokit/client/notifications.rb +6 -6
- data/lib/octokit/client/oauth_applications.rb +0 -2
- data/lib/octokit/client/objects.rb +14 -14
- data/lib/octokit/client/organizations.rb +42 -42
- data/lib/octokit/client/pages.rb +3 -3
- data/lib/octokit/client/projects.rb +18 -19
- data/lib/octokit/client/pub_sub_hubbub.rb +14 -14
- data/lib/octokit/client/pull_requests.rb +41 -42
- data/lib/octokit/client/rate_limit.rb +9 -11
- data/lib/octokit/client/reactions.rb +6 -6
- data/lib/octokit/client/refs.rb +13 -14
- data/lib/octokit/client/releases.rb +13 -13
- data/lib/octokit/client/repositories.rb +36 -36
- data/lib/octokit/client/repository_invitations.rb +3 -3
- data/lib/octokit/client/reviews.rb +7 -7
- data/lib/octokit/client/say.rb +4 -5
- data/lib/octokit/client/search.rb +9 -9
- data/lib/octokit/client/service_status.rb +2 -2
- data/lib/octokit/client/source_import.rb +6 -6
- data/lib/octokit/client/stats.rb +10 -9
- data/lib/octokit/client/statuses.rb +5 -5
- data/lib/octokit/client/traffic.rb +2 -3
- data/lib/octokit/client/users.rb +27 -26
- data/lib/octokit/client.rb +24 -10
- data/lib/octokit/configurable.rb +33 -27
- data/lib/octokit/connection.rb +17 -18
- data/lib/octokit/default.rb +17 -15
- data/lib/octokit/enterprise_admin_client/admin_stats.rb +13 -14
- data/lib/octokit/enterprise_admin_client/license.rb +3 -4
- data/lib/octokit/enterprise_admin_client/orgs.rb +3 -4
- data/lib/octokit/enterprise_admin_client/search_indexing.rb +7 -8
- data/lib/octokit/enterprise_admin_client/users.rb +5 -4
- data/lib/octokit/enterprise_admin_client.rb +9 -3
- data/lib/octokit/enterprise_management_console_client/management_console.rb +30 -30
- data/lib/octokit/enterprise_management_console_client.rb +8 -2
- data/lib/octokit/error.rb +23 -21
- data/lib/octokit/gist.rb +2 -3
- data/lib/octokit/middleware/follow_redirects.rb +12 -11
- data/lib/octokit/organization.rb +3 -1
- data/lib/octokit/preview.rb +29 -29
- data/lib/octokit/rate_limit.rb +3 -3
- data/lib/octokit/repo_arguments.rb +2 -3
- data/lib/octokit/repository.rb +23 -24
- data/lib/octokit/response/base_middleware.rb +2 -0
- data/lib/octokit/response/feed_parser.rb +3 -5
- data/lib/octokit/response/raise_error.rb +2 -2
- data/lib/octokit/user.rb +4 -2
- data/lib/octokit/version.rb +3 -1
- data/lib/octokit/warnable.rb +3 -6
- data/lib/octokit.rb +14 -6
- data/octokit.gemspec +10 -8
- metadata +22 -21
@@ -1,18 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for Projects API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/repos/projects
|
7
8
|
module Projects
|
8
|
-
|
9
9
|
# List projects for a repository
|
10
10
|
#
|
11
11
|
# Requires authenticated client
|
12
12
|
#
|
13
13
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
14
14
|
# @return [Array<Sawyer::Resource>] Repository projects
|
15
|
-
# @see https://developer.github.com/v3/projects/#list-repository-projects
|
15
|
+
# @see https://developer.github.com/v3/projects/#list-repository-projects
|
16
16
|
# @example
|
17
17
|
# @client.projects('octokit/octokit.rb')
|
18
18
|
def projects(repo, options = {})
|
@@ -28,7 +28,7 @@ module Octokit
|
|
28
28
|
# @param name [String] Project name
|
29
29
|
# @option options [String] :body Body of the project
|
30
30
|
# @return [Sawyer::Resource] Fresh new project
|
31
|
-
# @see https://developer.github.com/v3/projects/#create-a-repository-project
|
31
|
+
# @see https://developer.github.com/v3/projects/#create-a-repository-project
|
32
32
|
# @example Create project with only a name
|
33
33
|
# @client.create_project('octokit/octokit.rb', 'implement new APIs')
|
34
34
|
#
|
@@ -53,7 +53,7 @@ module Octokit
|
|
53
53
|
opts = ensure_api_media_type(:projects, options)
|
54
54
|
paginate "orgs/#{org}/projects", opts
|
55
55
|
end
|
56
|
-
alias
|
56
|
+
alias organization_projects org_projects
|
57
57
|
|
58
58
|
# Create organization project
|
59
59
|
#
|
@@ -73,13 +73,13 @@ module Octokit
|
|
73
73
|
opts[:name] = name
|
74
74
|
post "orgs/#{org}/projects", opts
|
75
75
|
end
|
76
|
-
alias
|
76
|
+
alias create_organization_project create_org_project
|
77
77
|
|
78
|
-
# Get a project by id
|
78
|
+
# Get a project by id
|
79
79
|
#
|
80
80
|
# @param id [Integer] Project id
|
81
81
|
# @return [Sawyer::Resource] Project
|
82
|
-
# @see https://developer.github.com/v3/projects/#get-a-project
|
82
|
+
# @see https://developer.github.com/v3/projects/#get-a-project
|
83
83
|
# @example
|
84
84
|
# Octokit.project(123942)
|
85
85
|
def project(id, options = {})
|
@@ -95,7 +95,7 @@ module Octokit
|
|
95
95
|
# @option options [String] :name Project name
|
96
96
|
# @option options [String] :body Project body
|
97
97
|
# @return [Sawyer::Resource] Project
|
98
|
-
# @see https://developer.github.com/v3/projects/#update-a-project
|
98
|
+
# @see https://developer.github.com/v3/projects/#update-a-project
|
99
99
|
# @example Update project name
|
100
100
|
# @client.update_project(123942, name: 'New name')
|
101
101
|
def update_project(id, options = {})
|
@@ -109,7 +109,7 @@ module Octokit
|
|
109
109
|
#
|
110
110
|
# @param id [Integer] Project id
|
111
111
|
# @return [Boolean] Result of deletion
|
112
|
-
# @see https://developer.github.com/v3/projects/#delete-a-project
|
112
|
+
# @see https://developer.github.com/v3/projects/#delete-a-project
|
113
113
|
# @example
|
114
114
|
# @client.delete_project(123942)
|
115
115
|
def delete_project(id, options = {})
|
@@ -119,9 +119,9 @@ module Octokit
|
|
119
119
|
|
120
120
|
# List project columns
|
121
121
|
#
|
122
|
-
# @param id [Integer] Project id
|
122
|
+
# @param id [Integer] Project id
|
123
123
|
# @return [Array<Sawyer::Resource>] List of project columns
|
124
|
-
# @see https://developer.github.com/v3/projects/columns/#list-project-columns
|
124
|
+
# @see https://developer.github.com/v3/projects/columns/#list-project-columns
|
125
125
|
# @example
|
126
126
|
# @client.project_columns(123942)
|
127
127
|
def project_columns(id, options = {})
|
@@ -136,7 +136,7 @@ module Octokit
|
|
136
136
|
# @param id [Integer] Project column id
|
137
137
|
# @param name [String] New column name
|
138
138
|
# @return [Sawyer::Resource] Newly created column
|
139
|
-
# @see https://developer.github.com/v3/projects/columns/#create-a-project-column
|
139
|
+
# @see https://developer.github.com/v3/projects/columns/#create-a-project-column
|
140
140
|
# @example
|
141
141
|
# @client.create_project_column(123942, "To Dones")
|
142
142
|
def create_project_column(id, name, options = {})
|
@@ -149,7 +149,7 @@ module Octokit
|
|
149
149
|
#
|
150
150
|
# @param id [Integer] Project column id
|
151
151
|
# @return [Sawyer::Resource] Project column
|
152
|
-
# @see https://developer.github.com/v3/projects/columns/#get-a-project-column
|
152
|
+
# @see https://developer.github.com/v3/projects/columns/#get-a-project-column
|
153
153
|
# @example
|
154
154
|
# Octokit.project_column(30294)
|
155
155
|
def project_column(id, options = {})
|
@@ -164,7 +164,7 @@ module Octokit
|
|
164
164
|
# @param id [Integer] Project column id
|
165
165
|
# @param name [String] New column name
|
166
166
|
# @return [Sawyer::Resource] Updated column
|
167
|
-
# @see https://developer.github.com/v3/projects/columns/#update-a-project-column
|
167
|
+
# @see https://developer.github.com/v3/projects/columns/#update-a-project-column
|
168
168
|
# @example
|
169
169
|
# @client.update_project_column(30294, "new column name")
|
170
170
|
def update_project_column(id, name, options = {})
|
@@ -179,7 +179,7 @@ module Octokit
|
|
179
179
|
#
|
180
180
|
# @param id [Integer] Project column id
|
181
181
|
# @return [Boolean] Result of deletion request, true when deleted
|
182
|
-
# @see https://developer.github.com/v3/projects/columns/#delete-a-project-column
|
182
|
+
# @see https://developer.github.com/v3/projects/columns/#delete-a-project-column
|
183
183
|
# @example
|
184
184
|
# @client.delete_project_column(30294)
|
185
185
|
def delete_project_column(id, options = {})
|
@@ -192,7 +192,7 @@ module Octokit
|
|
192
192
|
# Requires authenticated client
|
193
193
|
#
|
194
194
|
# @param id [Integer] Project column id
|
195
|
-
# @param position [String] New position for the column. Can be one of
|
195
|
+
# @param position [String] New position for the column. Can be one of
|
196
196
|
# <tt>first</tt>, <tt>last</tt>, or <tt>after:<column-id></tt>, where
|
197
197
|
# <tt><column-id></tt> is the id value of a column in the same project.
|
198
198
|
# @return [Sawyer::Resource] Result
|
@@ -296,7 +296,7 @@ module Octokit
|
|
296
296
|
end
|
297
297
|
|
298
298
|
# Delete a project card
|
299
|
-
#
|
299
|
+
#
|
300
300
|
# Requires authenticated client
|
301
301
|
#
|
302
302
|
# @param id [Integer] Project card id
|
@@ -308,7 +308,6 @@ module Octokit
|
|
308
308
|
opts = ensure_api_media_type(:projects, options)
|
309
309
|
boolean_from_response :delete, "projects/columns/cards/#{id}", opts
|
310
310
|
end
|
311
|
-
|
312
311
|
end # Projects
|
313
312
|
end
|
314
313
|
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 PubSubHubbub API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/repos/hooks/#pubsubhubbub
|
7
8
|
module PubSubHubbub
|
8
|
-
|
9
9
|
# Subscribe to a pubsub topic
|
10
10
|
#
|
11
11
|
# @param topic [String] A recoginized and supported pubsub topic
|
@@ -18,11 +18,11 @@ module Octokit
|
|
18
18
|
# client.subscribe("https://github.com/joshk/devise_imapable/events/push", "github://Email?address=josh.kalderimis@gmail.com")
|
19
19
|
def subscribe(topic, callback, secret = nil)
|
20
20
|
options = {
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
"hub.callback": callback,
|
22
|
+
"hub.mode": 'subscribe',
|
23
|
+
"hub.topic": topic
|
24
24
|
}
|
25
|
-
options.merge!(
|
25
|
+
options.merge!("hub.secret": secret) unless secret.nil?
|
26
26
|
|
27
27
|
response = pub_sub_hubbub_request(options)
|
28
28
|
|
@@ -40,9 +40,9 @@ module Octokit
|
|
40
40
|
# client.unsubscribe("https://github.com/joshk/devise_imapable/events/push", "github://Email?address=josh.kalderimis@gmail.com")
|
41
41
|
def unsubscribe(topic, callback)
|
42
42
|
options = {
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
"hub.callback": callback,
|
44
|
+
"hub.mode": 'unsubscribe',
|
45
|
+
"hub.topic": topic
|
46
46
|
}
|
47
47
|
response = pub_sub_hubbub_request(options)
|
48
48
|
|
@@ -64,7 +64,7 @@ module Octokit
|
|
64
64
|
# client.subscribe_service_hook('joshk/device_imapable', 'Travis', { :token => "test", :domain => "domain", :user => "user" })
|
65
65
|
def subscribe_service_hook(repo, service_name, service_arguments = {}, secret = nil)
|
66
66
|
topic = "#{Octokit.web_endpoint}#{Repository.new(repo)}/events/push"
|
67
|
-
callback = "github://#{service_name}?#{service_arguments.collect{ |k,v| [
|
67
|
+
callback = "github://#{service_name}?#{service_arguments.collect { |k, v| [k, v].map { |p| URI.encode_www_form_component(p) }.join('=') }.join('&')}"
|
68
68
|
subscribe(topic, callback, secret)
|
69
69
|
end
|
70
70
|
|
@@ -88,20 +88,20 @@ module Octokit
|
|
88
88
|
def pub_sub_hubbub_request(options = {})
|
89
89
|
# This method is janky, bypass normal stack so we don't
|
90
90
|
# serialize request as JSON
|
91
|
-
conn = Faraday.new(:
|
91
|
+
conn = Faraday.new(url: @api_endpoint) do |http|
|
92
92
|
http.headers[:user_agent] = user_agent
|
93
93
|
if basic_authenticated?
|
94
94
|
http.request *FARADAY_BASIC_AUTH_KEYS, @login, @password
|
95
95
|
elsif token_authenticated?
|
96
96
|
http.request :authorization, 'token', @access_token
|
97
97
|
end
|
98
|
-
http.request
|
98
|
+
http.request :url_encoded
|
99
99
|
http.use Octokit::Response::RaiseError
|
100
|
-
http.adapter
|
100
|
+
http.adapter Faraday.default_adapter
|
101
101
|
end
|
102
102
|
|
103
103
|
conn.post do |req|
|
104
|
-
req.url
|
104
|
+
req.url 'hub'
|
105
105
|
req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
106
106
|
req.body = options
|
107
107
|
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 Pull Requests API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/pulls/
|
7
8
|
module PullRequests
|
8
|
-
|
9
9
|
# List pull requests for a repository
|
10
10
|
#
|
11
11
|
# @overload pull_requests(repo, options)
|
@@ -19,7 +19,7 @@ module Octokit
|
|
19
19
|
def pull_requests(repo, options = {})
|
20
20
|
paginate "#{Repository.path repo}/pulls", options
|
21
21
|
end
|
22
|
-
alias
|
22
|
+
alias pulls pull_requests
|
23
23
|
|
24
24
|
# Get a pull request
|
25
25
|
#
|
@@ -28,11 +28,11 @@ module Octokit
|
|
28
28
|
# @param number [Integer] Number of the pull request to fetch
|
29
29
|
# @return [Sawyer::Resource] Pull request info
|
30
30
|
# @example
|
31
|
-
# Octokit.pull_request('rails/rails', 42, :state => 'closed')
|
31
|
+
# Octokit.pull_request('rails/rails', 42, :state => 'closed')
|
32
32
|
def pull_request(repo, number, options = {})
|
33
33
|
get "#{Repository.path repo}/pulls/#{number}", options
|
34
34
|
end
|
35
|
-
alias
|
35
|
+
alias pull pull_request
|
36
36
|
|
37
37
|
# Create a pull request
|
38
38
|
#
|
@@ -51,9 +51,9 @@ module Octokit
|
|
51
51
|
# "Pull Request title", "Pull Request body")
|
52
52
|
def create_pull_request(repo, base, head, title, body = nil, options = {})
|
53
53
|
pull = {
|
54
|
-
:
|
55
|
-
:
|
56
|
-
:
|
54
|
+
base: base,
|
55
|
+
head: head,
|
56
|
+
title: title
|
57
57
|
}
|
58
58
|
pull[:body] = body unless body.nil?
|
59
59
|
post "#{Repository.path repo}/pulls", options.merge(pull)
|
@@ -72,9 +72,9 @@ module Octokit
|
|
72
72
|
# @return [Sawyer::Resource] The newly created pull request
|
73
73
|
def create_pull_request_for_issue(repo, base, head, issue, options = {})
|
74
74
|
pull = {
|
75
|
-
:
|
76
|
-
:
|
77
|
-
:
|
75
|
+
base: base,
|
76
|
+
head: head,
|
77
|
+
issue: issue
|
78
78
|
}
|
79
79
|
post "#{Repository.path repo}/pulls", options.merge(pull)
|
80
80
|
end
|
@@ -103,7 +103,7 @@ module Octokit
|
|
103
103
|
# @client.update_pull_request('octokit/octokit.rb', 67, nil, '')
|
104
104
|
def update_pull_request(*args)
|
105
105
|
arguments = Octokit::Arguments.new(args)
|
106
|
-
repo
|
106
|
+
repo = arguments.shift
|
107
107
|
number = arguments.shift
|
108
108
|
patch "#{Repository.path repo}/pulls/#{number}", arguments.options
|
109
109
|
end
|
@@ -117,7 +117,7 @@ module Octokit
|
|
117
117
|
# @example
|
118
118
|
# @client.close_pull_request('octokit/octokit.rb', 67)
|
119
119
|
def close_pull_request(repo, number, options = {})
|
120
|
-
options.merge! :
|
120
|
+
options.merge! state: 'closed'
|
121
121
|
update_pull_request(repo, number, options)
|
122
122
|
end
|
123
123
|
|
@@ -130,7 +130,7 @@ module Octokit
|
|
130
130
|
def pull_request_commits(repo, number, options = {})
|
131
131
|
paginate "#{Repository.path repo}/pulls/#{number}/commits", options
|
132
132
|
end
|
133
|
-
alias
|
133
|
+
alias pull_commits pull_request_commits
|
134
134
|
|
135
135
|
# List pull request comments for a repository
|
136
136
|
#
|
@@ -160,8 +160,8 @@ module Octokit
|
|
160
160
|
def pull_requests_comments(repo, options = {})
|
161
161
|
paginate("#{Repository.path repo}/pulls/comments", options)
|
162
162
|
end
|
163
|
-
alias
|
164
|
-
alias
|
163
|
+
alias pulls_comments pull_requests_comments
|
164
|
+
alias reviews_comments pull_requests_comments
|
165
165
|
|
166
166
|
# List comments on a pull request
|
167
167
|
#
|
@@ -173,8 +173,8 @@ module Octokit
|
|
173
173
|
# return the comments for a pull request
|
174
174
|
paginate("#{Repository.path repo}/pulls/#{number}/comments", options)
|
175
175
|
end
|
176
|
-
alias
|
177
|
-
alias
|
176
|
+
alias pull_comments pull_request_comments
|
177
|
+
alias review_comments pull_request_comments
|
178
178
|
|
179
179
|
# Get a pull request comment
|
180
180
|
#
|
@@ -187,8 +187,8 @@ module Octokit
|
|
187
187
|
def pull_request_comment(repo, comment_id, options = {})
|
188
188
|
get "#{Repository.path repo}/pulls/comments/#{comment_id}", options
|
189
189
|
end
|
190
|
-
alias
|
191
|
-
alias
|
190
|
+
alias pull_comment pull_request_comment
|
191
|
+
alias review_comment pull_request_comment
|
192
192
|
|
193
193
|
# Create a pull request comment
|
194
194
|
#
|
@@ -205,15 +205,15 @@ module Octokit
|
|
205
205
|
# "2d3201e4440903d8b04a5487842053ca4883e5f0", "lib/octokit/request.rb", 47)
|
206
206
|
def create_pull_request_comment(repo, pull_id, body, commit_id, path, position, options = {})
|
207
207
|
options.merge!({
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
208
|
+
body: body,
|
209
|
+
commit_id: commit_id,
|
210
|
+
path: path,
|
211
|
+
position: position
|
212
|
+
})
|
213
213
|
post "#{Repository.path repo}/pulls/#{pull_id}/comments", options
|
214
214
|
end
|
215
|
-
alias
|
216
|
-
alias
|
215
|
+
alias create_pull_comment create_pull_request_comment
|
216
|
+
alias create_view_comment create_pull_request_comment
|
217
217
|
|
218
218
|
# Create reply to a pull request comment
|
219
219
|
#
|
@@ -227,13 +227,13 @@ module Octokit
|
|
227
227
|
# @client.create_pull_request_comment_reply("octokit/octokit.rb", 163, "done.", 1903950)
|
228
228
|
def create_pull_request_comment_reply(repo, pull_id, body, comment_id, options = {})
|
229
229
|
options.merge!({
|
230
|
-
|
231
|
-
|
232
|
-
|
230
|
+
body: body,
|
231
|
+
in_reply_to: comment_id
|
232
|
+
})
|
233
233
|
post "#{Repository.path repo}/pulls/#{pull_id}/comments", options
|
234
234
|
end
|
235
|
-
alias
|
236
|
-
alias
|
235
|
+
alias create_pull_reply create_pull_request_comment_reply
|
236
|
+
alias create_review_reply create_pull_request_comment_reply
|
237
237
|
|
238
238
|
# Update pull request comment
|
239
239
|
#
|
@@ -245,11 +245,11 @@ module Octokit
|
|
245
245
|
# @example
|
246
246
|
# @client.update_pull_request_comment("octokit/octokit.rb", 1903950, ":shipit:")
|
247
247
|
def update_pull_request_comment(repo, comment_id, body, options = {})
|
248
|
-
options.merge! :
|
248
|
+
options.merge! body: body
|
249
249
|
patch("#{Repository.path repo}/pulls/comments/#{comment_id}", options)
|
250
250
|
end
|
251
|
-
alias
|
252
|
-
alias
|
251
|
+
alias update_pull_comment update_pull_request_comment
|
252
|
+
alias update_review_comment update_pull_request_comment
|
253
253
|
|
254
254
|
# Delete pull request comment
|
255
255
|
#
|
@@ -262,8 +262,8 @@ module Octokit
|
|
262
262
|
def delete_pull_request_comment(repo, comment_id, options = {})
|
263
263
|
boolean_from_response(:delete, "#{Repository.path repo}/pulls/comments/#{comment_id}", options)
|
264
264
|
end
|
265
|
-
alias
|
266
|
-
alias
|
265
|
+
alias delete_pull_comment delete_pull_request_comment
|
266
|
+
alias delete_review_comment delete_pull_request_comment
|
267
267
|
|
268
268
|
# List files on a pull request
|
269
269
|
#
|
@@ -274,7 +274,7 @@ module Octokit
|
|
274
274
|
def pull_request_files(repo, number, options = {})
|
275
275
|
paginate "#{Repository.path repo}/pulls/#{number}/files", options
|
276
276
|
end
|
277
|
-
alias
|
277
|
+
alias pull_files pull_request_files
|
278
278
|
|
279
279
|
# Merge a pull request
|
280
280
|
#
|
@@ -283,8 +283,8 @@ module Octokit
|
|
283
283
|
# @param number [Integer] Number of pull request
|
284
284
|
# @param commit_message [String] Optional commit message for the merge commit
|
285
285
|
# @return [Array<Sawyer::Resource>] Merge commit info if successful
|
286
|
-
def merge_pull_request(repo, number, commit_message='', options = {})
|
287
|
-
put "#{Repository.path repo}/pulls/#{number}/merge", options.merge({:commit_message
|
286
|
+
def merge_pull_request(repo, number, commit_message = '', options = {})
|
287
|
+
put "#{Repository.path repo}/pulls/#{number}/merge", options.merge({ commit_message: commit_message })
|
288
288
|
end
|
289
289
|
|
290
290
|
# Check pull request merge status
|
@@ -296,8 +296,7 @@ module Octokit
|
|
296
296
|
def pull_merged?(repo, number, options = {})
|
297
297
|
boolean_from_response :get, "#{Repository.path repo}/pulls/#{number}/merge", options
|
298
298
|
end
|
299
|
-
alias
|
300
|
-
|
299
|
+
alias pull_request_merged? pull_merged?
|
301
300
|
end
|
302
301
|
end
|
303
302
|
end
|
@@ -1,17 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for API rate limiting info
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/#rate-limiting
|
7
8
|
module RateLimit
|
8
|
-
|
9
9
|
# Get rate limit info from last response if available
|
10
10
|
# or make a new request to fetch rate limit
|
11
11
|
#
|
12
12
|
# @see https://developer.github.com/v3/rate_limit/#rate-limit
|
13
13
|
# @return [Octokit::RateLimit] Rate limit info
|
14
|
-
def rate_limit(
|
14
|
+
def rate_limit(_options = {})
|
15
15
|
return rate_limit! if last_response.nil?
|
16
16
|
|
17
17
|
Octokit::RateLimit.from_response(last_response)
|
@@ -22,8 +22,8 @@ module Octokit
|
|
22
22
|
#
|
23
23
|
# @see https://developer.github.com/v3/rate_limit/#rate-limit
|
24
24
|
# @return [Integer] Number of requests remaining in this period
|
25
|
-
def rate_limit_remaining(
|
26
|
-
octokit_warn
|
25
|
+
def rate_limit_remaining(_options = {})
|
26
|
+
octokit_warn 'Deprecated: Please use .rate_limit.remaining'
|
27
27
|
rate_limit.remaining
|
28
28
|
end
|
29
29
|
alias ratelimit_remaining rate_limit_remaining
|
@@ -32,8 +32,8 @@ module Octokit
|
|
32
32
|
#
|
33
33
|
# @see https://developer.github.com/v3/rate_limit/#rate-limit
|
34
34
|
# @return [Octokit::RateLimit] Rate limit info
|
35
|
-
def rate_limit!(
|
36
|
-
get
|
35
|
+
def rate_limit!(_options = {})
|
36
|
+
get 'rate_limit'
|
37
37
|
Octokit::RateLimit.from_response(last_response)
|
38
38
|
end
|
39
39
|
alias ratelimit! rate_limit!
|
@@ -42,13 +42,11 @@ module Octokit
|
|
42
42
|
#
|
43
43
|
# @see https://developer.github.com/v3/rate_limit/#rate-limit
|
44
44
|
# @return [Integer] Number of requests remaining in this period
|
45
|
-
def rate_limit_remaining!(
|
46
|
-
octokit_warn
|
45
|
+
def rate_limit_remaining!(_options = {})
|
46
|
+
octokit_warn 'Deprecated: Please use .rate_limit!.remaining'
|
47
47
|
rate_limit!.remaining
|
48
48
|
end
|
49
49
|
alias ratelimit_remaining! rate_limit_remaining!
|
50
|
-
|
51
50
|
end
|
52
51
|
end
|
53
52
|
end
|
54
|
-
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Reacions API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/reactions/
|
7
8
|
module Reactions
|
8
|
-
|
9
9
|
# List reactions for a commit comment
|
10
10
|
#
|
11
11
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
@@ -34,7 +34,7 @@ module Octokit
|
|
34
34
|
#
|
35
35
|
# @return [<Sawyer::Resource>] Hash representing the reaction
|
36
36
|
def create_commit_comment_reaction(repo, id, reaction, options = {})
|
37
|
-
options = ensure_api_media_type(:reactions, options.merge(:
|
37
|
+
options = ensure_api_media_type(:reactions, options.merge(content: reaction))
|
38
38
|
post "#{Repository.path repo}/comments/#{id}/reactions", options
|
39
39
|
end
|
40
40
|
|
@@ -67,7 +67,7 @@ module Octokit
|
|
67
67
|
#
|
68
68
|
# @return [<Sawyer::Resource>] Hash representing the reaction.
|
69
69
|
def create_issue_reaction(repo, number, reaction, options = {})
|
70
|
-
options = ensure_api_media_type(:reactions, options.merge(:
|
70
|
+
options = ensure_api_media_type(:reactions, options.merge(content: reaction))
|
71
71
|
post "#{Repository.path repo}/issues/#{number}/reactions", options
|
72
72
|
end
|
73
73
|
|
@@ -101,7 +101,7 @@ module Octokit
|
|
101
101
|
#
|
102
102
|
# @return [<Sawyer::Resource>] Hashes representing the reaction.
|
103
103
|
def create_issue_comment_reaction(repo, id, reaction, options = {})
|
104
|
-
options = ensure_api_media_type(:reactions, options.merge(:
|
104
|
+
options = ensure_api_media_type(:reactions, options.merge(content: reaction))
|
105
105
|
post "#{Repository.path repo}/issues/comments/#{id}/reactions", options
|
106
106
|
end
|
107
107
|
|
@@ -135,7 +135,7 @@ module Octokit
|
|
135
135
|
#
|
136
136
|
# @return [<Sawyer::Resource>] Hash representing the reaction.
|
137
137
|
def create_pull_request_review_comment_reaction(repo, id, reaction, options = {})
|
138
|
-
options = ensure_api_media_type(:reactions, options.merge(:
|
138
|
+
options = ensure_api_media_type(:reactions, options.merge(content: reaction))
|
139
139
|
post "#{Repository.path repo}/pulls/comments/#{id}/reactions", options
|
140
140
|
end
|
141
141
|
|
data/lib/octokit/client/refs.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for References for Git Data API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/git/refs/
|
7
8
|
module Refs
|
8
|
-
|
9
9
|
# List all refs for a given user and repo
|
10
10
|
#
|
11
11
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
@@ -19,9 +19,9 @@ module Octokit
|
|
19
19
|
path += "/#{namespace}" unless namespace.nil?
|
20
20
|
paginate path, options
|
21
21
|
end
|
22
|
-
alias
|
23
|
-
alias
|
24
|
-
alias
|
22
|
+
alias list_refs refs
|
23
|
+
alias references refs
|
24
|
+
alias list_references refs
|
25
25
|
|
26
26
|
# Fetch matching refs
|
27
27
|
#
|
@@ -46,7 +46,7 @@ module Octokit
|
|
46
46
|
def ref(repo, ref, options = {})
|
47
47
|
get "#{Repository.path repo}/git/refs/#{ref}", options
|
48
48
|
end
|
49
|
-
alias
|
49
|
+
alias reference ref
|
50
50
|
|
51
51
|
# Create a reference
|
52
52
|
#
|
@@ -60,12 +60,12 @@ module Octokit
|
|
60
60
|
def create_ref(repo, ref, sha, options = {})
|
61
61
|
ref = "refs/#{ref}" unless ref =~ %r{\Arefs/}
|
62
62
|
parameters = {
|
63
|
-
:
|
64
|
-
:
|
63
|
+
ref: ref,
|
64
|
+
sha: sha
|
65
65
|
}
|
66
66
|
post "#{Repository.path repo}/git/refs", options.merge(parameters)
|
67
67
|
end
|
68
|
-
alias
|
68
|
+
alias create_reference create_ref
|
69
69
|
|
70
70
|
# Update a reference
|
71
71
|
#
|
@@ -81,12 +81,12 @@ module Octokit
|
|
81
81
|
# Octokit.update_ref("octocat/Hello-World", "heads/sc/featureA", "aa218f56b14c9653891f9e74264a383fa43fefbd", false)
|
82
82
|
def update_ref(repo, ref, sha, force = true, options = {})
|
83
83
|
parameters = {
|
84
|
-
:
|
85
|
-
:
|
84
|
+
sha: sha,
|
85
|
+
force: force
|
86
86
|
}
|
87
87
|
patch "#{Repository.path repo}/git/refs/#{ref}", options.merge(parameters)
|
88
88
|
end
|
89
|
-
alias
|
89
|
+
alias update_reference update_ref
|
90
90
|
|
91
91
|
# Update a branch
|
92
92
|
#
|
@@ -127,8 +127,7 @@ module Octokit
|
|
127
127
|
def delete_ref(repo, ref, options = {})
|
128
128
|
boolean_from_response :delete, "#{Repository.path repo}/git/refs/#{ref}", options
|
129
129
|
end
|
130
|
-
alias
|
131
|
-
|
130
|
+
alias delete_reference delete_ref
|
132
131
|
end
|
133
132
|
end
|
134
133
|
end
|