lib/google/cloud/video/transcoder/v1/transcoder_service/rest/service_stub.rb in google-cloud-video-transcoder-v1-1.0.1 vs lib/google/cloud/video/transcoder/v1/transcoder_service/rest/service_stub.rb in google-cloud-video-transcoder-v1-1.1.0

- old
+ new

@@ -29,21 +29,24 @@ # REST service stub for the TranscoderService 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 # @@ -61,10 +64,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 create_job REST call # # @param request_pb [::Google::Cloud::Video::Transcoder::V1::CreateJobRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] @@ -86,20 +98,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_job", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Video::Transcoder::V1::Job.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_jobs REST call # @@ -124,20 +138,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_jobs", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Video::Transcoder::V1::ListJobsResponse.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_job REST call # @@ -162,20 +178,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_job", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Video::Transcoder::V1::Job.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_job REST call # @@ -200,20 +218,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_job", 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 create_job_template REST call # @@ -238,20 +258,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_job_template", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Video::Transcoder::V1::JobTemplate.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_job_templates REST call # @@ -276,20 +298,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_job_templates", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Video::Transcoder::V1::ListJobTemplatesResponse.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_job_template REST call # @@ -314,20 +338,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_job_template", options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Video::Transcoder::V1::JobTemplate.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_job_template REST call # @@ -352,19 +378,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: "delete_job_template", 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 #