From 79e6620d0c7c1dd15bbbae4272c183770fc70d26 Mon Sep 17 00:00:00 2001 From: Daniel Azuma Date: Wed, 17 Jan 2024 02:14:21 +0000 Subject: [PATCH] feat(generator): Support for universe_domain in generated clients --- .../lib/google/apis/generator/templates/gemspec.tmpl | 2 +- .../lib/google/apis/generator/templates/service.rb.tmpl | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/google-apis-generator/lib/google/apis/generator/templates/gemspec.tmpl b/google-apis-generator/lib/google/apis/generator/templates/gemspec.tmpl index 6c478a64ea3f..ca23f70dc5bd 100644 --- a/google-apis-generator/lib/google/apis/generator/templates/gemspec.tmpl +++ b/google-apis-generator/lib/google/apis/generator/templates/gemspec.tmpl @@ -29,5 +29,5 @@ Gem::Specification.new do |gem| gem.require_paths = ["lib"] gem.required_ruby_version = '>= 2.5' - gem.add_runtime_dependency "google-apis-core", ">= 0.11.0", "< 2.a" + gem.add_runtime_dependency "google-apis-core", ">= 0.12.0", "< 2.a" end diff --git a/google-apis-generator/lib/google/apis/generator/templates/service.rb.tmpl b/google-apis-generator/lib/google/apis/generator/templates/service.rb.tmpl index fcf3cf7f5dd5..67918f9ea200 100644 --- a/google-apis-generator/lib/google/apis/generator/templates/service.rb.tmpl +++ b/google-apis-generator/lib/google/apis/generator/templates/service.rb.tmpl @@ -34,6 +34,8 @@ module Google # @see <%= api.documentation_link %> <% end -%> class <%= api.service_name %> < Google::Apis::Core::BaseService + DEFAULT_ENDPOINT_TEMPLATE = "<%= api.root_url.sub '.googleapis.com', '.$UNIVERSE_DOMAIN$' %>" + <% for param in api.parameters.values.reject {|p| p.name == 'fields'} -%> # @return [<%= param.generated_type %>] # <%= block_comment(param.description, 8, 2) %> @@ -41,7 +43,7 @@ module Google <% end -%> def initialize - super('<%= api.root_url %>', '<%= api.service_path %>', + super(DEFAULT_ENDPOINT_TEMPLATE, '<%= api.service_path %>', client_name: '<%= api.gem_name %>', client_version: <%= api.qualified_name %>::GEM_VERSION) @batch_path = '<%= api.batch_path %>'