google-apis-core 0.4.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -9
- data/OVERVIEW.md +2 -2
- data/lib/google/apis/core/http_command.rb +12 -4
- data/lib/google/apis/core/version.rb +1 -1
- data/lib/google/apis/errors.rb +5 -1
- data/lib/google/apis/options.rb +17 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a06abcc898df4624c92e688e9a96df1b80a4672b9a1e3ab571fa050510eb7536
|
4
|
+
data.tar.gz: d52f59c6503a787921c8dee5dacd5c7420daca2d67ead5cdb36fe70974ab7bf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 259dfe34f6d13f9f2381b4cf5c3d88a9aaeb46c954df0dd1b5f3c5029896dbef3853b4a76f5b9c3e79b38cff1c1fbb8a3d205c41824cebe9cdc66f8c0098d421
|
7
|
+
data.tar.gz: f383d03683daabbade354ec14c1708cefe2f5fd58bdee645e2d173d2fb9c95e2e35828750da8b1afd6449256a11374d953e87251cbc176595436fada8a12850d
|
data/CHANGELOG.md
CHANGED
@@ -1,25 +1,42 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
-
|
3
|
+
### 0.6.0 (2022-06-15)
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* add few more errors as retriable errors
|
8
|
+
|
9
|
+
### 0.5.0 (2022-05-15)
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* Add support for retry options to be configurable
|
14
|
+
|
15
|
+
### 0.4.2 (2022-01-21)
|
16
|
+
|
17
|
+
#### Bug Fixes
|
18
|
+
|
19
|
+
* Support for max elapsed time configuration.
|
20
|
+
|
21
|
+
### 0.4.1 (2021-07-19)
|
4
22
|
|
5
23
|
* FIX: Prevent duplicated pagination when a response returns an empty string as the next page token.
|
6
24
|
|
7
|
-
|
25
|
+
### 0.4.0 (2021-06-28)
|
8
26
|
|
9
27
|
* Expanded googleauth dependency to include future 1.x versions
|
10
28
|
|
11
|
-
|
12
|
-
|
13
|
-
### Features
|
29
|
+
### 0.3.0 (2021-03-07)
|
14
30
|
|
15
|
-
|
31
|
+
#### Features
|
16
32
|
|
17
|
-
|
33
|
+
* Drop support for Ruby 2.4 and add support for Ruby 3.0
|
18
34
|
|
35
|
+
### 0.2.1 (2021-01-25)
|
19
36
|
|
20
|
-
|
37
|
+
#### Bug Fixes
|
21
38
|
|
22
|
-
*
|
39
|
+
* Add webrick to the gem dependencies, for Ruby 3 compatibility
|
23
40
|
|
24
41
|
### 0.2.0 (2021-01-06)
|
25
42
|
|
data/OVERVIEW.md
CHANGED
@@ -8,8 +8,8 @@ need to install it by itself.
|
|
8
8
|
|
9
9
|
More detailed descriptions of the Google legacy REST clients are available in two documents.
|
10
10
|
|
11
|
-
* The [Usage Guide](https://github.com/googleapis/google-api-ruby-client/blob/
|
12
|
-
* The [Auth Guide](https://github.com/googleapis/google-api-ruby-client/blob/
|
11
|
+
* The [Usage Guide](https://github.com/googleapis/google-api-ruby-client/blob/main/docs/usage-guide.md) discusses how to make API calls, how to use the provided data structures, and how to work the various features of the client library, including media upload and download, error handling, retries, pagination, and logging.
|
12
|
+
* The [Auth Guide](https://github.com/googleapis/google-api-ruby-client/blob/main/docs/auth-guide.md) discusses authentication in the client libraries, including API keys, OAuth 2.0, service accounts, and environment variables.
|
13
13
|
|
14
14
|
For reference information on specific calls in the clients, see the {Google::Apis class reference docs}.
|
15
15
|
|
@@ -27,7 +27,10 @@ module Google
|
|
27
27
|
class HttpCommand
|
28
28
|
include Logging
|
29
29
|
|
30
|
-
RETRIABLE_ERRORS = [Google::Apis::ServerError,
|
30
|
+
RETRIABLE_ERRORS = [Google::Apis::ServerError,
|
31
|
+
Google::Apis::RateLimitError,
|
32
|
+
Google::Apis::TransmissionError,
|
33
|
+
Google::Apis::RequestTimeOutError]
|
31
34
|
|
32
35
|
begin
|
33
36
|
require 'opencensus'
|
@@ -100,8 +103,10 @@ module Google
|
|
100
103
|
opencensus_begin_span
|
101
104
|
begin
|
102
105
|
Retriable.retriable tries: options.retries + 1,
|
103
|
-
|
104
|
-
|
106
|
+
max_elapsed_time: options.max_elapsed_time,
|
107
|
+
base_interval: options.base_interval,
|
108
|
+
max_interval: options.max_interval,
|
109
|
+
multiplier: options.multiplier,
|
105
110
|
on: RETRIABLE_ERRORS do |try|
|
106
111
|
# This 2nd level retriable only catches auth errors, and supports 1 retry, which allows
|
107
112
|
# auth to be re-attempted without having to retry all sorts of other failures like
|
@@ -223,6 +228,9 @@ module Google
|
|
223
228
|
when 429
|
224
229
|
message ||= 'Rate limit exceeded'
|
225
230
|
raise Google::Apis::RateLimitError.new(message, status_code: status, header: header, body: body)
|
231
|
+
when 408
|
232
|
+
message ||= 'Request time out'
|
233
|
+
raise Google::Apis::RequestTimeOutError.new(message, status_code: status, header: header, body: body)
|
226
234
|
when 304, 400, 402...500
|
227
235
|
message ||= 'Invalid request'
|
228
236
|
raise Google::Apis::ClientError.new(message, status_code: status, header: header, body: body)
|
@@ -276,7 +284,7 @@ module Google
|
|
276
284
|
rescue Google::Apis::Error => e
|
277
285
|
err = e
|
278
286
|
end
|
279
|
-
elsif err.is_a?(HTTPClient::TimeoutError) || err.is_a?(SocketError)
|
287
|
+
elsif err.is_a?(HTTPClient::TimeoutError) || err.is_a?(SocketError) || err.is_a?(HTTPClient::KeepAliveDisconnected) || err.is_a?(Errno::ECONNREFUSED) || err.is_a?(Errno::ETIMEDOUT)
|
280
288
|
err = Google::Apis::TransmissionError.new(err)
|
281
289
|
end
|
282
290
|
block.call(nil, err) if block_given?
|
data/lib/google/apis/errors.rb
CHANGED
data/lib/google/apis/options.rb
CHANGED
@@ -28,6 +28,10 @@ module Google
|
|
28
28
|
RequestOptions = Struct.new(
|
29
29
|
:authorization,
|
30
30
|
:retries,
|
31
|
+
:max_elapsed_time,
|
32
|
+
:base_interval,
|
33
|
+
:max_interval,
|
34
|
+
:multiplier,
|
31
35
|
:header,
|
32
36
|
:normalize_unicode,
|
33
37
|
:skip_serialization,
|
@@ -66,6 +70,15 @@ module Google
|
|
66
70
|
# @return [Signet::OAuth2::Client, #apply(Hash)] OAuth2 credentials.
|
67
71
|
# @!attribute [rw] retries
|
68
72
|
# @return [Fixnum] Number of times to retry requests on server error.
|
73
|
+
# @!attribute [rw] max_elapsed_time
|
74
|
+
# @return [Fixnum] Total time in seconds that requests are allowed to keep being retried.
|
75
|
+
# @!attribute [rw] base_interval
|
76
|
+
# @return [Float] The initial interval in seconds between tries.
|
77
|
+
# @!attribute [rw] max_interval
|
78
|
+
# @return [Fixnum] The maximum interval in seconds that any individual retry can reach.
|
79
|
+
# @!attribute [rw] multiplier
|
80
|
+
# @return [rw] Each successive interval grows by this factor. A multipler of 1.5 means the next interval
|
81
|
+
# will be 1.5x the current interval.
|
69
82
|
# @!attribute [rw] header
|
70
83
|
# @return [Hash<String,String>] Additional HTTP headers to include in requests.
|
71
84
|
# @!attribute [rw] normalize_unicode
|
@@ -106,6 +119,10 @@ module Google
|
|
106
119
|
ClientOptions.default.application_version = '0.0.0'
|
107
120
|
ClientOptions.default.transparent_gzip_decompression = true
|
108
121
|
RequestOptions.default.retries = 0
|
122
|
+
RequestOptions.default.max_elapsed_time = 900
|
123
|
+
RequestOptions.default.base_interval = 1
|
124
|
+
RequestOptions.default.max_interval = 60
|
125
|
+
RequestOptions.default.multiplier = 2
|
109
126
|
RequestOptions.default.normalize_unicode = false
|
110
127
|
RequestOptions.default.skip_serialization = false
|
111
128
|
RequestOptions.default.skip_deserialization = false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-apis-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: representable
|
@@ -183,9 +183,9 @@ licenses:
|
|
183
183
|
- Apache-2.0
|
184
184
|
metadata:
|
185
185
|
bug_tracker_uri: https://github.com/googleapis/google-api-ruby-client/issues
|
186
|
-
changelog_uri: https://github.com/googleapis/google-api-ruby-client/tree/
|
187
|
-
documentation_uri: https://googleapis.dev/ruby/google-apis-core/v0.
|
188
|
-
source_code_uri: https://github.com/googleapis/google-api-ruby-client/tree/
|
186
|
+
changelog_uri: https://github.com/googleapis/google-api-ruby-client/tree/main/google-apis-core/CHANGELOG.md
|
187
|
+
documentation_uri: https://googleapis.dev/ruby/google-apis-core/v0.6.0
|
188
|
+
source_code_uri: https://github.com/googleapis/google-api-ruby-client/tree/main/google-apis-core
|
189
189
|
post_install_message:
|
190
190
|
rdoc_options: []
|
191
191
|
require_paths:
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
- !ruby/object:Gem::Version
|
202
202
|
version: '0'
|
203
203
|
requirements: []
|
204
|
-
rubygems_version: 3.
|
204
|
+
rubygems_version: 3.3.14
|
205
205
|
signing_key:
|
206
206
|
specification_version: 4
|
207
207
|
summary: Common utility and base classes for legacy Google REST clients
|