lib/google/cloud/dialogflow/v2/fulfillments/client.rb in google-cloud-dialogflow-v2-0.11.4 vs lib/google/cloud/dialogflow/v2/fulfillments/client.rb in google-cloud-dialogflow-v2-0.11.5
- old
+ new
@@ -177,10 +177,25 @@
#
# @return [::Google::Cloud::Dialogflow::V2::Fulfillment]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/dialogflow/v2"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Dialogflow::V2::Fulfillments::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Dialogflow::V2::GetFulfillmentRequest.new
+ #
+ # # Call the get_fulfillment method.
+ # result = client.get_fulfillment request
+ #
+ # # The returned object is of type Google::Cloud::Dialogflow::V2::Fulfillment.
+ # p result
+ #
def get_fulfillment request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetFulfillmentRequest
@@ -194,13 +209,15 @@
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
- header_params = {
- "name" => request.name
- }
+ header_params = {}
+ if request.name
+ header_params["name"] = request.name
+ end
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.get_fulfillment.timeout,
metadata: metadata,
@@ -248,10 +265,25 @@
#
# @return [::Google::Cloud::Dialogflow::V2::Fulfillment]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
+ # @example Basic example
+ # require "google/cloud/dialogflow/v2"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Dialogflow::V2::Fulfillments::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Dialogflow::V2::UpdateFulfillmentRequest.new
+ #
+ # # Call the update_fulfillment method.
+ # result = client.update_fulfillment request
+ #
+ # # The returned object is of type Google::Cloud::Dialogflow::V2::Fulfillment.
+ # p result
+ #
def update_fulfillment request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::UpdateFulfillmentRequest
@@ -265,12 +297,14 @@
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
- header_params = {
- "fulfillment.name" => request.fulfillment.name
- }
+ header_params = {}
+ if request.fulfillment&.name
+ header_params["fulfillment.name"] = request.fulfillment.name
+ end
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.update_fulfillment.timeout,
metadata: metadata,