options (Gapic::CallOptions, Hash) (defaults to: nil) — The options for making the RPC call. A Hash can be provided to
customize the options object, using keys that match the arguments for CallOptions.new. This object
should only be used once.
Yields
(response, operation) — Access the response along with the RPC operation. Additionally, throwing
:response, obj within the block will change the return value to obj.
Yield Parameters
response (Object) — The response object.
operation (::GRPC::ActiveCall::Operation) — The RPC operation for the response.
Creates an API object for making a single RPC call.
In typical usage, stub_method will be a proc used to make an RPC request. This will mostly likely be a bound
method from a request Stub used to make an RPC call.
The result is created by applying a series of function decorators defined in this module to stub_method.
The result is another proc which has the same signature as the original.
Parameter
stub_method (Proc) — Used to make a bare rpc call.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# gapic-common - Class Gapic::ServiceStub::RpcCall (v1.1.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.1.0 (latest)](/ruby/docs/reference/gapic-common/latest/Gapic-ServiceStub-RpcCall)\n- [1.0.1](/ruby/docs/reference/gapic-common/1.0.1/Gapic-ServiceStub-RpcCall)\n- [0.26.0](/ruby/docs/reference/gapic-common/0.26.0/Gapic-ServiceStub-RpcCall)\n- [0.25.0](/ruby/docs/reference/gapic-common/0.25.0/Gapic-ServiceStub-RpcCall)\n- [0.24.0](/ruby/docs/reference/gapic-common/0.24.0/Gapic-ServiceStub-RpcCall) \nReference documentation and code samples for the gapic-common class Gapic::ServiceStub::RpcCall. \n\nInherits\n--------\n\n- Object\n\nMethods\n-------\n\n### #call\n\n def call(request, options: nil) { |response, operation| ... } -\u003e Object\n\nInvoke the RPC call. \n**Parameters**\n\n- **request** (Object) --- The request object.\n- **options** ([Gapic::CallOptions](./Gapic-CallOptions), Hash) *(defaults to: nil)* --- The options for making the RPC call. A Hash can be provided to customize the options object, using keys that match the arguments for CallOptions.new. This object should only be used once. \n**Yields**\n\n- (response, operation) --- Access the response along with the RPC operation. Additionally, throwing `:response, obj` within the block will change the return value to `obj`. \n**Yield Parameters**\n\n- **response** (Object) --- The response object.\n- **operation** (::GRPC::ActiveCall::Operation) --- The RPC operation for the response. \n**Returns**\n\n- (Object) --- The response object.\n**Examples** \n\n```ruby\nrequire \"google/showcase/v1beta1/echo_pb\"\nrequire \"google/showcase/v1beta1/echo_services_pb\"\nrequire \"gapic\"\nrequire \"gapic/grpc\"\n\necho_channel = ::GRPC::Core::Channel.new(\n \"localhost:7469\", nil, :this_channel_is_insecure\n)\necho_stub = Gapic::ServiceStub.new(\n Google::Showcase::V1beta1::Echo::Stub,\n endpoint: \"localhost:7469\", credentials: echo_channel\n)\necho_call = Gapic::ServiceStub::RpcCall.new echo_stub.method :echo\n\nrequest = Google::Showcase::V1beta1::EchoRequest.new\nresponse = echo_call.call request\n```\n\nUsing custom call options: \n\n```ruby\nrequire \"google/showcase/v1beta1/echo_pb\"\nrequire \"google/showcase/v1beta1/echo_services_pb\"\nrequire \"gapic\"\nrequire \"gapic/grpc\"\n\necho_channel = ::GRPC::Core::Channel.new(\n \"localhost:7469\", nil, :this_channel_is_insecure\n)\necho_stub = Gapic::ServiceStub.new(\n Google::Showcase::V1beta1::Echo::Stub,\n endpoint: \"localhost:7469\", credentials: echo_channel\n)\necho_call = Gapic::ServiceStub::RpcCall.new echo_stub.method :echo\n\nrequest = Google::Showcase::V1beta1::EchoRequest.new\noptions = Gapic::CallOptions.new(\n retry_policy = {\n retry_codes: [::GRPC::Core::StatusCodes::UNAVAILABLE]\n }\n)\nresponse = echo_call.call request, options: options\n```\n\nAccessing the RPC operation using a block: \n\n```ruby\nrequire \"google/showcase/v1beta1/echo_pb\"\nrequire \"google/showcase/v1beta1/echo_services_pb\"\nrequire \"gapic\"\nrequire \"gapic/grpc\"\n\necho_channel = ::GRPC::Core::Channel.new(\n \"localhost:7469\", nil, :this_channel_is_insecure\n)\necho_stub = Gapic::ServiceStub.new(\n Google::Showcase::V1beta1::Echo::Stub,\n endpoint: \"localhost:7469\", credentials: echo_channel\n)\necho_call = Gapic::ServiceStub::RpcCall.new echo_stub.method :echo\n\nrequest = Google::Showcase::V1beta1::EchoRequest.new\nmetadata = echo_call.call request do |_response, operation|\n throw :response, operation.trailing_metadata\nend\n```\n\n### #initialize\n\n def initialize(stub_method, stub_logger: nil, method_name: nil) -\u003e RpcCall\n\nCreates an API object for making a single RPC call.\n\n\nIn typical usage, `stub_method` will be a proc used to make an RPC request. This will mostly likely be a bound\nmethod from a request Stub used to make an RPC call.\n\nThe result is created by applying a series of function decorators defined in this module to `stub_method`.\n\n\u003cbr /\u003e\n\nThe result is another proc which has the same signature as the original. \n**Parameter**\n\n- **stub_method** (Proc) --- Used to make a bare rpc call. \n**Returns**\n\n- ([RpcCall](./Gapic-ServiceStub-RpcCall)) --- a new instance of RpcCall\n\n### #stub_method\n\n def stub_method()\n\nReturns the value of attribute stub_method."]]