octokit 7.2.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab72372e0317944ac3a6c8b4e166bad268bea9524ef8bde2f5cacb13ee471d28
4
- data.tar.gz: 19be89924891fb2a771d17fb739fad7454bc8cb79c66950d7c64eb426ab2aef5
3
+ metadata.gz: a9f2dca26c45a1b912572448c2fe16e78f37b7bb5fc7dc885488847c6eb19315
4
+ data.tar.gz: 11a332c8d3ad5f92ac0ed01ccd03e6a699f852d31946e6e4acc43e75ea3b2d00
5
5
  SHA512:
6
- metadata.gz: 38724e4929489a803f1aa9e3186633217bd8473585b35a90ee82fd2985abc361b03af97c96e089759e1c1d2388fcb6cc4fba2d496aae0abfcc214265e0a54770
7
- data.tar.gz: b2b589fccec5e74cddc322b850ac9bd04a0dd7300476b6b3758059bcba62b7651a10d634683f0e427ea4c049e78ee52542319206571493ce84241a326af5d6d7
6
+ metadata.gz: 4790f888c01d7094b822ba72fc1ac576efa0803c6433982b53373787649b9b398842ee2986e43af6000677cda62a81e9072936b1d46c516a441a8256de10a1ae
7
+ data.tar.gz: 135c6ab374669d1db0fd18172670f79856adb627ef3e8cf015e0af93dacedf110f6f022df2be04907fdf11d4db68d7c382569e56f792d4c5eac2db7f65f8bbec
data/README.md CHANGED
@@ -213,15 +213,7 @@ user.login
213
213
  # => "defunkt"
214
214
  ```
215
215
 
216
- You can [create access tokens through your GitHub Account Settings](https://help.github.com/articles/creating-an-access-token-for-command-line-use)
217
- or with a basic authenticated Octokit client:
218
-
219
- ```ruby
220
- client = Octokit::Client.new(:login => 'defunkt', :password => 'c0d3b4ssssss!')
221
-
222
- client.create_authorization(:scopes => ["user"], :note => "Name of token")
223
- # => <your new oauth token>
224
- ```
216
+ You can [create access tokens through your GitHub Account Settings](https://help.github.com/articles/creating-an-access-token-for-command-line-use).
225
217
 
226
218
  ### Two-Factor Authentication
227
219
 
@@ -237,18 +229,6 @@ client = Octokit::Client.new \
237
229
  user = client.user("defunkt", :headers => { "X-GitHub-OTP" => "<your 2FA token>" })
238
230
  ```
239
231
 
240
- As you can imagine, this gets annoying quickly since two-factor auth tokens are very short lived. So it is recommended to create an oauth token for the user to communicate with the API:
241
-
242
- ```ruby
243
- client = Octokit::Client.new \
244
- :login => 'defunkt',
245
- :password => 'c0d3b4ssssss!'
246
-
247
- client.create_authorization(:scopes => ["user"], :note => "Name of token",
248
- :headers => { "X-GitHub-OTP" => "<your 2FA token>" })
249
- # => <your new oauth token>
250
- ```
251
-
252
232
  ### Using a .netrc file
253
233
 
254
234
  Octokit supports reading credentials from a netrc file (defaulting to
@@ -197,20 +197,21 @@ module Octokit
197
197
  # @param body [String] Comment content
198
198
  # @param commit_id [String] Sha of the commit to comment on.
199
199
  # @param path [String] Relative path of the file to comment on.
200
- # @param position [Integer] Line index in the diff to comment on.
200
+ # @param line [Integer] Line index in the diff to comment on.
201
+ # For a multi-line comment, the last line of the range
202
+ # and specify 'start_line' in the 'options'.
201
203
  # @return [Sawyer::Resource] Hash representing the new comment
202
204
  # @deprecated The position will be deprecated in the next major version. Please refer to the details below.
203
205
  # @see https://developer.github.com/v3/pulls/comments/#create-a-comment
204
206
  # @example
205
207
  # @client.create_pull_request_comment("octokit/octokit.rb", 163, ":shipit:",
206
208
  # "2d3201e4440903d8b04a5487842053ca4883e5f0", "lib/octokit/request.rb", 47)
207
- def create_pull_request_comment(repo, pull_id, body, commit_id, path, position, options = {})
208
- octokit_warn 'Deprecated: The position will be deprecated in the next major version.'
209
+ def create_pull_request_comment(repo, pull_id, body, commit_id, path, line, options = {})
209
210
  options.merge!({
210
211
  body: body,
211
212
  commit_id: commit_id,
212
213
  path: path,
213
- position: position
214
+ line: line
214
215
  })
215
216
  post "#{Repository.path repo}/pulls/#{pull_id}/comments", options
216
217
  end
@@ -150,6 +150,55 @@ module Octokit
150
150
  def delete_issue_reaction(repo, issue_id, reaction_id, options = {})
151
151
  boolean_from_response :delete, "#{Repository.path repo}/issues/#{issue_id}/reactions/#{reaction_id}", options
152
152
  end
153
+
154
+ # List reactions for a release
155
+ #
156
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
157
+ # @param id [Integer] The Release id
158
+ #
159
+ # @see https://docs.github.com/en/free-pro-team@latest/rest/reactions/reactions?apiVersion=2022-11-28#list-reactions-for-a-release
160
+ #
161
+ # @example
162
+ # @client.release_reactions("octokit/octokit.rb", 1)
163
+ #
164
+ # @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
165
+ def release_reactions(repo, release_id, options = {})
166
+ get "#{Repository.path repo}/releases/#{release_id}/reactions", options
167
+ end
168
+
169
+ # Create reaction for a release
170
+ #
171
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
172
+ # @param id [Integer] The Release id
173
+ # @param reaction [String] The Reaction
174
+ #
175
+ # @see https://docs.github.com/en/free-pro-team@latest/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-a-release
176
+ # @see https://developer.github.com/v3/reactions/#reaction-types
177
+ #
178
+ # @example
179
+ # @client.create_release_reaction("octokit/octokit.rb", 1)
180
+ #
181
+ # @return [<Sawyer::Resource>] Hash representing the reaction.
182
+ def create_release_reaction(repo, release_id, reaction, options = {})
183
+ options = options.merge(content: reaction)
184
+ post "#{Repository.path repo}/releases/#{release_id}/reactions", options
185
+ end
186
+
187
+ # Delete a reaction for a release
188
+ #
189
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
190
+ # @param issue_id [Integer] The Release id
191
+ # @param reaction_id [Integer] The Reaction id
192
+ #
193
+ # @see https://docs.github.com/en/free-pro-team@latest/rest/reactions/reactions?apiVersion=2022-11-28#delete-a-release-reaction
194
+ #
195
+ # @example
196
+ # @client.delete_release_reaction("octokit/octokit.rb", 1, 2)
197
+ #
198
+ # @return [Boolean] Return true if reaction was deleted, false otherwise.
199
+ def delete_release_reaction(repo, release_id, reaction_id, options = {})
200
+ boolean_from_response :delete, "#{Repository.path repo}/releases/#{release_id}/reactions/#{reaction_id}", options
201
+ end
153
202
  end
154
203
  end
155
204
  end
@@ -3,11 +3,11 @@
3
3
  module Octokit
4
4
  # Current major release.
5
5
  # @return [Integer]
6
- MAJOR = 7
6
+ MAJOR = 8
7
7
 
8
8
  # Current minor release.
9
9
  # @return [Integer]
10
- MINOR = 2
10
+ MINOR = 0
11
11
 
12
12
  # Current patch level.
13
13
  # @return [Integer]
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: 7.2.0
4
+ version: 8.0.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: 2023-09-29 00:00:00.000000000 Z
13
+ date: 2023-10-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  - !ruby/object:Gem::Version
168
168
  version: 1.3.5
169
169
  requirements: []
170
- rubygems_version: 3.4.20
170
+ rubygems_version: 3.4.0.dev
171
171
  signing_key:
172
172
  specification_version: 4
173
173
  summary: Ruby toolkit for working with the GitHub API