gapic-generator 0.3.1 → 0.5.1

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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/lib/gapic/formatting_utils.rb +9 -7
  4. data/lib/gapic/generator/version.rb +1 -1
  5. data/lib/gapic/generators/default_generator.rb +13 -11
  6. data/lib/gapic/helpers/filepath_helper.rb +1 -0
  7. data/lib/gapic/helpers/namespace_helper.rb +8 -1
  8. data/lib/gapic/path_template/segment.rb +7 -0
  9. data/lib/gapic/presenters/field_presenter.rb +9 -9
  10. data/lib/gapic/presenters/file_presenter.rb +1 -1
  11. data/lib/gapic/presenters/method_presenter.rb +23 -17
  12. data/lib/gapic/presenters/package_presenter.rb +8 -1
  13. data/lib/gapic/presenters/resource_presenter.rb +55 -35
  14. data/lib/gapic/presenters/service_presenter.rb +56 -19
  15. data/lib/gapic/ruby_info.rb +93 -0
  16. data/lib/gapic/schema/api.rb +63 -1
  17. data/templates/default/gem/gemfile.erb +3 -0
  18. data/templates/default/gem/gemspec.erb +3 -1
  19. data/templates/default/gem/rakefile.erb +1 -0
  20. data/templates/default/gem/test_helper.erb +8 -0
  21. data/templates/default/layouts/_ruby.erb +5 -4
  22. data/templates/default/proto_docs/_message.erb +2 -2
  23. data/templates/default/service/client.erb +1 -1
  24. data/templates/default/service/client/_client.erb +15 -4
  25. data/templates/default/service/client/_config.erb +32 -28
  26. data/templates/default/service/client/_credentials.erb +1 -1
  27. data/templates/default/service/client/_operations.erb +3 -1
  28. data/templates/default/service/client/method/def/_options_defaults.erb +2 -2
  29. data/templates/default/service/client/method/def/_request_normal.erb +2 -2
  30. data/templates/default/service/client/method/def/_request_streaming.erb +3 -3
  31. data/templates/default/service/client/method/def/_response_normal.erb +1 -1
  32. data/templates/default/service/client/method/def/_response_paged.erb +2 -2
  33. data/templates/default/service/client/method/docs/_error.erb +1 -1
  34. data/templates/default/service/client/method/docs/_request_normal.erb +2 -2
  35. data/templates/default/service/client/method/docs/_request_streaming.erb +2 -2
  36. data/templates/default/service/client/method/docs/_response.erb +1 -1
  37. data/templates/default/service/client/resource/_def.erb +1 -1
  38. data/templates/default/service/client/resource/_multi.erb +4 -7
  39. data/templates/default/service/client/resource/_single.erb +2 -3
  40. data/templates/default/service/credentials.erb +1 -1
  41. data/templates/default/service/operations.erb +1 -1
  42. data/templates/default/service/paths.erb +1 -1
  43. data/templates/default/service/test/_resource.erb +16 -0
  44. data/templates/default/service/test/client.erb +17 -4
  45. data/templates/default/service/test/client_operations.erb +3 -4
  46. data/templates/default/service/test/client_paths.erb +17 -0
  47. data/templates/default/service/test/method/_configure.erb +19 -0
  48. metadata +8 -3
@@ -20,22 +20,22 @@
20
20
  # to 20 seconds, and all remaining timeouts to 10 seconds:
21
21
  #
22
22
  # <%= service.client_name_full %>.configure do |config|
23
- # config.timeout = 10_000
24
- # config.rpcs.<%= method_service.methods.first.name %>.timeout = 20_000
23
+ # config.timeout = 10.0
24
+ # config.rpcs.<%= method_service.methods.first.name %>.timeout = 20.0
25
25
  # end
26
26
  #
27
27
  # To apply the above configuration only to a new client:
28
28
  #
29
29
  # client = <%= service.client_name_full %>.new do |config|
30
- # config.timeout = 10_000
31
- # config.rpcs.<%= method_service.methods.first.name %>.timeout = 20_000
30
+ # config.timeout = 10.0
31
+ # config.rpcs.<%= method_service.methods.first.name %>.timeout = 20.0
32
32
  # end
33
33
  #
34
34
  <%- end -%>
35
35
  # @!attribute [rw] endpoint
36
36
  # The hostname or hostname:port of the service endpoint.
37
37
  # Defaults to `<%= service.client_endpoint.inspect %>`.
38
- # @return [String]
38
+ # @return [::String]
39
39
  # @!attribute [rw] credentials
40
40
  # Credentials to send with calls. You may provide any of the following types:
41
41
  # * (`String`) The path to a service account key file in JSON format
@@ -47,29 +47,29 @@
47
47
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
48
48
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
49
49
  # * (`nil`) indicating no credentials
50
- # @return [Object]
50
+ # @return [::Object]
51
51
  # @!attribute [rw] scope
52
52
  # The OAuth scopes
53
- # @return [Array<String>]
53
+ # @return [::Array<::String>]
54
54
  # @!attribute [rw] lib_name
55
55
  # The library name as recorded in instrumentation and logging
56
- # @return [String]
56
+ # @return [::String]
57
57
  # @!attribute [rw] lib_version
58
58
  # The library version as recorded in instrumentation and logging
59
- # @return [String]
59
+ # @return [::String]
60
60
  # @!attribute [rw] channel_args
61
61
  # Extra parameters passed to the gRPC channel. Note: this is ignored if a
62
62
  # `GRPC::Core::Channel` object is provided as the credential.
63
- # @return [Hash]
63
+ # @return [::Hash]
64
64
  # @!attribute [rw] interceptors
65
65
  # An array of interceptors that are run before calls are executed.
66
- # @return [Array<GRPC::ClientInterceptor>]
66
+ # @return [::Array<::GRPC::ClientInterceptor>]
67
67
  # @!attribute [rw] timeout
68
- # The call timeout in milliseconds.
69
- # @return [Numeric]
68
+ # The call timeout in seconds.
69
+ # @return [::Numeric]
70
70
  # @!attribute [rw] metadata
71
71
  # Additional gRPC headers to be sent with the call.
72
- # @return [Hash{Symbol=>String}]
72
+ # @return [::Hash{::Symbol=>::String}]
73
73
  # @!attribute [rw] retry_policy
74
74
  # The retry policy. The value is a hash with the following keys:
75
75
  # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
@@ -77,25 +77,29 @@
77
77
  # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
78
78
  # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
79
79
  # trigger a retry.
80
- # @return [Hash]
80
+ # @return [::Hash]
81
+ # @!attribute [rw] quota_project
82
+ # A separate project against which to charge quota.
83
+ # @return [::String]
81
84
  #
82
85
  class Configuration
83
- extend Gapic::Config
86
+ extend ::Gapic::Config
84
87
 
85
- config_attr :endpoint, <%= service.client_endpoint.inspect %>, String
86
- config_attr :credentials, nil do |value|
88
+ config_attr :endpoint, <%= service.client_endpoint.inspect %>, ::String
89
+ config_attr :credentials, nil do |value|
87
90
  allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
88
91
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
89
92
  allowed.any? { |klass| klass === value }
90
93
  end
91
- config_attr :scope, nil, String, Array, nil
92
- config_attr :lib_name, nil, String, nil
93
- config_attr :lib_version, nil, String, nil
94
- config_attr(:channel_args, <%= service.config_channel_args.inspect %>, Hash, nil)
95
- config_attr :interceptors, nil, Array, nil
96
- config_attr :timeout, nil, Numeric, nil
97
- config_attr :metadata, nil, Hash, nil
98
- config_attr :retry_policy, nil, Hash, Proc, nil
94
+ config_attr :scope, nil, ::String, ::Array, nil
95
+ config_attr :lib_name, nil, ::String, nil
96
+ config_attr :lib_version, nil, ::String, nil
97
+ config_attr(:channel_args, <%= service.config_channel_args.inspect %>, ::Hash, nil)
98
+ config_attr :interceptors, nil, ::Array, nil
99
+ config_attr :timeout, nil, ::Numeric, nil
100
+ config_attr :metadata, nil, ::Hash, nil
101
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
102
+ config_attr :quota_project, nil, ::String, nil
99
103
 
100
104
  # @private
101
105
  def initialize parent_config = nil
@@ -137,7 +141,7 @@ class Configuration
137
141
  <%- method_service.methods.each do |method| -%>
138
142
  ##
139
143
  # RPC-specific configuration for `<%= method.name %>`
140
- # @return [Gapic::Config::Method]
144
+ # @return [::Gapic::Config::Method]
141
145
  #
142
146
  attr_reader :<%= method.name %>
143
147
  <%- end -%>
@@ -146,7 +150,7 @@ class Configuration
146
150
  def initialize parent_rpcs = nil
147
151
  <%- method_service.methods.each do |method| -%>
148
152
  <%= method.name %>_config = parent_rpcs&.<%= method.name %> if parent_rpcs&.respond_to? :<%= method.name %>
149
- @<%= method.name %> = Gapic::Config::Method.new <%= method.name %>_config
153
+ @<%= method.name %> = ::Gapic::Config::Method.new <%= method.name %>_config
150
154
  <%- end -%>
151
155
 
152
156
  yield self if block_given?
@@ -3,7 +3,7 @@
3
3
  require "googleauth"
4
4
  <% end %>
5
5
  # Credentials for the <%= service.name %> API.
6
- class <%= service.credentials_name %> < Google::Auth::Credentials
6
+ class <%= service.credentials_name %> < ::Google::Auth::Credentials
7
7
  <%- if service.client_scopes.any? -%>
8
8
  self.scope = [
9
9
  <%- service.client_scopes.each_with_index do |client_scope, index| -%>
@@ -64,8 +64,10 @@ class <%= service.operations_name %>
64
64
  if credentials.is_a?(String) || credentials.is_a?(Hash)
65
65
  credentials = Credentials.new credentials, scope: @config.scope
66
66
  end
67
+ @quota_project_id = @config.quota_project
68
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
67
69
 
68
- @<%= service.lro_service.stub_name %> = Gapic::ServiceStub.new(
70
+ @<%= service.lro_service.stub_name %> = ::Gapic::ServiceStub.new(
69
71
  <%= service.lro_service.proto_service_stub_name_full %>,
70
72
  credentials: credentials,
71
73
  endpoint: @config.endpoint,
@@ -1,12 +1,12 @@
1
1
  <%- assert_locals method -%>
2
2
  # Converts hash and nil to an options object
3
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
4
4
 
5
5
  # Customize the options with defaults
6
6
  metadata = @config.rpcs.<%= method.name %>.metadata.to_h
7
7
 
8
8
  # Set x-goog-api-client and x-goog-user-project headers
9
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
9
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
10
10
  lib_name: @config.lib_name, lib_version: @config.lib_version,
11
11
  gapic_version: ::<%= method.service.gem.version_name_full %>
12
12
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -1,4 +1,4 @@
1
1
  <%- assert_locals method -%>
2
- raise ArgumentError, "request must be provided" if request.nil?
2
+ raise ::ArgumentError, "request must be provided" if request.nil?
3
3
 
4
- request = Gapic::Protobuf.coerce request, to: <%= method.request_type %>
4
+ request = ::Gapic::Protobuf.coerce request, to: <%= method.request_type %>
@@ -1,9 +1,9 @@
1
1
  <%- assert_locals method -%>
2
- unless request.is_a? Enumerable
3
- raise ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
2
+ unless request.is_a? ::Enumerable
3
+ raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
4
4
  request = request.to_enum
5
5
  end
6
6
 
7
7
  request = request.lazy.map do |req|
8
- Gapic::Protobuf.coerce req, to: <%= method.request_type %>
8
+ ::Gapic::Protobuf.coerce req, to: <%= method.request_type %>
9
9
  end
@@ -1,7 +1,7 @@
1
1
  <%- assert_locals method -%>
2
2
  @<%= method.service.stub_name %>.call_rpc :<%= method.name %>, request, options: options do |response, operation|
3
3
  <%- if method.lro? -%>
4
- response = Gapic::Operation.new response, <%= method.service.lro_client_ivar %>, options: options
4
+ response = ::Gapic::Operation.new response, <%= method.service.lro_client_ivar %>, options: options
5
5
  <%- end -%>
6
6
  yield response, operation if block_given?
7
7
  return response
@@ -1,9 +1,9 @@
1
1
  <%- assert_locals method -%>
2
2
  @<%= method.service.stub_name %>.call_rpc :<%= method.name %>, request, options: options do |response, operation|
3
3
  <%- if method.lro? -%>
4
- wrap_lro_operation = ->(op_response) { Gapic::Operation.new op_response, <%= method.service.lro_client_ivar %> }
4
+ wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, <%= method.service.lro_client_ivar %> }
5
5
  <%- end -%>
6
- response = Gapic::PagedEnumerable.new @<%= method.service.stub_name %>, :<%= method.name %>, request, response, operation, options<%- if method.lro? -%>, format_resource: wrap_lro_operation<%- end -%>
6
+ response = ::Gapic::PagedEnumerable.new @<%= method.service.stub_name %>, :<%= method.name %>, request, response, operation, options<%- if method.lro? -%>, format_resource: wrap_lro_operation<%- end -%>
7
7
  yield response, operation if block_given?
8
8
  return response
9
9
  end
@@ -1,2 +1,2 @@
1
1
  <%- assert_locals method -%>
2
- # @raise [GRPC::BadStatus] if the RPC is aborted.
2
+ # @raise [::GRPC::BadStatus] if the RPC is aborted.
@@ -3,10 +3,10 @@
3
3
  # Pass arguments to `<%= method.name %>` via a request object, either of type
4
4
  # {<%= method.request_type %>} or an equivalent Hash.
5
5
  #
6
- # @param request [<%= method.request_type %>, Hash]
6
+ # @param request [<%= method.request_type %>, ::Hash]
7
7
  # A request object representing the call parameters. Required. To specify no
8
8
  # parameters, or to keep all the default parameter values, pass an empty Hash.
9
- # @param options [Gapic::CallOptions, Hash]
9
+ # @param options [::Gapic::CallOptions, ::Hash]
10
10
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
11
11
  <%-if method.arguments.any?-%>
12
12
  #
@@ -1,5 +1,5 @@
1
1
  <%- assert_locals method -%>
2
- # @param request [Gapic::StreamInput, Enumerable<<%= method.request_type %>, Hash>]
2
+ # @param request [::Gapic::StreamInput, ::Enumerable<<%= method.request_type %>, ::Hash>]
3
3
  # An enumerable of {<%= method.request_type %>} instances.
4
- # @param options [Gapic::CallOptions, Hash]
4
+ # @param options [::Gapic::CallOptions, ::Hash]
5
5
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@@ -1,6 +1,6 @@
1
1
  <%- assert_locals method -%>
2
2
  # @yield [response, operation] Access the result along with the RPC operation
3
3
  # @yieldparam response [<%= method.doc_response_type %>]
4
- # @yieldparam operation [GRPC::ActiveCall::Operation]
4
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
5
5
  #
6
6
  # @return [<%= method.doc_response_type %>]
@@ -1,6 +1,6 @@
1
1
  <%- assert_locals pattern -%>
2
2
  <%- pattern.arguments[0...-1].each do |arg| -%>
3
- raise ArgumentError, "<%= arg %> cannot contain /" if <%= arg %>.to_s.include? "/"
3
+ raise ::ArgumentError, "<%= arg %> cannot contain /" if <%= arg %>.to_s.include? "/"
4
4
  <%- end -%>
5
5
 
6
6
  "<%= pattern.path_string %>"
@@ -3,26 +3,23 @@
3
3
  # Create a fully-qualified <%= resource.name %> resource string.
4
4
  #
5
5
  <%- resource.patterns.each do |pattern| -%>
6
- <%- args_doc_sig = pattern.arguments.map { |arg| "#{arg}:" }.join ", " -%>
7
- # @overload <%= resource.path_helper %>(<%= args_doc_sig %>)
6
+ # @overload <%= resource.path_helper %>(<%= pattern.formal_arguments %>)
8
7
  <%= indent render(partial: "service/client/resource/doc", locals: { pattern: pattern }), "# " %>
9
8
  #
10
9
  <%- end -%>
11
- # @return [String]
10
+ # @return [::String]
12
11
  def <%= resource.path_helper %> **args
13
12
  resources = {
14
13
  <%- last_pattern_index = resource.patterns.count - 1 -%>
15
14
  <%- resource.patterns.each_with_index do |pattern, index| -%>
16
15
  <%- comma = last_pattern_index == index ? "" : "," -%>
17
- <%- args_key = pattern.arguments.sort.join(":").inspect -%>
18
- <%- args_sig = pattern.arguments.map { |arg| "#{arg}:" }.join ", " -%>
19
- <%= args_key %> => (proc do |<%= args_sig %>|
16
+ <%= pattern.arguments_key.inspect %> => (proc do |<%= pattern.formal_arguments %>|
20
17
  <%= indent render(partial: "service/client/resource/def", locals: { pattern: pattern }), 6 %>
21
18
  end)<%= comma %>
22
19
  <%- end -%>
23
20
  }
24
21
 
25
22
  resource = resources[args.keys.sort.join(":")]
26
- raise ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
23
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
27
24
  resource.call(**args)
28
25
  end
@@ -4,8 +4,7 @@
4
4
  #
5
5
  <%= indent render(partial: "service/client/resource/doc", locals: { pattern: resource.patterns.first }), "# " %>
6
6
  #
7
- # @return [String]
8
- <%- args = resource.patterns.first.arguments.map { |arg| "#{arg}:" }.join ", " -%>
9
- def <%= resource.path_helper %> <%= args %>
7
+ # @return [::String]
8
+ def <%= resource.path_helper %> <%= resource.patterns.first.formal_arguments %>
10
9
  <%= indent render(partial: "service/client/resource/def", locals: { pattern: resource.patterns.first }), 2 %>
11
10
  end
@@ -2,5 +2,5 @@
2
2
  <%= render partial: "service/client/credentials",
3
3
  layout: "layouts/ruby",
4
4
  locals: { service: service,
5
- namespace: service.proto_service_name_full }
5
+ namespace: service.service_name_full }
6
6
  %>
@@ -2,5 +2,5 @@
2
2
  <%= render partial: "service/client/operations",
3
3
  layout: "layouts/ruby",
4
4
  locals: { service: service,
5
- namespace: service.proto_service_name_full }
5
+ namespace: service.service_name_full }
6
6
  %>
@@ -2,5 +2,5 @@
2
2
  <%= render partial: "service/client/paths",
3
3
  layout: "layouts/ruby",
4
4
  locals: { service: service,
5
- namespace: service.proto_service_name_full }
5
+ namespace: service.service_name_full }
6
6
  %>
@@ -0,0 +1,16 @@
1
+ <%- assert_locals resource -%>
2
+ <%- assert_locals service -%>
3
+ <%- full_client_name = defined?(client_name_full) ? client_name_full : service.client_name_full -%>
4
+ def test_<%= resource.path_helper%>
5
+ grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
6
+ ::Gapic::ServiceStub.stub :new, nil do
7
+ client = <%= full_client_name %>.new do |config|
8
+ config.credentials = grpc_channel
9
+ end
10
+ <%- resource.patterns.each do |pattern| -%>
11
+
12
+ path = client.<%= resource.path_helper%> <%= pattern.arguments_with_dummy_values %>
13
+ assert_equal <%= pattern.expected_path_for_dummy_values.inspect %>, path
14
+ <%- end -%>
15
+ end
16
+ end
@@ -2,8 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  <%= render partial: "shared/license" %>
5
- require "simplecov"
6
- require "minitest/autorun"
5
+ require "helper"
7
6
 
8
7
  require "gapic/grpc/service_stub"
9
8
 
@@ -17,8 +16,22 @@ class <%= service.client_name_full %>Test < Minitest::Test
17
16
  <% service.methods.each do |method| %>
18
17
  <%= indent render(partial: "service/test/method/#{method.kind}",
19
18
  locals: { method: method }), 2 %>
20
- <% if method != service.methods.last %>
21
19
 
22
20
  <% end %>
23
- <% end %>
21
+ <%= indent render(partial: "service/test/method/configure", locals: { service: service }), 2 %>
22
+ <%- if service.lro? -%>
23
+
24
+ def test_<%= service.lro_client_var %>
25
+ grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
26
+
27
+ client = nil
28
+ Gapic::ServiceStub.stub :new, nil do
29
+ client = <%= service.client_name_full =%>.new do |config|
30
+ config.credentials = grpc_channel
31
+ end
32
+ end
33
+
34
+ assert_kind_of <%= service.operations_name_full %>, client.<%= service.lro_client_var %>
35
+ end
36
+ <%- end -%>
24
37
  end
@@ -2,8 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  <%= render partial: "shared/license" %>
5
- require "simplecov"
6
- require "minitest/autorun"
5
+ require "helper"
7
6
 
8
7
  require "gapic/grpc/service_stub"
9
8
 
@@ -17,8 +16,8 @@ class <%= service.operations_name_full %>Test < Minitest::Test
17
16
  <% service.lro_service.methods.each do |method| %>
18
17
  <%= indent render(partial: "service/test/method/#{method.kind}",
19
18
  locals: { client_name_full: service.operations_name_full, method: method }), 2 %>
20
- <% if method != service.lro_service.methods.last %>
21
19
 
22
20
  <% end %>
23
- <% end %>
21
+ <%= indent render(partial: "service/test/method/configure",
22
+ locals: { service: service, client_name_full: service.operations_name_full }), 2 %>
24
23
  end
@@ -0,0 +1,17 @@
1
+ <%- assert_locals service -%>
2
+ # frozen_string_literal: true
3
+
4
+ <%= render partial: "shared/license" %>
5
+ require "helper"
6
+
7
+ require "gapic/grpc/service_stub"
8
+
9
+ require "<%= service.service_require %>"
10
+
11
+ class <%= service.client_name_full %>PathsTest < Minitest::Test
12
+ <%- service.references.each do |resource| -%>
13
+ <%= indent render(partial: "service/test/resource",
14
+ locals: { resource: resource, service: service }), 2 %>
15
+
16
+ <%- end %>
17
+ end
@@ -0,0 +1,19 @@
1
+ <%- assert_locals service -%>
2
+ <%- full_client_name = defined?(client_name_full) ? client_name_full : service.client_name_full -%>
3
+ def test_configure
4
+ grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
5
+
6
+ client = block_config = config = nil
7
+ Gapic::ServiceStub.stub :new, nil do
8
+ client = <%= full_client_name =%>.new do |config|
9
+ config.credentials = grpc_channel
10
+ end
11
+ end
12
+
13
+ config = client.configure do |c|
14
+ block_config = c
15
+ end
16
+
17
+ assert_same block_config, config
18
+ assert_kind_of <%= full_client_name %>::Configuration, config
19
+ end
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.3.1
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernest Landrito
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-04-11 00:00:00.000000000 Z
13
+ date: 2020-05-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: actionpack
@@ -233,6 +233,7 @@ files:
233
233
  - lib/gapic/presenters/sample_presenter.rb
234
234
  - lib/gapic/presenters/service_presenter.rb
235
235
  - lib/gapic/resource_lookup.rb
236
+ - lib/gapic/ruby_info.rb
236
237
  - lib/gapic/runner.rb
237
238
  - lib/gapic/schema.rb
238
239
  - lib/gapic/schema/api.rb
@@ -259,6 +260,7 @@ files:
259
260
  - templates/default/gem/rakefile.erb
260
261
  - templates/default/gem/readme.erb
261
262
  - templates/default/gem/rubocop.erb
263
+ - templates/default/gem/test_helper.erb
262
264
  - templates/default/gem/version.erb
263
265
  - templates/default/gem/yardopts.erb
264
266
  - templates/default/helpers/default_helper.rb
@@ -318,11 +320,14 @@ files:
318
320
  - templates/default/service/credentials.erb
319
321
  - templates/default/service/operations.erb
320
322
  - templates/default/service/paths.erb
323
+ - templates/default/service/test/_resource.erb
321
324
  - templates/default/service/test/client.erb
322
325
  - templates/default/service/test/client_operations.erb
326
+ - templates/default/service/test/client_paths.erb
323
327
  - templates/default/service/test/method/_assert_response.erb
324
328
  - templates/default/service/test/method/_bidi.erb
325
329
  - templates/default/service/test/method/_client.erb
330
+ - templates/default/service/test/method/_configure.erb
326
331
  - templates/default/service/test/method/_normal.erb
327
332
  - templates/default/service/test/method/_server.erb
328
333
  - templates/default/service/test/method/_setup.erb
@@ -349,7 +354,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
349
354
  - !ruby/object:Gem::Version
350
355
  version: '0'
351
356
  requirements: []
352
- rubygems_version: 3.1.2
357
+ rubygems_version: 3.0.3
353
358
  signing_key:
354
359
  specification_version: 4
355
360
  summary: An API Client Generator for Ruby in Ruby!