templates/default/service/client/_client.erb in gapic-generator-0.9.1 vs templates/default/service/client/_client.erb in gapic-generator-0.10.0

- old
+ new

@@ -21,18 +21,21 @@ ## # Configure the <%= service.name %> <%= service.client_name %> class. # # See {<%= service.client_name_full %>::Configuration} # for a description of the configuration fields. +<%- if service.is_deprecated? -%> # - # ## Example + # @deprecated This service is deprecated and may be removed in the next major version update. +<%- end -%> # - # To modify the configuration for all <%= service.name %> clients: + # @example # - # <%= service.client_name_full %>.configure do |config| - # config.timeout = 10.0 - # end + # # Modify the configuration for all <%= service.name %> clients + # <%= service.client_name_full %>.configure do |config| + # config.timeout = 10.0 + # end # # @yield [config] Configure the <%= service.client_name %> client. # @yieldparam config [<%= service.client_name %>::Configuration] # # @return [<%= service.client_name %>::Configuration] @@ -62,24 +65,20 @@ end ## # Create a new <%= service.name %> client object. # - # ## Examples + # @example # - # To create a new <%= service.name %> client with the default - # configuration: + # # Create a client using the default configuration + # client = <%= service.client_name_full %>.new # - # client = <%= service.client_name_full %>.new + # # Create a client using a custom configuration + # client = <%= service.client_name_full %>.new do |config| + # config.timeout = 10.0 + # end # - # To create a new <%= service.name %> client with a custom - # configuration: - # - # client = <%= service.client_name_full %>.new do |config| - # config.timeout = 10.0 - # end - # # @yield [config] Configure the <%= service.name %> client. # @yieldparam config [<%= service.client_name %>::Configuration] # def initialize # These require statements are intentionally placed here to initialize @@ -95,13 +94,12 @@ yield @config if block_given? # Create credentials credentials = @config.credentials <%- unless service.generic_endpoint? -%> - # Use self-signed JWT if the scope and endpoint are unchanged from default, + # Use self-signed JWT if the endpoint is unchanged from default, # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.scope == <%= service.client_name %>.configure.scope && - @config.endpoint == <%= service.client_name %>.configure.endpoint && + enable_self_signed_jwt = @config.endpoint == <%= service.client_name %>.configure.endpoint && !@config.endpoint.split(".").first.include?("-") credentials ||= Credentials.default scope: @config.scope, enable_self_signed_jwt: enable_self_signed_jwt if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope