google-gax 1.8.1 → 1.8.2

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: 8279f0cb721223f70e700c1f1522a14818b1052b8432f80c7a0c045c7b25d23d
4
- data.tar.gz: 8445b0a60852c993c43319fdef93ab3b21c58d1cea8e4b2fd3834805fd3e9a2d
3
+ metadata.gz: d88bc62f45f5b407ca80e07483f10611a5eea6d97bb479a079dd1e81fa3f9f8f
4
+ data.tar.gz: ea0b5d6d2bce892e939be9462fc66e2089a1bef2e689ac6404fd79656d307130
5
5
  SHA512:
6
- metadata.gz: 7e4416f90911979125b5e013bf4ecbc20a9e4d9091aecc7bed90b5f5f29f2d93f82bb38d2f6b3bf4ddc6fe001ba55ccb0aff9a4f92c003ddce2151218095b41e
7
- data.tar.gz: 4188f231b2b1c80098ebdf3c7fada3fb0dc3ff1b61a13b49c57fb9161fbfb66f116867409bb589866bcd52e9121ef0c5fc476f4b7f1e0e2d68224c8874110635
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
@@ -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.
@@ -29,6 +29,6 @@
29
29
 
30
30
  module Google
31
31
  module Gax
32
- VERSION = '1.8.1'.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
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-gax
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
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-10-11 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
@@ -58,6 +58,26 @@ dependencies:
58
58
  - - "<"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '2.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: googleapis-common-protos-types
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 1.0.4
68
+ - - "<"
69
+ - !ruby/object:Gem::Version
70
+ version: '2.0'
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: 1.0.4
78
+ - - "<"
79
+ - !ruby/object:Gem::Version
80
+ version: '2.0'
61
81
  - !ruby/object:Gem::Dependency
62
82
  name: google-protobuf
63
83
  requirement: !ruby/object:Gem::Requirement
@@ -186,6 +206,7 @@ files:
186
206
  - spec/google/gax/error_spec.rb
187
207
  - spec/google/gax/grpc_spec.rb
188
208
  - spec/google/gax/operation_spec.rb
209
+ - spec/google/gax/paged_enumerable_spec.rb
189
210
  - spec/google/gax/path_template_spec.rb
190
211
  - spec/google/gax/settings_spec.rb
191
212
  - spec/google/gax/util_spec.rb
@@ -195,7 +216,15 @@ homepage: https://github.com/googleapis/gax-ruby
195
216
  licenses:
196
217
  - BSD-3-Clause
197
218
  metadata: {}
198
- 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
+ *******************************************************************************
199
228
  rdoc_options: []
200
229
  require_paths:
201
230
  - lib
@@ -210,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
239
  - !ruby/object:Gem::Version
211
240
  version: '0'
212
241
  requirements: []
213
- rubygems_version: 3.0.3
242
+ rubygems_version: 3.1.6
214
243
  signing_key:
215
244
  specification_version: 4
216
245
  summary: Aids the development of APIs for clients and servers based on GRPC and Google