From 11688f8f76413eb376137afd655d07fe6cf8fb53 Mon Sep 17 00:00:00 2001 From: Daniel Azuma Date: Mon, 22 Jan 2024 10:30:28 -0800 Subject: [PATCH] feat(generator): Support for universe_domain in generated clients (#17132) --- google-apis-generator/google-apis-generator.gemspec | 4 ++-- .../lib/google/apis/generator/templates/gemspec.tmpl | 2 +- .../lib/google/apis/generator/templates/service.rb.tmpl | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/google-apis-generator/google-apis-generator.gemspec b/google-apis-generator/google-apis-generator.gemspec index 156ed3a118b..77d71702394 100644 --- a/google-apis-generator/google-apis-generator.gemspec +++ b/google-apis-generator/google-apis-generator.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.5" gem.add_runtime_dependency "activesupport", ">= 5.0" gem.add_runtime_dependency "gems", "~> 1.2" - gem.add_runtime_dependency "google-apis-core", ">= 0.11.0", "< 2.a" - gem.add_runtime_dependency "google-apis-discovery_v1", "~> 0.5" + gem.add_runtime_dependency "google-apis-core", ">= 0.12.0", "< 2.a" + gem.add_runtime_dependency "google-apis-discovery_v1", "~> 0.14" gem.add_runtime_dependency "thor", ">= 0.20", "< 2.a" end 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 6c478a64ea3..ca23f70dc5b 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 fcf3cf7f5dd..9c85e65fd09 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.to_s.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 %>'