lib/google/cloud/location/locations/rest/service_stub.rb in google-cloud-location-0.3.beta.1 vs lib/google/cloud/location/locations/rest/service_stub.rb in google-cloud-location-0.3.beta.2
- old
+ new
@@ -42,21 +42,23 @@
#
# @param request_pb [::Google::Cloud::Location::ListLocationsRequest]
# A request object representing the call parameters. Required.
# @param options [::Gapic::CallOptions]
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
+ # @param bindings_override [::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>, nil]
+ # Binding overrides for the transcoding. Only used internally.
#
# @yield [result, response] Access the result along with the Faraday response object
# @yieldparam result [::Google::Cloud::Location::ListLocationsResponse]
# @yieldparam response [::Faraday::Response]
#
# @return [::Google::Cloud::Location::ListLocationsResponse]
# A result object deserialized from the server's reply
- def list_locations request_pb, options = nil
+ def list_locations request_pb, options = nil, bindings_override: nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
- verb, uri, query_string_params, body = ServiceStub.transcode_list_locations_request request_pb
+ verb, uri, query_string_params, body = ServiceStub.transcode_list_locations_request request_pb, bindings_override: bindings_override
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split("=", 2) }
else
{}
end
@@ -79,21 +81,23 @@
#
# @param request_pb [::Google::Cloud::Location::GetLocationRequest]
# A request object representing the call parameters. Required.
# @param options [::Gapic::CallOptions]
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
+ # @param bindings_override [::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>, nil]
+ # Binding overrides for the transcoding. Only used internally.
#
# @yield [result, response] Access the result along with the Faraday response object
# @yieldparam result [::Google::Cloud::Location::Location]
# @yieldparam response [::Faraday::Response]
#
# @return [::Google::Cloud::Location::Location]
# A result object deserialized from the server's reply
- def get_location request_pb, options = nil
+ def get_location request_pb, options = nil, bindings_override: nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
- verb, uri, query_string_params, body = ServiceStub.transcode_get_location_request request_pb
+ verb, uri, query_string_params, body = ServiceStub.transcode_get_location_request request_pb, bindings_override: bindings_override
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split("=", 2) }
else
{}
end
@@ -116,55 +120,61 @@
#
# GRPC transcoding helper method for the list_locations REST call
#
# @param request_pb [::Google::Cloud::Location::ListLocationsRequest]
# A request object representing the call parameters. Required.
+ # @param bindings_override [::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>, nil]
+ # Binding overrides for the transcoding.
# @return [Array(String, [String, nil], Hash{String => String})]
# Uri, Body, Query string parameters
- def self.transcode_list_locations_request request_pb
- transcoder = Gapic::Rest::GrpcTranscoder.new
- .with_bindings(
- uri_method: :get,
- uri_template: "/v1/{name}",
- matches: [
- ["name", %r{^locations/?$}, false]
- ]
- )
- .with_bindings(
- uri_method: :get,
- uri_template: "/v1/{name}/locations",
- matches: [
- ["name", %r{^projects/[^/]+/?$}, false]
- ]
- )
+ def self.transcode_list_locations_request request_pb, bindings_override: nil
+ transcoder = Gapic::Rest::GrpcTranscoder.new(bindings_override) if bindings_override
+ transcoder ||= Gapic::Rest::GrpcTranscoder.new
+ .with_bindings(
+ uri_method: :get,
+ uri_template: "/v1/{name}",
+ matches: [
+ ["name", %r{^locations/?$}, false]
+ ]
+ )
+ .with_bindings(
+ uri_method: :get,
+ uri_template: "/v1/{name}/locations",
+ matches: [
+ ["name", %r{^projects/[^/]+/?$}, false]
+ ]
+ )
transcoder.transcode request_pb
end
##
# @private
#
# GRPC transcoding helper method for the get_location REST call
#
# @param request_pb [::Google::Cloud::Location::GetLocationRequest]
# A request object representing the call parameters. Required.
+ # @param bindings_override [::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>, nil]
+ # Binding overrides for the transcoding.
# @return [Array(String, [String, nil], Hash{String => String})]
# Uri, Body, Query string parameters
- def self.transcode_get_location_request request_pb
- transcoder = Gapic::Rest::GrpcTranscoder.new
- .with_bindings(
- uri_method: :get,
- uri_template: "/v1/{name}",
- matches: [
- ["name", %r{^locations/[^/]+/?$}, false]
- ]
- )
- .with_bindings(
- uri_method: :get,
- uri_template: "/v1/{name}",
- matches: [
- ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
- ]
- )
+ def self.transcode_get_location_request request_pb, bindings_override: nil
+ transcoder = Gapic::Rest::GrpcTranscoder.new(bindings_override) if bindings_override
+ transcoder ||= Gapic::Rest::GrpcTranscoder.new
+ .with_bindings(
+ uri_method: :get,
+ uri_template: "/v1/{name}",
+ matches: [
+ ["name", %r{^locations/[^/]+/?$}, false]
+ ]
+ )
+ .with_bindings(
+ uri_method: :get,
+ uri_template: "/v1/{name}",
+ matches: [
+ ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
+ ]
+ )
transcoder.transcode request_pb
end
end
end
end