class Gapic::CallOptions
@return [RetryPolicy, Object]
@!attribute [r] retry_policy
@return [Hash]
@!attribute [r] metadata
@return [Numeric, nil]
@!attribute [r] timeout
Encapsulates the overridable settings for a particular RPC call.
#
def apply_defaults timeout: nil, metadata: nil, retry_policy: nil
-
retry_policy
(Hash
) -- The policy for error retry. keys must match the arguments for -
metadata
(Hash
) -- the request header params. -
timeout
(Numeric
) -- The client-side timeout for RPC calls.
Other tags:
- Private: -
def apply_defaults timeout: nil, metadata: nil, retry_policy: nil @timeout ||= timeout @metadata = metadata.merge @metadata if metadata @retry_policy.apply_defaults retry_policy if @retry_policy.respond_to? :apply_defaults end
def eql? other
- Private: - Equality test
def eql? other other.is_a?(CallOptions) && other.timeout == timeout && other.metadata == metadata && other.retry_policy == retry_policy end
def hash
- Private: - Hash code
def hash to_h.hash end
def initialize timeout: nil, metadata: nil, retry_policy: nil
-
retry_policy
(Hash, RetryPolicy, Proc
) -- The policy for error retry. A Hash can be provided to -
metadata
(Hash
) -- The request header params. -
timeout
(Numeric
) -- The client-side timeout for RPC calls.
def initialize timeout: nil, metadata: nil, retry_policy: nil # Converts hash and nil to a policy object retry_policy = RetryPolicy.new(**retry_policy.to_h) if retry_policy.respond_to? :to_h @timeout = timeout # allow to be nil so it can be overridden @metadata = metadata.to_h # Ensure always hash, even for nil @retry_policy = retry_policy end
def merge **kwargs
-
(CallOptions)
- A new CallOptions object.
Parameters:
-
kwargs
(keywords
) -- Updated fields. See {#initialize} for details.
def merge **kwargs kwargs = to_h.merge kwargs CallOptions.new(**kwargs) end
def to_h
-
(Hash)
-
def to_h { timeout: timeout, metadata: metadata, retry_policy: retry_policy } end