gapic-generator 0.48.1 → 0.49.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/CHANGELOG.md +7 -0
- data/README.md +2 -2
- data/lib/gapic/generator/version.rb +1 -1
- data/lib/gapic/generators/default_generator.rb +3 -0
- data/lib/gapic/presenters/enum_value_presenter.rb +12 -1
- data/lib/gapic/presenters/gem_presenter.rb +1 -1
- data/templates/default/gem/readme.text.erb +1 -1
- data/templates/default/proto_docs/_enum.text.erb +1 -1
- data/templates/default/service/client/_config.text.erb +2 -0
- data/templates/default/service/rest/client/_client.text.erb +6 -2
- data/templates/default/service/rest/client/_config.text.erb +2 -0
- data/templates/default/service/rest/test/method/_normal.text.erb +6 -6
- data/templates/default/service/rest/test/method/_server.text.erb +6 -6
- data/templates/default/service/test/method/_bidi.text.erb +5 -5
- data/templates/default/service/test/method/_client.text.erb +5 -5
- data/templates/default/service/test/method/_normal.text.erb +6 -6
- data/templates/default/service/test/method/_server.text.erb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f6930660b378784b8737b799f9218f7bfb11001307036e88f71f1393d228b2a2
|
|
4
|
+
data.tar.gz: 4c4c206b3b964eec613c55f7857f728df60663a4ce9db259e55e0197a9afcaad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d057c86b73503fb5061e9edc269881f68315d1b82234bcb96ce8cff8ba159a2e0df10ebc305962d62bf74086fad2f3492120b78e1c9686824f9a32d0d642c539
|
|
7
|
+
data.tar.gz: 806a7130234e071fecbc953c384fad1232a5a050d0989a7f8bc0a15b26ba860c70a011cac20b130f362c74cb92f42dbee97d0acdc3afd2845963288082b3e6db
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Release History for gapic-generator
|
|
2
2
|
|
|
3
|
+
### 0.49.0 / 2026-06-04
|
|
4
|
+
|
|
5
|
+
* Feature: add retry jitter configuration
|
|
6
|
+
* Feature: Skip generation for services without RPC methods defined
|
|
7
|
+
* Fix: rename variable in generated test methods to avoid field name collision
|
|
8
|
+
* Fix: prevent YARD failures on enum keywords
|
|
9
|
+
|
|
3
10
|
### 0.48.1 / 2026-03-17
|
|
4
11
|
|
|
5
12
|
* Fix: Add irb to dependencies
|
data/README.md
CHANGED
|
@@ -98,9 +98,9 @@ This is not an official Google project. While it is being used internally to
|
|
|
98
98
|
generate official Google API client libraries, there is no guarantee of support
|
|
99
99
|
or stability for any other use.
|
|
100
100
|
|
|
101
|
-
As of
|
|
101
|
+
As of May 2026, this generator can be run on Ruby 3.2 or later. In general,
|
|
102
102
|
we will make an effort to ensure it is supported on non-end-of-life versions of
|
|
103
|
-
Ruby.
|
|
103
|
+
Ruby. Currently, this includes support through Ruby 4.0.
|
|
104
104
|
|
|
105
105
|
Issues can be filed on GitHub at
|
|
106
106
|
https://github.com/googleapis/gapic-generator-ruby/issues.
|
|
@@ -63,6 +63,9 @@ module Gapic
|
|
|
63
63
|
files << g("binding_override", "lib/#{package.mixin_binding_overrides_file_path}", package: package) if package.mixin_binding_overrides? && package.generate_rest_clients?
|
|
64
64
|
|
|
65
65
|
package.services.each do |service|
|
|
66
|
+
# Skip services with no RPCs defined
|
|
67
|
+
next if service.methods.empty?
|
|
68
|
+
|
|
66
69
|
should_generate_grpc = service.generate_grpc_clients?
|
|
67
70
|
should_generate_rest = service.generate_rest_clients?
|
|
68
71
|
|
|
@@ -28,7 +28,18 @@ module Gapic
|
|
|
28
28
|
|
|
29
29
|
# @return [String] The enum value name without keyword collision.
|
|
30
30
|
def name
|
|
31
|
-
|
|
31
|
+
keyword_collision? ? "#{@value.parent.name}::#{@value.name}" : @value.name
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# @return [Boolean] Whether the enum name collides with a Ruby keyword.
|
|
35
|
+
def keyword_collision?
|
|
36
|
+
Gapic::RubyInfo.keywords.include? @value.name
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# @return [String] The doc stub string for the enum value. Prevents YARD warnings in cases of keyword
|
|
40
|
+
# collision.
|
|
41
|
+
def doc_line
|
|
42
|
+
keyword_collision? ? "const_set :#{@value.name}, #{@value.number}" : "#{@value.name} = #{@value.number}"
|
|
32
43
|
end
|
|
33
44
|
|
|
34
45
|
def doc_description
|
|
@@ -256,7 +256,7 @@ module Gapic
|
|
|
256
256
|
|
|
257
257
|
def dependencies
|
|
258
258
|
@dependencies ||= begin
|
|
259
|
-
deps = { "gapic-common" => "~> 1.
|
|
259
|
+
deps = { "gapic-common" => "~> 1.3" }
|
|
260
260
|
deps["grpc-google-iam-v1"] = "~> 1.11" if iam_dependency?
|
|
261
261
|
extra_deps = gem_config_dependencies
|
|
262
262
|
deps.merge! mixins_model.dependencies if mixins_model.mixins?
|
|
@@ -32,7 +32,7 @@ response = client.<%= method.name %> request
|
|
|
32
32
|
|
|
33
33
|
## Supported Ruby Versions
|
|
34
34
|
|
|
35
|
-
This library is supported on Ruby 3.
|
|
35
|
+
This library is supported on Ruby 3.2+.
|
|
36
36
|
|
|
37
37
|
Google provides official support for Ruby versions that are actively supported
|
|
38
38
|
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
99
99
|
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
100
100
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
101
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
101
102
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
102
103
|
# trigger a retry.
|
|
103
104
|
# @return [::Hash]
|
|
@@ -181,6 +182,7 @@ class Configuration
|
|
|
181
182
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
182
183
|
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
183
184
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
185
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
184
186
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
185
187
|
# trigger a retry.
|
|
186
188
|
#
|
|
@@ -134,7 +134,9 @@ class <%= service.rest.client_name %>
|
|
|
134
134
|
config.quota_project = @quota_project_id
|
|
135
135
|
config.endpoint = @config.endpoint
|
|
136
136
|
config.universe_domain = @config.universe_domain
|
|
137
|
-
<%- if
|
|
137
|
+
<%- if service.rest.mixin_should_generate_override_config? &&
|
|
138
|
+
subclient.respond_to?(:bindings_override) &&
|
|
139
|
+
!subclient.bindings_override.empty? -%>
|
|
138
140
|
config.bindings_override = @config.bindings_override
|
|
139
141
|
<%- end -%>
|
|
140
142
|
end
|
|
@@ -164,7 +166,9 @@ class <%= service.rest.client_name %>
|
|
|
164
166
|
config.quota_project = @quota_project_id
|
|
165
167
|
config.endpoint = @<%= service.stub_name %>.endpoint
|
|
166
168
|
config.universe_domain = @<%= service.stub_name %>.universe_domain
|
|
167
|
-
<%- if
|
|
169
|
+
<%- if service.rest.mixin_should_generate_override_config? &&
|
|
170
|
+
subclient.respond_to?(:bindings_override) &&
|
|
171
|
+
!subclient.bindings_override.empty? -%>
|
|
168
172
|
config.bindings_override = @config.bindings_override
|
|
169
173
|
<%- end -%>
|
|
170
174
|
config.logger = @<%= service.stub_name %>.logger if config.respond_to? :logger=
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
73
73
|
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
74
74
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
75
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
75
76
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
76
77
|
# trigger a retry.
|
|
77
78
|
# @return [::Hash]
|
|
@@ -153,6 +154,7 @@ class Configuration
|
|
|
153
154
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
154
155
|
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
155
156
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
157
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
156
158
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
157
159
|
# trigger a retry.
|
|
158
160
|
#
|
|
@@ -22,34 +22,34 @@ def test_<%= method.name %>
|
|
|
22
22
|
<%= method.service.rest.service_name_full %>::<%= method.service.rest.service_stub_name %>.stub :<%= method.rest.transcoding_helper_name %>, ["", "", {}] do
|
|
23
23
|
Gapic::Rest::ClientStub.stub :new, <%= method.name %>_client_stub do
|
|
24
24
|
# Create client
|
|
25
|
-
|
|
25
|
+
c = <%= full_client_name %>.new do |config|
|
|
26
26
|
config.credentials = :dummy_value
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# Use hash object
|
|
30
|
-
|
|
30
|
+
c.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }) do |_result, response|
|
|
31
31
|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
<%- if fields.any? -%>
|
|
35
35
|
# Use named arguments
|
|
36
|
-
|
|
36
|
+
c.<%= method.name %> <%= fields.map(&:as_kwarg).join ", " %> do |_result, response|
|
|
37
37
|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
<%- end -%>
|
|
41
41
|
# Use protobuf object
|
|
42
|
-
|
|
42
|
+
c.<%= method.name %> <%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>) do |_result, response|
|
|
43
43
|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
# Use hash object with options
|
|
47
|
-
|
|
47
|
+
c.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }, call_options) do |_result, response|
|
|
48
48
|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
# Use protobuf object with options
|
|
52
|
-
|
|
52
|
+
c.<%= method.name %>(<%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>), call_options) do |_result, response|
|
|
53
53
|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
|
|
54
54
|
end
|
|
55
55
|
|
|
@@ -22,34 +22,34 @@ def test_<%= method.name %>
|
|
|
22
22
|
<%= method.service.rest.service_name_full %>::<%= method.service.rest.service_stub_name %>.stub :<%= method.rest.transcoding_helper_name %>, ["", "", {}] do
|
|
23
23
|
Gapic::Rest::ClientStub.stub :new, <%= method.name %>_client_stub do
|
|
24
24
|
# Create client
|
|
25
|
-
|
|
25
|
+
c = <%= full_client_name %>.new do |config|
|
|
26
26
|
config.credentials = :dummy_value
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# Use hash object
|
|
30
|
-
|
|
30
|
+
c.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }) do |_result, response|
|
|
31
31
|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
|
|
32
32
|
end.first
|
|
33
33
|
|
|
34
34
|
<%- if fields.any? -%>
|
|
35
35
|
# Use named arguments
|
|
36
|
-
|
|
36
|
+
c.<%= method.name %> <%= fields.map(&:as_kwarg).join ", " %> do |_result, response|
|
|
37
37
|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
|
|
38
38
|
end.first
|
|
39
39
|
|
|
40
40
|
<%- end -%>
|
|
41
41
|
# Use protobuf object
|
|
42
|
-
|
|
42
|
+
c.<%= method.name %> <%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>) do |_result, response|
|
|
43
43
|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
|
|
44
44
|
end.first
|
|
45
45
|
|
|
46
46
|
# Use hash object with options
|
|
47
|
-
|
|
47
|
+
c.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }, call_options) do |_result, response|
|
|
48
48
|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
|
|
49
49
|
end.first
|
|
50
50
|
|
|
51
51
|
# Use protobuf object with options
|
|
52
|
-
|
|
52
|
+
c.<%= method.name %>(<%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>), call_options) do |_result, response|
|
|
53
53
|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
|
|
54
54
|
end.first
|
|
55
55
|
|
|
@@ -22,7 +22,7 @@ def test_<%= method.name %>
|
|
|
22
22
|
|
|
23
23
|
Gapic::ServiceStub.stub :new, <%= method.name %>_client_stub do
|
|
24
24
|
# Create client
|
|
25
|
-
|
|
25
|
+
c = <%= full_client_name %>.new do |config|
|
|
26
26
|
config.credentials = grpc_channel
|
|
27
27
|
end
|
|
28
28
|
|
|
@@ -30,7 +30,7 @@ def test_<%= method.name %>
|
|
|
30
30
|
request_hash = { <%= fields.map(&:as_kwarg).join ", " %> }
|
|
31
31
|
request_proto = <%= method.request_type %>.new <%= fields.map(&:as_kwarg).join ", " %>
|
|
32
32
|
enum_input = [request_hash, request_proto].to_enum
|
|
33
|
-
|
|
33
|
+
c.<%= method.name %> enum_input do |response, operation|
|
|
34
34
|
assert_kind_of Enumerable, response
|
|
35
35
|
response.to_a.each do |r|
|
|
36
36
|
assert_kind_of <%= method.return_type %>, r
|
|
@@ -42,7 +42,7 @@ def test_<%= method.name %>
|
|
|
42
42
|
request_hash = { <%= fields.map(&:as_kwarg).join ", " %> }
|
|
43
43
|
request_proto = <%= method.request_type %>.new <%= fields.map(&:as_kwarg).join ", " %>
|
|
44
44
|
stream_input = Gapic::StreamInput.new
|
|
45
|
-
|
|
45
|
+
c.<%= method.name %> stream_input do |response, operation|
|
|
46
46
|
assert_kind_of Enumerable, response
|
|
47
47
|
response.to_a.each do |r|
|
|
48
48
|
assert_kind_of <%= method.return_type %>, r
|
|
@@ -57,7 +57,7 @@ def test_<%= method.name %>
|
|
|
57
57
|
request_hash = { <%= fields.map(&:as_kwarg).join ", " %> }
|
|
58
58
|
request_proto = <%= method.request_type %>.new <%= fields.map(&:as_kwarg).join ", " %>
|
|
59
59
|
enum_input = [request_hash, request_proto].to_enum
|
|
60
|
-
|
|
60
|
+
c.<%= method.name %> enum_input, grpc_options do |response, operation|
|
|
61
61
|
assert_kind_of Enumerable, response
|
|
62
62
|
response.to_a.each do |r|
|
|
63
63
|
assert_kind_of <%= method.return_type %>, r
|
|
@@ -69,7 +69,7 @@ def test_<%= method.name %>
|
|
|
69
69
|
request_hash = { <%= fields.map(&:as_kwarg).join ", " %> }
|
|
70
70
|
request_proto = <%= method.request_type %>.new <%= fields.map(&:as_kwarg).join ", " %>
|
|
71
71
|
stream_input = Gapic::StreamInput.new
|
|
72
|
-
|
|
72
|
+
c.<%= method.name %> stream_input, grpc_options do |response, operation|
|
|
73
73
|
assert_kind_of Enumerable, response
|
|
74
74
|
response.to_a.each do |r|
|
|
75
75
|
assert_kind_of <%= method.return_type %>, r
|
|
@@ -22,7 +22,7 @@ def test_<%= method.name %>
|
|
|
22
22
|
|
|
23
23
|
Gapic::ServiceStub.stub :new, <%= method.name %>_client_stub do
|
|
24
24
|
# Create client
|
|
25
|
-
|
|
25
|
+
c = <%= full_client_name %>.new do |config|
|
|
26
26
|
config.credentials = grpc_channel
|
|
27
27
|
end
|
|
28
28
|
|
|
@@ -30,7 +30,7 @@ def test_<%= method.name %>
|
|
|
30
30
|
request_hash = { <%= fields.map(&:as_kwarg).join ", " %> }
|
|
31
31
|
request_proto = <%= method.request_type %>.new <%= fields.map(&:as_kwarg).join ", " %>
|
|
32
32
|
enum_input = [request_hash, request_proto].to_enum
|
|
33
|
-
|
|
33
|
+
c.<%= method.name %> enum_input do |response, operation|
|
|
34
34
|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ def test_<%= method.name %>
|
|
|
38
38
|
request_hash = { <%= fields.map(&:as_kwarg).join ", " %> }
|
|
39
39
|
request_proto = <%= method.request_type %>.new <%= fields.map(&:as_kwarg).join ", " %>
|
|
40
40
|
stream_input = Gapic::StreamInput.new
|
|
41
|
-
|
|
41
|
+
c.<%= method.name %> stream_input do |response, operation|
|
|
42
42
|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
|
|
43
43
|
end
|
|
44
44
|
stream_input << request_hash
|
|
@@ -49,7 +49,7 @@ def test_<%= method.name %>
|
|
|
49
49
|
request_hash = { <%= fields.map(&:as_kwarg).join ", " %> }
|
|
50
50
|
request_proto = <%= method.request_type %>.new <%= fields.map(&:as_kwarg).join ", " %>
|
|
51
51
|
enum_input = [request_hash, request_proto].to_enum
|
|
52
|
-
|
|
52
|
+
c.<%= method.name %> enum_input, grpc_options do |response, operation|
|
|
53
53
|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
|
|
54
54
|
end
|
|
55
55
|
|
|
@@ -57,7 +57,7 @@ def test_<%= method.name %>
|
|
|
57
57
|
request_hash = { <%= fields.map(&:as_kwarg).join ", " %> }
|
|
58
58
|
request_proto = <%= method.request_type %>.new <%= fields.map(&:as_kwarg).join ", " %>
|
|
59
59
|
stream_input = Gapic::StreamInput.new
|
|
60
|
-
|
|
60
|
+
c.<%= method.name %> stream_input, grpc_options do |response, operation|
|
|
61
61
|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
|
|
62
62
|
end
|
|
63
63
|
stream_input << request_hash
|
|
@@ -38,34 +38,34 @@ def test_<%= method.name %>
|
|
|
38
38
|
|
|
39
39
|
Gapic::ServiceStub.stub :new, <%= method.name %>_client_stub do
|
|
40
40
|
# Create client
|
|
41
|
-
|
|
41
|
+
c = <%= full_client_name %>.new do |config|
|
|
42
42
|
config.credentials = grpc_channel
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
# Use hash object
|
|
46
|
-
|
|
46
|
+
c.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }) do |response, operation|
|
|
47
47
|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
<%- if fields.any? -%>
|
|
51
51
|
# Use named arguments
|
|
52
|
-
|
|
52
|
+
c.<%= method.name %> <%= fields.map(&:as_kwarg).join ", " %> do |response, operation|
|
|
53
53
|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
<%- end -%>
|
|
57
57
|
# Use protobuf object
|
|
58
|
-
|
|
58
|
+
c.<%= method.name %> <%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>) do |response, operation|
|
|
59
59
|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
# Use hash object with options
|
|
63
|
-
|
|
63
|
+
c.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }, grpc_options) do |response, operation|
|
|
64
64
|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
# Use protobuf object with options
|
|
68
|
-
|
|
68
|
+
c.<%= method.name %>(<%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>), grpc_options) do |response, operation|
|
|
69
69
|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
|
|
70
70
|
end
|
|
71
71
|
|
|
@@ -38,12 +38,12 @@ def test_<%= method.name %>
|
|
|
38
38
|
|
|
39
39
|
Gapic::ServiceStub.stub :new, <%= method.name %>_client_stub do
|
|
40
40
|
# Create client
|
|
41
|
-
|
|
41
|
+
c = <%= full_client_name %>.new do |config|
|
|
42
42
|
config.credentials = grpc_channel
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
# Use hash object
|
|
46
|
-
|
|
46
|
+
c.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }) do |response, operation|
|
|
47
47
|
assert_kind_of Enumerable, response
|
|
48
48
|
response.to_a.each do |r|
|
|
49
49
|
assert_kind_of <%= method.return_type %>, r
|
|
@@ -52,7 +52,7 @@ def test_<%= method.name %>
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
# Use named arguments
|
|
55
|
-
|
|
55
|
+
c.<%= method.name %> <%= fields.map(&:as_kwarg).join ", " %> do |response, operation|
|
|
56
56
|
assert_kind_of Enumerable, response
|
|
57
57
|
response.to_a.each do |r|
|
|
58
58
|
assert_kind_of <%= method.return_type %>, r
|
|
@@ -61,7 +61,7 @@ def test_<%= method.name %>
|
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
# Use protobuf object
|
|
64
|
-
|
|
64
|
+
c.<%= method.name %> <%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>) do |response, operation|
|
|
65
65
|
assert_kind_of Enumerable, response
|
|
66
66
|
response.to_a.each do |r|
|
|
67
67
|
assert_kind_of <%= method.return_type %>, r
|
|
@@ -70,7 +70,7 @@ def test_<%= method.name %>
|
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
# Use hash object with options
|
|
73
|
-
|
|
73
|
+
c.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }, grpc_options) do |response, operation|
|
|
74
74
|
assert_kind_of Enumerable, response
|
|
75
75
|
response.to_a.each do |r|
|
|
76
76
|
assert_kind_of <%= method.return_type %>, r
|
|
@@ -79,7 +79,7 @@ def test_<%= method.name %>
|
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
# Use protobuf object with options
|
|
82
|
-
|
|
82
|
+
c.<%= method.name %>(<%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>), grpc_options) do |response, operation|
|
|
83
83
|
assert_kind_of Enumerable, response
|
|
84
84
|
response.to_a.each do |r|
|
|
85
85
|
assert_kind_of <%= method.return_type %>, r
|