gapic-generator 0.4.0 → 0.6.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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/lib/gapic/file_formatter.rb +0 -1
  4. data/lib/gapic/formatting_utils.rb +6 -6
  5. data/lib/gapic/generator/version.rb +1 -1
  6. data/lib/gapic/generators/default_generator.rb +16 -14
  7. data/lib/gapic/helpers/filepath_helper.rb +1 -0
  8. data/lib/gapic/helpers/namespace_helper.rb +8 -1
  9. data/lib/gapic/{path_template.rb → path_pattern.rb} +9 -8
  10. data/lib/gapic/path_pattern/parser.rb +146 -0
  11. data/lib/gapic/path_pattern/pattern.rb +80 -0
  12. data/lib/gapic/path_pattern/segment.rb +276 -0
  13. data/lib/gapic/presenters/field_presenter.rb +9 -9
  14. data/lib/gapic/presenters/file_presenter.rb +1 -1
  15. data/lib/gapic/presenters/gem_presenter.rb +39 -3
  16. data/lib/gapic/presenters/method_presenter.rb +19 -19
  17. data/lib/gapic/presenters/package_presenter.rb +4 -3
  18. data/lib/gapic/presenters/resource_presenter.rb +48 -36
  19. data/lib/gapic/presenters/service_presenter.rb +20 -14
  20. data/lib/gapic/schema/api.rb +7 -0
  21. data/lib/gapic/schema/wrappers.rb +13 -19
  22. data/lib/gapic/uri_template.rb +36 -0
  23. data/lib/gapic/uri_template/parser.rb +50 -0
  24. data/templates/default/gem/gemfile.erb +3 -0
  25. data/templates/default/gem/gemspec.erb +7 -6
  26. data/templates/default/gem/rakefile.erb +1 -0
  27. data/templates/default/gem/test_helper.erb +8 -0
  28. data/templates/default/layouts/_ruby.erb +5 -4
  29. data/templates/default/lib/_service.erb +2 -0
  30. data/templates/default/proto_docs/_message.erb +2 -2
  31. data/templates/default/service/client/_client.erb +7 -4
  32. data/templates/default/service/client/_config.erb +33 -29
  33. data/templates/default/service/client/_credentials.erb +1 -1
  34. data/templates/default/service/client/_operations.erb +3 -1
  35. data/templates/default/service/client/method/def/_options_defaults.erb +2 -2
  36. data/templates/default/service/client/method/def/_request_normal.erb +2 -2
  37. data/templates/default/service/client/method/def/_request_streaming.erb +3 -3
  38. data/templates/default/service/client/method/def/_response_normal.erb +1 -1
  39. data/templates/default/service/client/method/def/_response_paged.erb +2 -2
  40. data/templates/default/service/client/method/docs/_error.erb +1 -1
  41. data/templates/default/service/client/method/docs/_request_normal.erb +2 -2
  42. data/templates/default/service/client/method/docs/_request_streaming.erb +2 -2
  43. data/templates/default/service/client/method/docs/_response.erb +1 -1
  44. data/templates/default/service/client/resource/_def.erb +1 -1
  45. data/templates/default/service/client/resource/_doc.erb +1 -1
  46. data/templates/default/service/client/resource/_multi.erb +4 -7
  47. data/templates/default/service/client/resource/_single.erb +2 -3
  48. data/templates/default/service/test/_resource.erb +16 -0
  49. data/templates/default/service/test/client.erb +2 -5
  50. data/templates/default/service/test/client_operations.erb +2 -5
  51. data/templates/default/service/test/client_paths.erb +15 -0
  52. metadata +12 -6
  53. data/lib/gapic/path_template/parser.rb +0 -83
  54. data/lib/gapic/path_template/segment.rb +0 -67
@@ -91,6 +91,13 @@ module Gapic
91
91
  configuration[:overrides][:namespace].fetch str, str
92
92
  end
93
93
 
94
+ def fix_service_name str
95
+ str = String str
96
+ return str if configuration[:overrides].nil?
97
+ return str if configuration[:overrides][:service].nil?
98
+ configuration[:overrides][:service].fetch str, str
99
+ end
100
+
94
101
  def generate_files
95
102
  @files.select(&:generate?)
96
103
  end
@@ -15,6 +15,7 @@
15
15
  # limitations under the License.
16
16
 
17
17
  require "gapic/formatting_utils"
18
+ require "gapic/path_pattern"
18
19
 
19
20
  module Gapic
20
21
  module Schema
@@ -761,30 +762,32 @@ module Gapic
761
762
  # @return [Array<Gapic::Schema::ResourceDescriptor>] The resource
762
763
  # descriptor.
763
764
  # @!attribute [r] parsed_patterns
764
- # @return [Array<Array<String>>] The normalized, segmented forms of the
765
- # patterns. Normalized means all ID segments are replaced by asterisks
765
+ # @return [Array<String>] The template form of the
766
+ # patterns. Template means all ID segments are replaced by asterisks
766
767
  # to remove non-structural differences due to different names being
767
- # used. Segmented means simply split on slashes.
768
+ # used.
768
769
  # For example, if a pattern is `"projects/{project}""`, the
769
- # corresponding parsed pattern would be `["projects", "*"]`.
770
+ # corresponding parsed pattern would be `"projects/*"]`.
771
+ # @!attribure [r] parsed_parent_patterns
772
+ # return [Array<String>] Parsed patterns for the expected parents.
770
773
  # @!attribute [r] parent_resources
771
774
  # @return [Array<Gapic::Schema::Resource>] Parent resources
772
775
  class Resource
773
776
  extend Forwardable
774
- attr_reader :descriptor, :parsed_patterns, :parent_resources
777
+ attr_reader :descriptor, :parsed_patterns, :parsed_parent_patterns, :parent_resources
775
778
  attr_accessor :parent
776
779
 
777
780
  # Initializes a resource object.
778
- # @param descriptor [Google::Protobuf::ResourceDescriptor] the protobuf
781
+ # @param descriptor [Google::Api::ResourceDescriptor] the protobuf
779
782
  # representation of this resource.
780
783
  def initialize descriptor
781
784
  @parent = nil
782
785
  @descriptor = descriptor
783
- @parsed_patterns = descriptor.pattern.map do |pattern|
784
- pattern.split("/").map do |segment|
785
- segment =~ %r{\{[^/\}]+(=[^\}]+)?\}} ? "*" : segment
786
- end.freeze
786
+ patterns = descriptor.pattern.map do |pattern|
787
+ Gapic::PathPattern.parse pattern
787
788
  end.freeze
789
+ @parsed_patterns = patterns.map(&:template).compact.uniq.freeze
790
+ @parsed_parent_patterns = patterns.map(&:parent_template).compact.uniq.freeze
788
791
  @parent_resources = []
789
792
  end
790
793
 
@@ -800,15 +803,6 @@ module Gapic
800
803
  parent&.containing_file
801
804
  end
802
805
 
803
- # Returns parsed patterns for the expected parents.
804
- # @return [Array<Array<String>>]
805
- def parsed_parent_patterns
806
- @parsed_patterns.map do |pat|
807
- parent = pat.last =~ /^\*\*?$/ ? pat[0...-2] : pat[0...-1]
808
- parent.empty? ? nil : parent
809
- end.compact.uniq
810
- end
811
-
812
806
  # @!method type
813
807
  # @return [String] the resource type string.
814
808
  # @!method pattern
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require "gapic/uri_template/parser"
18
+
19
+ module Gapic
20
+ # TODO: Enter docs
21
+ # Dooooooooocs!!!
22
+ module UriTemplate
23
+ # Parse arguments from a URI template.
24
+ # @see https://tools.ietf.org/html/rfc6570 URI Template
25
+ #
26
+ # used to satisfy AIP-4222 Routing headers
27
+ # @see https://google.aip.dev/client-libraries/4222
28
+ #
29
+ # @param uri_template [String] The URI template to be parsed.
30
+ #
31
+ # @return [Array<String>] The arguments of the URI template.
32
+ def self.parse_arguments uri_template
33
+ Parser.parse_arguments uri_template
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ module Gapic
18
+ module UriTemplate
19
+ # A URI template parser.
20
+ # see https://tools.ietf.org/html/rfc6570 URI Template
21
+ #
22
+ # @!attribute [r] path_pattern
23
+ # @return [String] The path pattern to be parsed.
24
+ # @!attribute [r] segments
25
+ # @return [Array<Segment|String>] The segments of the parsed path pattern.
26
+ module Parser
27
+ # @private
28
+ # /((?<positional>\*\*?)|{(?<name>[^\/]+?)(?:=(?<template>.+?))?})/
29
+ URI_TEMPLATE = %r{
30
+ (
31
+ (?<positional>\*\*?)
32
+ |
33
+ {(?<name>[^\/]+?)(?:=(?<template>.+?))?}
34
+ )
35
+ }x.freeze
36
+
37
+ def self.parse_arguments uri_template
38
+ arguments = []
39
+
40
+ while (match = URI_TEMPLATE.match uri_template)
41
+ # The String before the match needs to be added to the segments
42
+ arguments << match[:name] if match[:name]
43
+ uri_template = match.post_match
44
+ end
45
+
46
+ arguments
47
+ end
48
+ end
49
+ end
50
+ end
@@ -2,3 +2,6 @@
2
2
  source "https://rubygems.org"
3
3
 
4
4
  gemspec
5
+
6
+ # google-protobuf 3.12.0 requires Ruby 2.5 or later, so pin to 3.11 on older Rubies
7
+ gem "google-protobuf", (RUBY_VERSION < "2.5" ? "~> 3.11.4" : "~> 3.12")
@@ -12,24 +12,25 @@ Gem::Specification.new do |gem|
12
12
  gem.description = <%= gem.description.inspect %>
13
13
  gem.summary = <%= gem.summary.inspect %>
14
14
  gem.homepage = <%= gem.homepage.inspect %>
15
- gem.license = "MIT"
15
+ gem.license = <%= gem.license_name.inspect %>
16
16
 
17
17
  gem.platform = Gem::Platform::RUBY
18
18
 
19
19
  gem.files = `git ls-files -- lib/*`.split("\n") +
20
20
  `git ls-files -- proto_docs/*`.split("\n") +
21
- ["README.md", "LICENSE.md", ".yardopts"]
21
+ <%= gem.extra_files.inspect %>
22
22
  gem.require_paths = ["lib"]
23
23
 
24
24
  gem.required_ruby_version = ">= 2.4"
25
25
 
26
- gem.add_dependency "gapic-common", "~> 0.2"
27
- <%- if gem.iam_dependency? -%>
28
- gem.add_dependency "grpc-google-iam-v1", ">= 0.6.10", "< 2.0"
26
+ <%- gem.dependency_list.each do |name, requirements| -%>
27
+ gem.add_dependency <%= name.inspect %>, <%= requirements.map { |v| v.inspect }.join ", " %>
29
28
  <%- end -%>
30
29
 
31
30
  gem.add_development_dependency "google-style", "~> 1.24.0"
32
- gem.add_development_dependency "minitest", "~> 5.10"
31
+ gem.add_development_dependency "minitest", "~> 5.14"
32
+ gem.add_development_dependency "minitest-focus", "~> 1.1"
33
+ gem.add_development_dependency "minitest-rg", "~> 5.2"
33
34
  gem.add_development_dependency "rake", ">= 12.0"
34
35
  gem.add_development_dependency "redcarpet", "~> 3.0"
35
36
  gem.add_development_dependency "simplecov", "~> 0.18"
@@ -10,6 +10,7 @@ RuboCop::RakeTask.new
10
10
  require "rake/testtask"
11
11
  desc "Run tests."
12
12
  Rake::TestTask.new do |t|
13
+ t.libs << "test"
13
14
  t.test_files = FileList["test/**/*_test.rb"]
14
15
  t.warning = false
15
16
  end
@@ -0,0 +1,8 @@
1
+ <%- assert_locals gem -%>
2
+ <%= render partial: "shared/header" -%>
3
+
4
+ require "simplecov"
5
+
6
+ require "minitest/autorun"
7
+ require "minitest/focus"
8
+ require "minitest/rg"
@@ -5,12 +5,13 @@
5
5
  <%= @requires -%>
6
6
  <%- end -%>
7
7
 
8
- <%- namespace.split("::").each_with_index do |ns, i| -%>
8
+ <%- namespace_components = namespace.split("::").reject(&:empty?) -%>
9
+ <%- namespace_components.each_with_index do |ns, i| -%>
9
10
  <%= indent "module #{ns}", i*2 %>
10
11
  <%- end -%>
11
- <%= indent yield, namespace.split("::").count*2 %>
12
- <%- namespace.split("::").count.times do |i| -%>
13
- <%= indent "end", (namespace.split("::").count-1-i)*2 %>
12
+ <%= indent yield, namespace_components.count*2 %>
13
+ <%- namespace_components.count.times do |i| -%>
14
+ <%= indent "end", (namespace_components.count-1-i)*2 %>
14
15
  <%- end -%>
15
16
  <%- if instance_variable_defined? :@footer -%>
16
17
 
@@ -6,7 +6,9 @@ require "gapic/config/method"
6
6
 
7
7
  require "<%= service.gem.version_require %>"
8
8
 
9
+ <%- unless service.generic_endpoint? -%>
9
10
  require "<%= service.credentials_require %>"
11
+ <%- end -%>
10
12
  <%- if service.paths? -%>
11
13
  require "<%= service.paths_require %>"
12
14
  <%- end -%>
@@ -10,8 +10,8 @@
10
10
  <%- end -%>
11
11
  <%- end -%>
12
12
  class <%= message.name %>
13
- include Google::Protobuf::MessageExts
14
- extend Google::Protobuf::MessageExts::ClassMethods
13
+ include ::Google::Protobuf::MessageExts
14
+ extend ::Google::Protobuf::MessageExts::ClassMethods
15
15
  <%- message.nested_messages.each do |submsg| -%>
16
16
 
17
17
  <%= indent_tail render(partial: "proto_docs/message", locals: { message: submsg }), 2 %>
@@ -29,7 +29,7 @@ class <%= service.client_name %>
29
29
  # To modify the configuration for all <%= service.name %> clients:
30
30
  #
31
31
  # <%= service.client_name_full %>.configure do |config|
32
- # config.timeout = 10_000
32
+ # config.timeout = 10.0
33
33
  # end
34
34
  #
35
35
  # @yield [config] Configure the <%= service.client_name %> client.
@@ -75,7 +75,7 @@ class <%= service.client_name %>
75
75
  # configuration:
76
76
  #
77
77
  # client = <%= service.client_name_full %>.new do |config|
78
- # config.timeout = 10_000
78
+ # config.timeout = 10.0
79
79
  # end
80
80
  #
81
81
  # @yield [config] Configure the <%= service.name %> client.
@@ -96,11 +96,14 @@ class <%= service.client_name %>
96
96
 
97
97
  # Create credentials
98
98
  credentials = @config.credentials
99
+ <%- unless service.generic_endpoint? -%>
99
100
  credentials ||= Credentials.default scope: @config.scope
100
101
  if credentials.is_a?(String) || credentials.is_a?(Hash)
101
102
  credentials = Credentials.new credentials, scope: @config.scope
102
103
  end
103
- @quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
104
+ <%- end -%>
105
+ @quota_project_id = @config.quota_project
106
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
104
107
 
105
108
  <%- if service.lro? -%>
106
109
  <%= service.lro_client_ivar %> = <%= service.operations_name %>.new do |config|
@@ -109,7 +112,7 @@ class <%= service.client_name %>
109
112
  end
110
113
 
111
114
  <%- end -%>
112
- @<%= service.stub_name %> = Gapic::ServiceStub.new(
115
+ @<%= service.stub_name %> = ::Gapic::ServiceStub.new(
113
116
  <%= service.proto_service_stub_name_full %>,
114
117
  credentials: credentials,
115
118
  endpoint: @config.endpoint,
@@ -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
@@ -111,7 +115,7 @@ class Configuration
111
115
  def rpcs
112
116
  @rpcs ||= begin
113
117
  parent_rpcs = nil
114
- parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
118
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
115
119
  Rpcs.new parent_rpcs
116
120
  end
117
121
  end
@@ -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| -%>