octokit 6.0.1 → 6.1.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/README.md +25 -13
- data/Rakefile +8 -10
- data/lib/octokit/client/repositories.rb +1 -1
- data/lib/octokit/client.rb +2 -2
- data/lib/octokit/configurable.rb +1 -1
- data/lib/octokit/default.rb +5 -3
- data/lib/octokit/gist.rb +1 -1
- data/lib/octokit/rate_limit.rb +6 -4
- data/lib/octokit/repository.rb +1 -1
- data/lib/octokit/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afa7dae6ede3d3871a1ba78d8c0de33d3aa4692869eacdbb30e0867f555c21f2
|
4
|
+
data.tar.gz: 213439dcb01e0af935df22e902caa69d9c395b1ab9076a83918efebc374140bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 117e024b6078555cdd6809d941a19a0e8b77e629939e112ffe5a5116674c16d6b441358e3ba56bc2d27770fea108fd4adc18d48aa6c186206628abc28dd525d9
|
7
|
+
data.tar.gz: 4caea9cb705c43d9c8022f0de6d74cc9ece8d1e1771ae7a43c0e53a748c226a8c231fe25c64b813bf025a80521dd5c201eb7d2693ebbd6074d47a776137dd7fb
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ Upgrading? Check the [Upgrade Guide](#upgrading-guide) before bumping to a new
|
|
13
13
|
## Table of Contents
|
14
14
|
|
15
15
|
1. [Philosophy](#philosophy)
|
16
|
-
2. [Installation](#
|
16
|
+
2. [Installation](#installation)
|
17
17
|
3. [Making requests](#making-requests)
|
18
18
|
1. [Additional Query Parameters](#additional-query-parameters)
|
19
19
|
4. [Consuming resources](#consuming-resources)
|
@@ -25,33 +25,35 @@ Upgrading? Check the [Upgrade Guide](#upgrading-guide) before bumping to a new
|
|
25
25
|
3. [Two-Factor Authentication](#two-factor-authentication)
|
26
26
|
4. [Using a .netrc file](#using-a-netrc-file)
|
27
27
|
5. [Application authentication](#application-authentication)
|
28
|
-
|
28
|
+
6. [GitHub App](#github-app)
|
29
|
+
8. [Default results per_page](#default-results-per_page)
|
30
|
+
9. [Pagination](#pagination)
|
29
31
|
1. [Auto pagination](#auto-pagination)
|
30
|
-
|
32
|
+
10. [Working with GitHub Enterprise](#working-with-github-enterprise)
|
31
33
|
1. [Interacting with the GitHub.com APIs in GitHub Enterprise](#interacting-with-the-githubcom-apis-in-github-enterprise)
|
32
34
|
2. [Interacting with the GitHub Enterprise Admin APIs](#interacting-with-the-github-enterprise-admin-apis)
|
33
35
|
3. [Interacting with the GitHub Enterprise Management Console APIs](#interacting-with-the-github-enterprise-management-console-apis)
|
34
36
|
4. [SSL Connection Errors](#ssl-connection-errors)
|
35
|
-
|
37
|
+
11. [Configuration and defaults](#configuration-and-defaults)
|
36
38
|
1. [Configuring module defaults](#configuring-module-defaults)
|
37
39
|
2. [Using ENV variables](#using-env-variables)
|
38
40
|
3. [Timeouts](#timeouts)
|
39
|
-
|
41
|
+
12. [Hypermedia agent](#hypermedia-agent)
|
40
42
|
1. [Hypermedia in Octokit](#hypermedia-in-octokit)
|
41
43
|
2. [URI templates](#uri-templates)
|
42
44
|
3. [The Full Hypermedia Experience™](#the-full-hypermedia-experience)
|
43
|
-
|
45
|
+
13. [Upgrading guide](#upgrading-guide)
|
44
46
|
1. [Upgrading from 1.x.x](#upgrading-from-1xx)
|
45
|
-
|
47
|
+
14. [Advanced usage](#advanced-usage)
|
46
48
|
1. [Debugging](#debugging)
|
47
49
|
2. [Caching](#caching)
|
48
|
-
|
50
|
+
15. [Hacking on Octokit.rb](#hacking-on-octokitrb)
|
49
51
|
1. [Code of Conduct](#code-of-conduct)
|
50
52
|
2. [Running and writing new tests](#running-and-writing-new-tests)
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
53
|
+
16. [Supported Ruby Versions](#supported-ruby-versions)
|
54
|
+
17. [Versioning](#versioning)
|
55
|
+
18. [Making Repeating Requests](#making-repeating-requests)
|
56
|
+
19. [License](#license)
|
55
57
|
|
56
58
|
## Philosophy
|
57
59
|
|
@@ -298,6 +300,15 @@ user = client.user 'defunkt'
|
|
298
300
|
[access scopes]: http://developer.github.com/v3/oauth/#scopes
|
299
301
|
[app-creds]: http://developer.github.com/v3/#increasing-the-unauthenticated-rate-limit-for-oauth-applications
|
300
302
|
|
303
|
+
### GitHub App
|
304
|
+
Octokit.rb also supports authentication [using a GitHub App](https://docs.github.com/en/developers/apps/managing-github-apps/installing-github-apps), which [requires a generated JWT token](https://docs.github.com/en/developers/apps/building-github-apps/authenticating-with-github-apps#authenticating-as-a-github-app).
|
305
|
+
|
306
|
+
```ruby
|
307
|
+
client = Octokit::Client.new(:bearer_token => "<your jwt token>")
|
308
|
+
client.app
|
309
|
+
# => about GitHub App info
|
310
|
+
```
|
311
|
+
|
301
312
|
## Default results per_page
|
302
313
|
|
303
314
|
Default results from the GitHub API are 30, if you wish to add more you must do so during Octokit configuration.
|
@@ -606,7 +617,7 @@ traffic:
|
|
606
617
|
|
607
618
|
```ruby
|
608
619
|
stack = Faraday::RackBuilder.new do |builder|
|
609
|
-
builder.use Faraday::Retry::Middleware, exceptions: [Octokit::ServerError] # or Faraday::Request::Retry for Faraday < 2.0
|
620
|
+
builder.use Faraday::Retry::Middleware, exceptions: Faraday::Request::Retry::DEFAULT_EXCEPTIONS + [Octokit::ServerError] # or Faraday::Request::Retry for Faraday < 2.0
|
610
621
|
builder.use Octokit::Middleware::FollowRedirects
|
611
622
|
builder.use Octokit::Response::RaiseError
|
612
623
|
builder.use Octokit::Response::FeedParser
|
@@ -746,6 +757,7 @@ implementations:
|
|
746
757
|
* Ruby 2.7
|
747
758
|
* Ruby 3.0
|
748
759
|
* Ruby 3.1
|
760
|
+
* Ruby 3.2
|
749
761
|
|
750
762
|
If something doesn't work on one of these Ruby versions, it's a bug.
|
751
763
|
|
data/Rakefile
CHANGED
@@ -10,15 +10,13 @@ task test: :spec
|
|
10
10
|
task default: :spec
|
11
11
|
|
12
12
|
namespace :doc do
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
]
|
21
|
-
end
|
22
|
-
rescue LoadError
|
13
|
+
require 'yard'
|
14
|
+
YARD::Rake::YardocTask.new do |task|
|
15
|
+
task.files = ['README.md', 'LICENSE.md', 'lib/**/*.rb']
|
16
|
+
task.options = [
|
17
|
+
'--output-dir', 'doc/yard',
|
18
|
+
'--markup', 'markdown'
|
19
|
+
]
|
23
20
|
end
|
21
|
+
rescue LoadError
|
24
22
|
end
|
@@ -564,7 +564,7 @@ module Octokit
|
|
564
564
|
# @example Get branch 'master` from octokit/octokit.rb
|
565
565
|
# Octokit.branch("octokit/octokit.rb", "master")
|
566
566
|
def branch(repo, branch, options = {})
|
567
|
-
get "#{Repository.path repo}/branches/#{branch}", options
|
567
|
+
get "#{Repository.path repo}/branches/#{CGI.escape(branch)}", options
|
568
568
|
end
|
569
569
|
alias get_branch branch
|
570
570
|
|
data/lib/octokit/client.rb
CHANGED
@@ -163,10 +163,10 @@ module Octokit
|
|
163
163
|
inspected.gsub! @bearer_token, '********' if @bearer_token
|
164
164
|
# Only show last 4 of token, secret
|
165
165
|
if @access_token
|
166
|
-
inspected.gsub! @access_token, "#{'*' * 36}#{@access_token[36
|
166
|
+
inspected.gsub! @access_token, "#{'*' * 36}#{@access_token[36..]}"
|
167
167
|
end
|
168
168
|
if @client_secret
|
169
|
-
inspected.gsub! @client_secret, "#{'*' * 36}#{@client_secret[36
|
169
|
+
inspected.gsub! @client_secret, "#{'*' * 36}#{@client_secret[36..]}"
|
170
170
|
end
|
171
171
|
|
172
172
|
inspected
|
data/lib/octokit/configurable.rb
CHANGED
@@ -144,7 +144,7 @@ module Octokit
|
|
144
144
|
private
|
145
145
|
|
146
146
|
def options
|
147
|
-
Octokit::Configurable.keys.
|
147
|
+
Octokit::Configurable.keys.to_h { |key| [key, instance_variable_get(:"@#{key}")] }
|
148
148
|
end
|
149
149
|
|
150
150
|
def fetch_client_id_and_secret(overrides = {})
|
data/lib/octokit/default.rb
CHANGED
@@ -34,9 +34,11 @@ module Octokit
|
|
34
34
|
# In Faraday 2.x, Faraday::Request::Retry was moved to a separate gem
|
35
35
|
# so we use it only when it's available.
|
36
36
|
if defined?(Faraday::Request::Retry)
|
37
|
-
|
37
|
+
retry_exceptions = Faraday::Request::Retry::DEFAULT_EXCEPTIONS + [Octokit::ServerError]
|
38
|
+
builder.use Faraday::Request::Retry, exceptions: retry_exceptions
|
38
39
|
elsif defined?(Faraday::Retry::Middleware)
|
39
|
-
|
40
|
+
retry_exceptions = Faraday::Retry::Middleware::DEFAULT_EXCEPTIONS + [Octokit::ServerError]
|
41
|
+
builder.use Faraday::Retry::Middleware, exceptions: retry_exceptions
|
40
42
|
end
|
41
43
|
|
42
44
|
builder.use Octokit::Middleware::FollowRedirects
|
@@ -49,7 +51,7 @@ module Octokit
|
|
49
51
|
# Configuration options
|
50
52
|
# @return [Hash]
|
51
53
|
def options
|
52
|
-
Octokit::Configurable.keys.
|
54
|
+
Octokit::Configurable.keys.to_h { |key| [key, send(key)] }
|
53
55
|
end
|
54
56
|
|
55
57
|
# Default access token from ENV
|
data/lib/octokit/gist.rb
CHANGED
data/lib/octokit/rate_limit.rb
CHANGED
@@ -20,10 +20,12 @@ module Octokit
|
|
20
20
|
# @return [RateLimit]
|
21
21
|
def self.from_response(response)
|
22
22
|
info = new
|
23
|
-
if response.respond_to?(:headers) && !response.headers.nil?
|
24
|
-
|
25
|
-
|
26
|
-
info.
|
23
|
+
headers = response.headers if response.respond_to?(:headers) && !response.headers.nil?
|
24
|
+
headers ||= response.response_headers if response.respond_to?(:response_headers) && !response.response_headers.nil?
|
25
|
+
if headers
|
26
|
+
info.limit = (headers['X-RateLimit-Limit'] || 1).to_i
|
27
|
+
info.remaining = (headers['X-RateLimit-Remaining'] || 1).to_i
|
28
|
+
info.resets_at = Time.at((headers['X-RateLimit-Reset'] || Time.now).to_i)
|
27
29
|
info.resets_in = [(info.resets_at - Time.now).to_i, 0].max
|
28
30
|
end
|
29
31
|
|
data/lib/octokit/repository.rb
CHANGED
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: 6.0
|
4
|
+
version: 6.1.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:
|
13
|
+
date: 2023-03-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|