class Google::Cloud::Location::Locations::Rest::ServiceStub


including transcoding, making the REST call, and deserialing the response.
Service stub contains baseline method implementations
REST service stub for the Locations service.
#

def self.transcode_get_location_request request_pb, bindings_override: nil

Returns:
  • (Array(String, [String, nil], Hash{String => String})) -

Parameters:
  • bindings_override (::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>, nil) --
  • request_pb (::Google::Cloud::Location::GetLocationRequest) --

Other tags:
    Private: -
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

def self.transcode_list_locations_request request_pb, bindings_override: nil

Returns:
  • (Array(String, [String, nil], Hash{String => String})) -

Parameters:
  • bindings_override (::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>, nil) --
  • request_pb (::Google::Cloud::Location::ListLocationsRequest) --

Other tags:
    Private: -
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

def endpoint

Returns:
  • (String) -
def endpoint
  @client_stub.endpoint
end

def get_location request_pb, options = nil, bindings_override: nil

Returns:
  • (::Google::Cloud::Location::Location) -

Other tags:
    Yieldparam: operation -
    Yieldparam: result -

Other tags:
    Yield: - Access the result along with the TransportOperation object

Parameters:
  • bindings_override (::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>, nil) --
  • options (::Gapic::CallOptions) --
  • request_pb (::Google::Cloud::Location::GetLocationRequest) --
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, bindings_override: bindings_override
  query_string_params = if query_string_params.any?
                          query_string_params.to_h { |p| p.split "=", 2 }
                        else
                          {}
                        end
  response = @client_stub.make_http_request(
    verb,
    uri: uri,
    body: body || "",
    params: query_string_params,
    method_name: "get_location",
    options: options
  )
  operation = ::Gapic::Rest::TransportOperation.new response
  result = ::Google::Cloud::Location::Location.decode_json response.body, ignore_unknown_fields: true
  catch :response do
    yield result, operation if block_given?
    result
  end
end

def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:

Other tags:
    Private: -
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
  # These require statements are intentionally placed here to initialize
  # the REST modules only when it's required.
  require "gapic/rest"
  @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
                                               endpoint_template: endpoint_template,
                                               universe_domain: universe_domain,
                                               credentials: credentials,
                                               numeric_enums: true,
                                               service_name: self.class,
                                               raise_faraday_errors: false,
                                               logger: logger
end

def list_locations request_pb, options = nil, bindings_override: nil

Returns:
  • (::Google::Cloud::Location::ListLocationsResponse) -

Other tags:
    Yieldparam: operation -
    Yieldparam: result -

Other tags:
    Yield: - Access the result along with the TransportOperation object

Parameters:
  • bindings_override (::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>, nil) --
  • options (::Gapic::CallOptions) --
  • request_pb (::Google::Cloud::Location::ListLocationsRequest) --
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, bindings_override: bindings_override
  query_string_params = if query_string_params.any?
                          query_string_params.to_h { |p| p.split "=", 2 }
                        else
                          {}
                        end
  response = @client_stub.make_http_request(
    verb,
    uri: uri,
    body: body || "",
    params: query_string_params,
    method_name: "list_locations",
    options: options
  )
  operation = ::Gapic::Rest::TransportOperation.new response
  result = ::Google::Cloud::Location::ListLocationsResponse.decode_json response.body, ignore_unknown_fields: true
  catch :response do
    yield result, operation if block_given?
    result
  end
end

def logger stub: false

Returns:
  • (Logger) -
def logger stub: false
  stub ? @client_stub.stub_logger : @client_stub.logger
end

def universe_domain

Returns:
  • (String) -
def universe_domain
  @client_stub.universe_domain
end