gapic-generator 0.48.1 → 0.50.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65e74230641390ed2b959a149e6cb1422321a69a5be01763e2a1f0a9d8c628be
4
- data.tar.gz: 8f3deffc1abdb04553377e20d2af665f447925fc792d89a5e7ce5c8d0632ba85
3
+ metadata.gz: 2d7ec98be6131e97a365a5d526d0794c1009d93f27ab3fd4e0f92950fb731a88
4
+ data.tar.gz: 6fcf2cc7a6f3043eeb0a1e0b6d4b1433939aadef063e965a257ec1710edc433b
5
5
  SHA512:
6
- metadata.gz: 4107e328d1a13816aada3e845f567d36d757a7ae237cbaa81f706b67f54ce8795429ff0e43e7c9d8ac093dce02ee60d2da40b8e01e66888dea4d5581ba658c96
7
- data.tar.gz: 1d33abbbcf6995d1035e94672f44ee4660dd560205f75b0af7e4c0799a94a4bcbf7d6e3d6cd6b5ae121db388a73699a932a989d2a388b588394a8dd03c5d28c4
6
+ metadata.gz: 0ac32f92bfff483181c5e81b6749be9ddc005852dc4a900003d6cdd386dc6cdee6a45020c18ce30c27c98478176bd997455b6e1a2f3137e46e50a097eeae2f2e
7
+ data.tar.gz: 4542f129c100cb51b0c63238571e6cad708d2fe83b2b97dad1df3c42b60879d7d6e272635523e39d42fe85d0c9a9864a390b438eee216a135475c5f64e4bc2dc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Release History for gapic-generator
2
2
 
3
+ ### 0.50.0 / 2026-07-13
4
+
5
+ * Feature: Add minitest-reporters dependency and shared preloader to generator templates
6
+
7
+ ### 0.49.0 / 2026-06-04
8
+
9
+ * Feature: add retry jitter configuration
10
+ * Feature: Skip generation for services without RPC methods defined
11
+ * Fix: rename variable in generated test methods to avoid field name collision
12
+ * Fix: prevent YARD failures on enum keywords
13
+
3
14
  ### 0.48.1 / 2026-03-17
4
15
 
5
16
  * 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 January 2024, this generator can be run on Ruby 3.0 or later. In general,
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.
@@ -5,7 +5,7 @@
5
5
  # Creates /workspace/gapic-generator-<%= gem_name %>.gem
6
6
  # to be copied into the final runtime image.
7
7
  ##
8
- FROM ruby:2.6-stretch as builder
8
+ FROM ruby:2.6-stretch@sha256:53036d1d5886b2904a03e86400afb933ce713a03657718f1eb562c3ee93b863f as builder
9
9
  WORKDIR /workspace
10
10
 
11
11
  # Copy code from the local directory.
@@ -20,11 +20,11 @@ RUN gem build -o gapic-generator-<%= gem_name %>.gem \
20
20
  # Runtime image.
21
21
  # Installs the generator executables, common protos, and an entrypoint.
22
22
  ##
23
- FROM ruby:2.6-stretch
23
+ FROM ruby:2.6-stretch@sha256:53036d1d5886b2904a03e86400afb933ce713a03657718f1eb562c3ee93b863f
24
24
  WORKDIR /workspace
25
25
 
26
26
  # Install common protos.
27
- COPY --from=gcr.io/gapic-images/api-common-protos:beta /protos/ /workspace/common-protos/
27
+ COPY --from=gcr.io/gapic-images/api-common-protos:beta@sha256:d5725b72fc0ac14e7abf49731806c509a257e332e6a43bfa55f3674125fe120f /protos/ /workspace/common-protos/
28
28
 
29
29
  # Copy gems from the builder.
30
30
  COPY --from=builder /workspace/*.gem /workspace/
@@ -1,4 +1,3 @@
1
- Gemfile.lock
2
1
  .DS_STORE
3
2
  /.bundle/
4
3
  /.yardoc
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Gapic
18
18
  module Generator
19
- VERSION = "0.48.1"
19
+ VERSION = "0.50.0"
20
20
  end
21
21
  end
@@ -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
 
@@ -52,7 +52,8 @@ module Gapic
52
52
  end
53
53
 
54
54
  ##
55
- # Whether this is a basic double-star ("**") pattern
55
+ # Whether this is a basic double-star ("**") pattern (e.g. `{name=**}`).
56
+ # Basic double-star patterns match the entire parameter value.
56
57
  # @return [Boolean]
57
58
  def double_star_pattern?
58
59
  @segments.length == 1 && @segments[0].pattern == "**"
@@ -66,12 +67,22 @@ module Gapic
66
67
  end
67
68
 
68
69
  ##
69
- # Converts the PathPattern into a regex string
70
+ # Converts the PathPattern into a regex string.
71
+ #
72
+ # Note: Double wildcard segments (`**`) are compiled with a named capture group
73
+ # `(?<__wildcard__>.*)`. This allows the runtime library (`gapic-common`) to extract
74
+ # the isolated substring matching the wildcard.
75
+ #
70
76
  # @return [String]
71
77
  def to_regex_str
78
+ if double_star_pattern?
79
+ # If the pattern is just a double wildcard (e.g. `{name=**}`), capture everything.
80
+ return "(?<__wildcard__>.*)"
81
+ end
82
+
72
83
  regex_str = segments.first.to_regex_str
73
84
 
74
- # for double wildcards the leading `/`` is optional
85
+ # for double wildcards the leading `/` is optional
75
86
  # e.g. `foo/**` should match `foo`
76
87
  # this is why segments 'bring' the leading separator
77
88
  # with them as they build the pattern
@@ -79,7 +90,8 @@ module Gapic
79
90
  is_double_wildcard = segment.pattern == "**"
80
91
 
81
92
  regex_str = if is_double_wildcard
82
- "#{regex_str}(?:/.*)?"
93
+ # Capture the multi-segment suffix path specifically inside `__wildcard__`
94
+ "#{regex_str}(?:/(?<__wildcard__>.*))?"
83
95
  else
84
96
  "#{regex_str}/#{segment.to_regex_str}"
85
97
  end
@@ -28,7 +28,18 @@ module Gapic
28
28
 
29
29
  # @return [String] The enum value name without keyword collision.
30
30
  def name
31
- Gapic::RubyInfo.keywords.include?(@value.name) ? "#{@value.parent.name}::#{@value.name}" : @value.name
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
@@ -61,8 +61,12 @@ module Gapic
61
61
  end
62
62
  end
63
63
 
64
+ # Select the primary non-common service for documentation.
65
+ # Prioritize services with methods so that the README quickstart showcases a functional client.
66
+ # If all are empty (e.g., in unit tests), fall back to the first non-common service.
64
67
  def first_non_common_service
65
- services.find { |service| service.common_service_delegate.nil? }
68
+ non_common = services.select { |service| service.common_service_delegate.nil? }
69
+ non_common.find { |service| service.methods.any? } || non_common.first
66
70
  end
67
71
 
68
72
  def proto_files
@@ -256,7 +260,7 @@ module Gapic
256
260
 
257
261
  def dependencies
258
262
  @dependencies ||= begin
259
- deps = { "gapic-common" => "~> 1.2" }
263
+ deps = { "gapic-common" => "~> 1.3" }
260
264
  deps["grpc-google-iam-v1"] = "~> 1.11" if iam_dependency?
261
265
  extra_deps = gem_config_dependencies
262
266
  deps.merge! mixins_model.dependencies if mixins_model.mixins?
@@ -69,7 +69,7 @@ module Gapic
69
69
  @value = convert field["value"]
70
70
  @input_parameter = field["input_parameter"]
71
71
  @comment = field["comment"]
72
- @comment = nil if @comment&.empty?
72
+ @comment = nil if @comment && @comment.empty?
73
73
  @value_is_file = field["value_is_file"]
74
74
  end
75
75
 
@@ -33,7 +33,7 @@ module Gapic
33
33
  def initialize proto, json
34
34
  @name = proto.name
35
35
  @description = proto.description
36
- @description = nil if @description&.empty?
36
+ @description = nil if @description && @description.empty?
37
37
  @type = TypePresenter.new proto&.type, json&.fetch("type", nil)
38
38
  @example = ExpressionPresenter.new proto&.value, json&.fetch("value", nil)
39
39
  end
@@ -9,6 +9,7 @@ gem "minitest", "~> 6.0.2"
9
9
  gem "minitest-focus", "~> 1.4"
10
10
  gem "minitest-mock", "~> 5.27"
11
11
  gem "minitest-rg", "~> 5.3"
12
+ gem "minitest-reporters", "~> 1.8.0", require: false
12
13
  gem "ostruct", "~> 0.5.5"
13
14
  gem "rake", ">= 13.0"
14
15
  gem "redcarpet", "~> 3.6"
@@ -1,6 +1,4 @@
1
1
  <%- assert_locals gem -%>
2
- # Ignore bundler lockfiles
3
- Gemfile.lock
4
2
  gems.locked
5
3
 
6
4
  # Ignore documentation output
@@ -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.1+.
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
@@ -1,6 +1,15 @@
1
1
  <%- assert_locals gem -%>
2
2
  <%= render partial: "shared/header" -%>
3
3
 
4
+ # Load JUnit XML formatter from googleapis/ruby-common-tools to write
5
+ # tmp/reports/sponge_log.xml for Kokoro/TestGrid build health tracking.
6
+ if ENV["CI"] || ENV["KOKORO_JOB_NAME"]
7
+ begin
8
+ require "gapic/minitest_junit_preloader"
9
+ rescue LoadError
10
+ end
11
+ end
12
+
4
13
  require "minitest/autorun"
5
14
  require "minitest/focus"
6
15
  require "minitest/mock"
@@ -1,6 +1,6 @@
1
1
  <%- assert_locals package -%>
2
2
  <% @requires = capture do %>
3
- <%- package.services.each do |service| -%>
3
+ <%- package.services.select { |s| s.methods.any? }.each do |service| -%>
4
4
  require "<%= service.service_require %>"
5
5
  <%- end -%>
6
6
  require "<%= package.gem.version_require %>"
@@ -9,6 +9,6 @@ module <%= enum.name %>
9
9
  <%- if value.doc_description -%>
10
10
  <%= indent value.doc_description, " # " %>
11
11
  <%- end -%>
12
- <%= value.name %> = <%= value.number %>
12
+ <%= value.doc_line %>
13
13
  <%- end -%>
14
14
  end
@@ -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 subclient.respond_to?(:bindings_override) && !subclient.bindings_override.empty? -%>
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 subclient.respond_to?(:bindings_override) && !subclient.bindings_override.empty? -%>
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
- client = <%= full_client_name %>.new do |config|
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
- client.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }) do |_result, response|
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
- client.<%= method.name %> <%= fields.map(&:as_kwarg).join ", " %> do |_result, response|
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
- client.<%= method.name %> <%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>) do |_result, response|
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
- client.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }, call_options) do |_result, response|
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
- client.<%= method.name %>(<%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>), call_options) do |_result, response|
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
- client = <%= full_client_name %>.new do |config|
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
- client.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }) do |_result, response|
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
- client.<%= method.name %> <%= fields.map(&:as_kwarg).join ", " %> do |_result, response|
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
- client.<%= method.name %> <%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>) do |_result, response|
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
- client.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }, call_options) do |_result, response|
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
- client.<%= method.name %>(<%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>), call_options) do |_result, response|
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
- client = <%= full_client_name %>.new do |config|
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
- client.<%= method.name %> enum_input do |response, operation|
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
- client.<%= method.name %> stream_input do |response, operation|
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
- client.<%= method.name %> enum_input, grpc_options do |response, operation|
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
- client.<%= method.name %> stream_input, grpc_options do |response, operation|
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
- client = <%= full_client_name %>.new do |config|
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
- client.<%= method.name %> enum_input do |response, operation|
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
- client.<%= method.name %> stream_input do |response, operation|
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
- client.<%= method.name %> enum_input, grpc_options do |response, operation|
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
- client.<%= method.name %> stream_input, grpc_options do |response, operation|
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
- client = <%= full_client_name %>.new do |config|
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
- client.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }) do |response, operation|
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
- client.<%= method.name %> <%= fields.map(&:as_kwarg).join ", " %> do |response, operation|
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
- client.<%= method.name %> <%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>) do |response, operation|
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
- client.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }, grpc_options) do |response, operation|
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
- client.<%= method.name %>(<%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>), grpc_options) do |response, operation|
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
- client = <%= full_client_name %>.new do |config|
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
- client.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }) do |response, operation|
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
- client.<%= method.name %> <%= fields.map(&:as_kwarg).join ", " %> do |response, operation|
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
- client.<%= method.name %> <%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>) do |response, operation|
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
- client.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }, grpc_options) do |response, operation|
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
- client.<%= method.name %>(<%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>), grpc_options) do |response, operation|
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gapic-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.48.1
4
+ version: 0.50.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernest Landrito
@@ -73,14 +73,14 @@ dependencies:
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '4.30'
76
+ version: '4.32'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '4.30'
83
+ version: '4.32'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: google-style
86
86
  requirement: !ruby/object:Gem::Requirement