lib/google/cloud/dialogflow/v2/documents/client.rb in google-cloud-dialogflow-v2-0.11.0 vs lib/google/cloud/dialogflow/v2/documents/client.rb in google-cloud-dialogflow-v2-0.11.1

- old
+ new

@@ -39,18 +39,17 @@ # Configure the Documents Client class. # # See {::Google::Cloud::Dialogflow::V2::Documents::Client::Configuration} # for a description of the configuration fields. # - # ## Example + # @example # - # To modify the configuration for all Documents clients: + # # Modify the configuration for all Documents clients + # ::Google::Cloud::Dialogflow::V2::Documents::Client.configure do |config| + # config.timeout = 10.0 + # end # - # ::Google::Cloud::Dialogflow::V2::Documents::Client.configure do |config| - # config.timeout = 10.0 - # end - # # @yield [config] Configure the Client client. # @yieldparam config [Client::Configuration] # # @return [Client::Configuration] # @@ -97,24 +96,20 @@ end ## # Create a new Documents client object. # - # ## Examples + # @example # - # To create a new Documents client with the default - # configuration: + # # Create a client using the default configuration + # client = ::Google::Cloud::Dialogflow::V2::Documents::Client.new # - # client = ::Google::Cloud::Dialogflow::V2::Documents::Client.new + # # Create a client using a custom configuration + # client = ::Google::Cloud::Dialogflow::V2::Documents::Client.new do |config| + # config.timeout = 10.0 + # end # - # To create a new Documents client with a custom - # configuration: - # - # client = ::Google::Cloud::Dialogflow::V2::Documents::Client.new do |config| - # config.timeout = 10.0 - # end - # # @yield [config] Configure the Documents client. # @yieldparam config [Client::Configuration] # def initialize # These require statements are intentionally placed here to initialize @@ -129,14 +124,13 @@ # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials - # 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 == Client.configure.scope && - @config.endpoint == Client.configure.endpoint && + enable_self_signed_jwt = @config.endpoint == Client.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 @@ -227,11 +221,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_documents.timeout, metadata: metadata, retry_policy: @config.rpcs.list_documents.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @documents_stub.call_rpc :list_documents, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @documents_stub, :list_documents, request, response, operation, options yield response, operation if block_given? @@ -296,11 +292,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_document.timeout, metadata: metadata, retry_policy: @config.rpcs.get_document.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @documents_stub.call_rpc :get_document, request, options: options do |response, operation| yield response, operation if block_given? return response @@ -369,11 +367,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_document.timeout, metadata: metadata, retry_policy: @config.rpcs.create_document.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @documents_stub.call_rpc :create_document, request, options: options do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: options yield response, operation if block_given? @@ -441,11 +441,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.delete_document.timeout, metadata: metadata, retry_policy: @config.rpcs.delete_document.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @documents_stub.call_rpc :delete_document, request, options: options do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: options yield response, operation if block_given? @@ -515,11 +517,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.update_document.timeout, metadata: metadata, retry_policy: @config.rpcs.update_document.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @documents_stub.call_rpc :update_document, request, options: options do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: options yield response, operation if block_given? @@ -599,11 +603,13 @@ metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.reload_document.timeout, metadata: metadata, retry_policy: @config.rpcs.reload_document.retry_policy - options.apply_defaults metadata: @config.metadata, + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, retry_policy: @config.retry_policy @documents_stub.call_rpc :reload_document, request, options: options do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: options yield response, operation if block_given? @@ -624,25 +630,24 @@ # for a list of RPCs that can be configured independently. # # Configuration can be applied globally to all clients, or to a single client # on construction. # - # # Examples + # @example # - # To modify the global config, setting the timeout for list_documents - # to 20 seconds, and all remaining timeouts to 10 seconds: + # # Modify the global config, setting the timeout for + # # list_documents to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Dialogflow::V2::Documents::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_documents.timeout = 20.0 + # end # - # ::Google::Cloud::Dialogflow::V2::Documents::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_documents.timeout = 20.0 - # end - # - # To apply the above configuration only to a new client: - # - # client = ::Google::Cloud::Dialogflow::V2::Documents::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_documents.timeout = 20.0 - # end + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Dialogflow::V2::Documents::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_documents.timeout = 20.0 + # end # # @!attribute [rw] endpoint # The hostname or hostname:port of the service endpoint. # Defaults to `"dialogflow.googleapis.com"`. # @return [::String]