google-gax 1.7.0 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7271bd48161698b84de9f66e337c3742e44b765f75fa1344c2e59b3608359e65
4
- data.tar.gz: d2483f6d0f41e82f6655a1d5893712785721b73b7c675772752f457c9de0986e
3
+ metadata.gz: d88bc62f45f5b407ca80e07483f10611a5eea6d97bb479a079dd1e81fa3f9f8f
4
+ data.tar.gz: ea0b5d6d2bce892e939be9462fc66e2089a1bef2e689ac6404fd79656d307130
5
5
  SHA512:
6
- metadata.gz: 8b92de0ba1398fd9d71a7cdd66aa000975677996fefcfdcf4828d12c6fff7194c0b93da9178eaf26d51d924f77dc3b493ad3bffba5011d1e8ea7bfb670d92311
7
- data.tar.gz: cf0103edeab0f7e8244b2e008d72974bb7562236281d6eed0ce2466740f48a56a433d934286d9205d89d84382003ace8f55527250cba09b4868b6b57b80b74e1
6
+ metadata.gz: 1f5267214e8085943be3a2614535f5df7f09c52af65209188cd10d1138a09cc18a32915757f03ab2b1597c1fd7173ab66e9d4b0b1f2a1dd986754cecd47c50c7
7
+ data.tar.gz: ba0f5165f230e7762001d3baa4749b3185fb879d865e43e67f35cf05afb33773ac70e177d38e5a7bd8f922012cfd3efc99ceb7020b1aaf83fb30e4507d9dc745
data/README.md CHANGED
@@ -1,8 +1,16 @@
1
1
  Google API Extensions for Ruby
2
2
  ================================
3
3
 
4
- [![Build Status](https://travis-ci.org/googleapis/gax-ruby.svg?branch=master)](https://travis-ci.org/googleapis/gax-ruby)
5
- [![Code Coverage](https://img.shields.io/codecov/c/github/googleapis/gax-ruby.svg)](https://codecov.io/github/googleapis/gax-ruby)
4
+ **This gem is officially end-of-life**
5
+
6
+ The `gax-ruby` gem included common code used by obsolete versions of the Google
7
+ API clients in https://github.com/googleapis/google-cloud-ruby. Up-to-date
8
+ versions of the client libraries no longer use this gem. If your app depends on
9
+ `gax-ruby`, we recommend updating the client library gems that depend on it.
10
+ Modern clients will depend on the `gapic-common` gem instead of `gax-ruby`.
11
+
12
+ **This gem is officially end-of-life**
13
+
6
14
  [![Gem Version](https://badge.fury.io/rb/google-gax.svg)](https://badge.fury.io/rb/google-gax)
7
15
 
8
16
  Google API Extensions for Ruby (gax-ruby) is a set of modules which aids the
@@ -21,7 +29,12 @@ provide a more convenient and idiomatic API surface to callers.
21
29
  Ruby Versions
22
30
  ---------------
23
31
 
24
- gax-ruby is currently tested with Ruby 2.2.4.
32
+ This library requires Ruby 2.4 or later.
33
+
34
+ In general, this library supports Ruby versions that are considered current and
35
+ supported by Ruby Core (that is, Ruby versions that are either in normal
36
+ maintenance or in security maintenance).
37
+ See https://www.ruby-lang.org/en/downloads/branches/ for further details.
25
38
 
26
39
 
27
40
  Contributing
@@ -177,18 +177,16 @@ module Google
177
177
  msg = "Value for key #{segment.literal} is not provided"
178
178
  raise ArgumentError.new(msg)
179
179
  end
180
- out.concat(PathTemplate.new(bindings[literal_sym]).segments)
180
+ out << bindings[literal_sym]
181
181
  binding = true
182
182
  elsif segment.kind == END_BINDING
183
183
  binding = false
184
184
  else
185
185
  next if binding
186
- out << segment
186
+ out << segment.literal.to_s
187
187
  end
188
188
  end
189
- path = self.class.format_segments(*out)
190
- match(path)
191
- path
189
+ out.join('/')
192
190
  end
193
191
 
194
192
  # Matches a fully qualified path template string.
@@ -511,7 +511,9 @@ module Google
511
511
  bundle_descriptor = bundle_descriptors[snake_name]
512
512
 
513
513
  defaults[snake_name] = CallSettings.new(
514
- timeout: timeout,
514
+ timeout: calc_method_timeout(
515
+ timeout, method_config, overriding_method
516
+ ),
515
517
  retry_options: merge_retry_options(
516
518
  construct_retry(method_config,
517
519
  service_config['retry_codes'],
@@ -533,11 +535,20 @@ module Google
533
535
  defaults
534
536
  end
535
537
 
538
+ # @private Determine timeout in seconds for the current method.
539
+ def calc_method_timeout(timeout, method_config, overriding_method)
540
+ timeout_override = method_config['timeout_millis']
541
+ if overriding_method && overriding_method.key?('timeout_millis')
542
+ timeout_override = overriding_method['timeout_millis']
543
+ end
544
+ timeout_override ? timeout_override / 1000 : timeout
545
+ end
546
+
536
547
  module_function :construct_settings, :construct_bundling,
537
548
  :construct_retry, :upper_camel_to_lower_underscore,
538
- :merge_retry_options
549
+ :merge_retry_options, :calc_method_timeout
539
550
  private_class_method :construct_bundling, :construct_retry,
540
551
  :upper_camel_to_lower_underscore,
541
- :merge_retry_options
552
+ :merge_retry_options, :calc_method_timeout
542
553
  end
543
554
  end
@@ -29,6 +29,6 @@
29
29
 
30
30
  module Google
31
31
  module Gax
32
- VERSION = '1.7.0'.freeze
32
+ VERSION = '1.8.2'.freeze
33
33
  end
34
34
  end
@@ -37,4 +37,15 @@ message User {
37
37
 
38
38
  message Post {
39
39
  string text = 1;
40
- }
40
+ }
41
+
42
+ message GoodPagedRequest {
43
+ string name = 1;
44
+ int32 page_size = 2;
45
+ string page_token = 3;
46
+ }
47
+
48
+ message GoodPagedResponse {
49
+ repeated User users = 1;
50
+ string next_page_token = 2;
51
+ }
@@ -24,6 +24,15 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
24
24
  add_message "google.protobuf.Post" do
25
25
  optional :text, :string, 1
26
26
  end
27
+ add_message "google.protobuf.GoodPagedRequest" do
28
+ optional :name, :string, 1
29
+ optional :page_size, :int32, 2
30
+ optional :page_token, :string, 3
31
+ end
32
+ add_message "google.protobuf.GoodPagedResponse" do
33
+ repeated :users, :message, 1, "google.protobuf.User"
34
+ optional :next_page_token, :string, 2
35
+ end
27
36
  end
28
37
 
29
38
  module Google
@@ -32,5 +41,7 @@ module Google
32
41
  User = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.User").msgclass
33
42
  User::UserType = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.User.UserType").enummodule
34
43
  Post = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Post").msgclass
44
+ GoodPagedRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.GoodPagedRequest").msgclass
45
+ GoodPagedResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.GoodPagedResponse").msgclass
35
46
  end
36
47
  end
@@ -0,0 +1,103 @@
1
+ # Copyright 2019, Google LLC
2
+ # All rights reserved.
3
+ #
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are
6
+ # met:
7
+ #
8
+ # * Redistributions of source code must retain the above copyright
9
+ # notice, this list of conditions and the following disclaimer.
10
+ # * Redistributions in binary form must reproduce the above
11
+ # copyright notice, this list of conditions and the following disclaimer
12
+ # in the documentation and/or other materials provided with the
13
+ # distribution.
14
+ # * Neither the name of Google LLC nor the names of its
15
+ # contributors may be used to endorse or promote products derived from
16
+ # this software without specific prior written permission.
17
+ #
18
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ # 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ require 'google/gax'
31
+ require 'spec/fixtures/fixture_pb'
32
+
33
+ describe Google::Gax::PagedEnumerable do
34
+ it 'enumerates all resources' do
35
+ api_responses = [
36
+ Google::Protobuf::GoodPagedResponse.new(
37
+ users: [
38
+ Google::Protobuf::User.new(name: 'foo'),
39
+ Google::Protobuf::User.new(name: 'bar')
40
+ ],
41
+ next_page_token: 'next'
42
+ ),
43
+ Google::Protobuf::GoodPagedResponse.new(
44
+ users: [
45
+ Google::Protobuf::User.new(name: 'baz'),
46
+ Google::Protobuf::User.new(name: 'bif')
47
+ ]
48
+ )
49
+ ]
50
+ paged_enum = Google::Gax::PagedEnumerable.new(
51
+ 'page_token', 'next_page_token', 'users'
52
+ )
53
+ api_call = lambda do |_req, _blk = nil|
54
+ api_responses.shift
55
+ end
56
+ request = Google::Protobuf::GoodPagedRequest.new
57
+ fake_settings = OpenStruct.new(page_token: nil)
58
+ paged_enum.start(api_call, request, fake_settings, nil)
59
+
60
+ exp_names = []
61
+ paged_enum.each do |user|
62
+ exp_names << user.name
63
+ end
64
+ expect(exp_names).to eq(%w[foo bar baz bif])
65
+ end
66
+
67
+ it 'enumerates all pages' do
68
+ api_responses = [
69
+ Google::Protobuf::GoodPagedResponse.new(
70
+ users: [
71
+ Google::Protobuf::User.new(name: 'foo'),
72
+ Google::Protobuf::User.new(name: 'bar')
73
+ ],
74
+ next_page_token: 'next'
75
+ ),
76
+ Google::Protobuf::GoodPagedResponse.new(
77
+ users: [
78
+ Google::Protobuf::User.new(name: 'baz'),
79
+ Google::Protobuf::User.new(name: 'bif')
80
+ ]
81
+ )
82
+ ]
83
+ paged_enum = Google::Gax::PagedEnumerable.new(
84
+ 'page_token', 'next_page_token', 'users'
85
+ )
86
+ api_call = lambda do |_req, _blk = nil|
87
+ api_responses.shift
88
+ end
89
+ request = Google::Protobuf::GoodPagedRequest.new
90
+ fake_settings = OpenStruct.new(page_token: nil)
91
+ paged_enum.start(api_call, request, fake_settings, nil)
92
+
93
+ exp_names = []
94
+ paged_enum.each_page do |page|
95
+ exp_page_names = []
96
+ page.each do |user|
97
+ exp_page_names << user.name
98
+ end
99
+ exp_names << exp_page_names
100
+ end
101
+ expect(exp_names).to eq([%w[foo bar], %w[baz bif]])
102
+ end
103
+ end
@@ -141,6 +141,20 @@ describe Google::Gax::PathTemplate do
141
141
  want = 'bar/1/2/foo/3'
142
142
  expect(template.render(**params)).to eq(want)
143
143
  end
144
+
145
+ it 'handles path values with spaces' do
146
+ template = PathTemplate.new('bar/**/foo/*')
147
+ params = symbolize_keys('$0' => '1 - 2', '$1' => '3')
148
+ want = 'bar/1 - 2/foo/3'
149
+ expect(template.render(**params)).to eq(want)
150
+ end
151
+
152
+ it 'handles named path values with spaces' do
153
+ template = PathTemplate.new('bar/{bif}/foo/{baz}')
154
+ params = symbolize_keys(bif: '1 - 2', baz: '3/4')
155
+ want = 'bar/1 - 2/foo/3/4'
156
+ expect(template.render(**params)).to eq(want)
157
+ end
144
158
  end
145
159
 
146
160
  describe 'method `to_s`' do
@@ -63,6 +63,9 @@ A_CONFIG = {
63
63
  'SomeHTTPSPageStreamingMethod' => {
64
64
  'retry_codes_name' => 'bar_retry',
65
65
  'retry_params_name' => 'default'
66
+ },
67
+ 'TimeoutMethod' => {
68
+ 'timeout_millis' => 10_000
66
69
  }
67
70
  }
68
71
  }
@@ -119,6 +122,9 @@ describe Google::Gax do
119
122
  )
120
123
  expect(settings.metadata).to match('key' => 'value')
121
124
  expect(settings.errors).to match_array([StandardError])
125
+
126
+ settings = defaults['timeout_method']
127
+ expect(settings.timeout).to be(10)
122
128
  end
123
129
 
124
130
  it 'overrides settings' do
@@ -129,6 +135,9 @@ describe Google::Gax do
129
135
  'SomeHTTPSPageStreamingMethod' => nil,
130
136
  'BundlingMethod' => {
131
137
  'bundling' => nil
138
+ },
139
+ 'TimeoutMethod' => {
140
+ 'timeout_millis' => nil
132
141
  }
133
142
  }
134
143
  }
@@ -149,6 +158,9 @@ describe Google::Gax do
149
158
  expect(settings.timeout).to be(30)
150
159
  expect(settings.page_descriptor).to be_a(Google::Gax::PageDescriptor)
151
160
  expect(settings.retry_options).to be_nil
161
+
162
+ settings = defaults['timeout_method']
163
+ expect(settings.timeout).to be(30)
152
164
  end
153
165
 
154
166
  it 'overrides settings more precisely' do
@@ -174,6 +186,9 @@ describe Google::Gax do
174
186
  'BundlingMethod' => {
175
187
  'retry_params_name' => 'default',
176
188
  'retry_codes_name' => 'baz_retry'
189
+ },
190
+ 'TimeoutMethod' => {
191
+ 'timeout_millis' => 20_000
177
192
  }
178
193
  }
179
194
  }
@@ -205,5 +220,8 @@ describe Google::Gax do
205
220
  expect(settings.retry_options.retry_codes).to match_array(
206
221
  [RETRY_DICT['code_c']]
207
222
  )
223
+
224
+ settings = defaults['timeout_method']
225
+ expect(settings.timeout).to be(20)
208
226
  end
209
227
  end
metadata CHANGED
@@ -1,42 +1,50 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-gax
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google API Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-27 00:00:00.000000000 Z
11
+ date: 2021-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: googleauth
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 0.6.2
20
- - - "<"
17
+ - - "~>"
21
18
  - !ruby/object:Gem::Version
22
- version: 0.10.0
19
+ version: '0.9'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 0.6.2
30
- - - "<"
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: 0.10.0
26
+ version: '0.9'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: grpc
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.24'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.24'
41
+ - !ruby/object:Gem::Dependency
42
+ name: googleapis-common-protos
35
43
  requirement: !ruby/object:Gem::Requirement
36
44
  requirements:
37
45
  - - ">="
38
46
  - !ruby/object:Gem::Version
39
- version: 1.7.2
47
+ version: 1.3.9
40
48
  - - "<"
41
49
  - !ruby/object:Gem::Version
42
50
  version: '2.0'
@@ -46,17 +54,17 @@ dependencies:
46
54
  requirements:
47
55
  - - ">="
48
56
  - !ruby/object:Gem::Version
49
- version: 1.7.2
57
+ version: 1.3.9
50
58
  - - "<"
51
59
  - !ruby/object:Gem::Version
52
60
  version: '2.0'
53
61
  - !ruby/object:Gem::Dependency
54
- name: googleapis-common-protos
62
+ name: googleapis-common-protos-types
55
63
  requirement: !ruby/object:Gem::Requirement
56
64
  requirements:
57
65
  - - ">="
58
66
  - !ruby/object:Gem::Version
59
- version: 1.3.5
67
+ version: 1.0.4
60
68
  - - "<"
61
69
  - !ruby/object:Gem::Version
62
70
  version: '2.0'
@@ -66,7 +74,7 @@ dependencies:
66
74
  requirements:
67
75
  - - ">="
68
76
  - !ruby/object:Gem::Version
69
- version: 1.3.5
77
+ version: 1.0.4
70
78
  - - "<"
71
79
  - !ruby/object:Gem::Version
72
80
  version: '2.0'
@@ -76,14 +84,14 @@ dependencies:
76
84
  requirements:
77
85
  - - "~>"
78
86
  - !ruby/object:Gem::Version
79
- version: '3.2'
87
+ version: '3.9'
80
88
  type: :runtime
81
89
  prerelease: false
82
90
  version_requirements: !ruby/object:Gem::Requirement
83
91
  requirements:
84
92
  - - "~>"
85
93
  - !ruby/object:Gem::Version
86
- version: '3.2'
94
+ version: '3.9'
87
95
  - !ruby/object:Gem::Dependency
88
96
  name: rly
89
97
  requirement: !ruby/object:Gem::Requirement
@@ -198,6 +206,7 @@ files:
198
206
  - spec/google/gax/error_spec.rb
199
207
  - spec/google/gax/grpc_spec.rb
200
208
  - spec/google/gax/operation_spec.rb
209
+ - spec/google/gax/paged_enumerable_spec.rb
201
210
  - spec/google/gax/path_template_spec.rb
202
211
  - spec/google/gax/settings_spec.rb
203
212
  - spec/google/gax/util_spec.rb
@@ -207,7 +216,15 @@ homepage: https://github.com/googleapis/gax-ruby
207
216
  licenses:
208
217
  - BSD-3-Clause
209
218
  metadata: {}
210
- post_install_message:
219
+ post_install_message: |
220
+ *******************************************************************************
221
+ The google-gax gem is officially end-of-life and will not be updated further.
222
+
223
+ If your app uses the google-gax gem, it likely is using obsolete versions of
224
+ some Google Cloud client library (google-cloud-*) gem that depends on it. We
225
+ recommend updating any such libraries that depend on google-gax. Modern Google
226
+ Cloud client libraries will depend on the gapic-common gem instead.
227
+ *******************************************************************************
211
228
  rdoc_options: []
212
229
  require_paths:
213
230
  - lib
@@ -215,14 +232,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
215
232
  requirements:
216
233
  - - ">="
217
234
  - !ruby/object:Gem::Version
218
- version: 2.0.0
235
+ version: 2.4.0
219
236
  required_rubygems_version: !ruby/object:Gem::Requirement
220
237
  requirements:
221
238
  - - ">="
222
239
  - !ruby/object:Gem::Version
223
240
  version: '0'
224
241
  requirements: []
225
- rubygems_version: 3.0.3
242
+ rubygems_version: 3.1.6
226
243
  signing_key:
227
244
  specification_version: 4
228
245
  summary: Aids the development of APIs for clients and servers based on GRPC and Google