lib/google/area120/tables/v1alpha1/tables_service/rest/service_stub.rb in google-area120-tables-v1alpha1-0.8.1 vs lib/google/area120/tables/v1alpha1/tables_service/rest/service_stub.rb in google-area120-tables-v1alpha1-0.9.0
- old
+ new
@@ -28,21 +28,24 @@
# REST service stub for the TablesService service.
# Service stub contains baseline method implementations
# including transcoding, making the REST call, and deserialing the response.
#
class ServiceStub
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
+ # @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,
- raise_faraday_errors: false
+ service_name: self.class,
+ raise_faraday_errors: false,
+ logger: logger
end
##
# The effective universe domain
#
@@ -60,10 +63,19 @@
def endpoint
@client_stub.endpoint
end
##
+ # The logger used for request/response debug logging.
+ #
+ # @return [Logger]
+ #
+ def logger stub: false
+ stub ? @client_stub.stub_logger : @client_stub.logger
+ end
+
+ ##
# Baseline implementation for the get_table REST call
#
# @param request_pb [::Google::Area120::Tables::V1alpha1::GetTableRequest]
# A request object representing the call parameters. Required.
# @param options [::Gapic::CallOptions]
@@ -85,20 +97,22 @@
{}
end
response = @client_stub.make_http_request(
verb,
- uri: uri,
- body: body || "",
- params: query_string_params,
+ uri: uri,
+ body: body || "",
+ params: query_string_params,
+ method_name: "get_table",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Area120::Tables::V1alpha1::Table.decode_json response.body, ignore_unknown_fields: true
-
- yield result, operation if block_given?
- result
+ catch :response do
+ yield result, operation if block_given?
+ result
+ end
end
##
# Baseline implementation for the list_tables REST call
#
@@ -123,20 +137,22 @@
{}
end
response = @client_stub.make_http_request(
verb,
- uri: uri,
- body: body || "",
- params: query_string_params,
+ uri: uri,
+ body: body || "",
+ params: query_string_params,
+ method_name: "list_tables",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Area120::Tables::V1alpha1::ListTablesResponse.decode_json response.body, ignore_unknown_fields: true
-
- yield result, operation if block_given?
- result
+ catch :response do
+ yield result, operation if block_given?
+ result
+ end
end
##
# Baseline implementation for the get_workspace REST call
#
@@ -161,20 +177,22 @@
{}
end
response = @client_stub.make_http_request(
verb,
- uri: uri,
- body: body || "",
- params: query_string_params,
+ uri: uri,
+ body: body || "",
+ params: query_string_params,
+ method_name: "get_workspace",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Area120::Tables::V1alpha1::Workspace.decode_json response.body, ignore_unknown_fields: true
-
- yield result, operation if block_given?
- result
+ catch :response do
+ yield result, operation if block_given?
+ result
+ end
end
##
# Baseline implementation for the list_workspaces REST call
#
@@ -199,20 +217,22 @@
{}
end
response = @client_stub.make_http_request(
verb,
- uri: uri,
- body: body || "",
- params: query_string_params,
+ uri: uri,
+ body: body || "",
+ params: query_string_params,
+ method_name: "list_workspaces",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Area120::Tables::V1alpha1::ListWorkspacesResponse.decode_json response.body, ignore_unknown_fields: true
-
- yield result, operation if block_given?
- result
+ catch :response do
+ yield result, operation if block_given?
+ result
+ end
end
##
# Baseline implementation for the get_row REST call
#
@@ -237,20 +257,22 @@
{}
end
response = @client_stub.make_http_request(
verb,
- uri: uri,
- body: body || "",
- params: query_string_params,
+ uri: uri,
+ body: body || "",
+ params: query_string_params,
+ method_name: "get_row",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Area120::Tables::V1alpha1::Row.decode_json response.body, ignore_unknown_fields: true
-
- yield result, operation if block_given?
- result
+ catch :response do
+ yield result, operation if block_given?
+ result
+ end
end
##
# Baseline implementation for the list_rows REST call
#
@@ -275,20 +297,22 @@
{}
end
response = @client_stub.make_http_request(
verb,
- uri: uri,
- body: body || "",
- params: query_string_params,
+ uri: uri,
+ body: body || "",
+ params: query_string_params,
+ method_name: "list_rows",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Area120::Tables::V1alpha1::ListRowsResponse.decode_json response.body, ignore_unknown_fields: true
-
- yield result, operation if block_given?
- result
+ catch :response do
+ yield result, operation if block_given?
+ result
+ end
end
##
# Baseline implementation for the create_row REST call
#
@@ -313,20 +337,22 @@
{}
end
response = @client_stub.make_http_request(
verb,
- uri: uri,
- body: body || "",
- params: query_string_params,
+ uri: uri,
+ body: body || "",
+ params: query_string_params,
+ method_name: "create_row",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Area120::Tables::V1alpha1::Row.decode_json response.body, ignore_unknown_fields: true
-
- yield result, operation if block_given?
- result
+ catch :response do
+ yield result, operation if block_given?
+ result
+ end
end
##
# Baseline implementation for the batch_create_rows REST call
#
@@ -351,20 +377,22 @@
{}
end
response = @client_stub.make_http_request(
verb,
- uri: uri,
- body: body || "",
- params: query_string_params,
+ uri: uri,
+ body: body || "",
+ params: query_string_params,
+ method_name: "batch_create_rows",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Area120::Tables::V1alpha1::BatchCreateRowsResponse.decode_json response.body, ignore_unknown_fields: true
-
- yield result, operation if block_given?
- result
+ catch :response do
+ yield result, operation if block_given?
+ result
+ end
end
##
# Baseline implementation for the update_row REST call
#
@@ -389,20 +417,22 @@
{}
end
response = @client_stub.make_http_request(
verb,
- uri: uri,
- body: body || "",
- params: query_string_params,
+ uri: uri,
+ body: body || "",
+ params: query_string_params,
+ method_name: "update_row",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Area120::Tables::V1alpha1::Row.decode_json response.body, ignore_unknown_fields: true
-
- yield result, operation if block_given?
- result
+ catch :response do
+ yield result, operation if block_given?
+ result
+ end
end
##
# Baseline implementation for the batch_update_rows REST call
#
@@ -427,20 +457,22 @@
{}
end
response = @client_stub.make_http_request(
verb,
- uri: uri,
- body: body || "",
- params: query_string_params,
+ uri: uri,
+ body: body || "",
+ params: query_string_params,
+ method_name: "batch_update_rows",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Area120::Tables::V1alpha1::BatchUpdateRowsResponse.decode_json response.body, ignore_unknown_fields: true
-
- yield result, operation if block_given?
- result
+ catch :response do
+ yield result, operation if block_given?
+ result
+ end
end
##
# Baseline implementation for the delete_row REST call
#
@@ -465,20 +497,22 @@
{}
end
response = @client_stub.make_http_request(
verb,
- uri: uri,
- body: body || "",
- params: query_string_params,
+ uri: uri,
+ body: body || "",
+ params: query_string_params,
+ method_name: "delete_row",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
-
- yield result, operation if block_given?
- result
+ catch :response do
+ yield result, operation if block_given?
+ result
+ end
end
##
# Baseline implementation for the batch_delete_rows REST call
#
@@ -503,19 +537,21 @@
{}
end
response = @client_stub.make_http_request(
verb,
- uri: uri,
- body: body || "",
- params: query_string_params,
+ uri: uri,
+ body: body || "",
+ params: query_string_params,
+ method_name: "batch_delete_rows",
options: options
)
operation = ::Gapic::Rest::TransportOperation.new response
result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
-
- yield result, operation if block_given?
- result
+ catch :response do
+ yield result, operation if block_given?
+ result
+ end
end
##
# @private
#