Skip to content

Commit 11688f8

Browse files
authored
feat(generator): Support for universe_domain in generated clients (#17132)
1 parent 965e622 commit 11688f8

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

google-apis-generator/google-apis-generator.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
2323
gem.required_ruby_version = ">= 2.5"
2424
gem.add_runtime_dependency "activesupport", ">= 5.0"
2525
gem.add_runtime_dependency "gems", "~> 1.2"
26-
gem.add_runtime_dependency "google-apis-core", ">= 0.11.0", "< 2.a"
27-
gem.add_runtime_dependency "google-apis-discovery_v1", "~> 0.5"
26+
gem.add_runtime_dependency "google-apis-core", ">= 0.12.0", "< 2.a"
27+
gem.add_runtime_dependency "google-apis-discovery_v1", "~> 0.14"
2828
gem.add_runtime_dependency "thor", ">= 0.20", "< 2.a"
2929
end

google-apis-generator/lib/google/apis/generator/templates/gemspec.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ Gem::Specification.new do |gem|
2929
gem.require_paths = ["lib"]
3030

3131
gem.required_ruby_version = '>= 2.5'
32-
gem.add_runtime_dependency "google-apis-core", ">= 0.11.0", "< 2.a"
32+
gem.add_runtime_dependency "google-apis-core", ">= 0.12.0", "< 2.a"
3333
end

google-apis-generator/lib/google/apis/generator/templates/service.rb.tmpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@ module Google
3434
# @see <%= api.documentation_link %>
3535
<% end -%>
3636
class <%= api.service_name %> < Google::Apis::Core::BaseService
37+
DEFAULT_ENDPOINT_TEMPLATE = "<%= api.root_url.to_s.sub '.googleapis.com', '.$UNIVERSE_DOMAIN$' %>"
38+
3739
<% for param in api.parameters.values.reject {|p| p.name == 'fields'} -%>
3840
# @return [<%= param.generated_type %>]
3941
# <%= block_comment(param.description, 8, 2) %>
4042
attr_accessor :<%= param.generated_name %>
4143

4244
<% end -%>
4345
def initialize
44-
super('<%= api.root_url %>', '<%= api.service_path %>',
46+
super(DEFAULT_ENDPOINT_TEMPLATE, '<%= api.service_path %>',
4547
client_name: '<%= api.gem_name %>',
4648
client_version: <%= api.qualified_name %>::GEM_VERSION)
4749
@batch_path = '<%= api.batch_path %>'

0 commit comments

Comments
 (0)