Cloud Speech-to-Text V1 API - Class Google::Cloud::Speech::V1::Speech::Rest::Client (v0.12.0)

Reference documentation and code samples for the Cloud Speech-to-Text V1 API class Google::Cloud::Speech::V1::Speech::Rest::Client.

REST client for the Speech service.

Service that implements Google Cloud Speech API.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the Speech Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all Speech clients
::Google::Cloud::Speech::V1::Speech::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the Speech Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#initialize

def initialize() { |config| ... } -> Client

Create a new Speech REST client object.

Yields
  • (config) — Configure the Speech client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Speech::V1::Speech::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Speech::V1::Speech::Rest::Client.new do |config|
  config.timeout = 10.0
end

#long_running_recognize

def long_running_recognize(request, options = nil) -> ::Gapic::Operation
def long_running_recognize(config: nil, audio: nil, output_config: nil) -> ::Gapic::Operation

Performs asynchronous speech recognition: receive results via the google.longrunning.Operations interface. Returns either an Operation.error or an Operation.response which contains a LongRunningRecognizeResponse message. For more information on asynchronous speech recognition, see the how-to.

Overloads
def long_running_recognize(request, options = nil) -> ::Gapic::Operation
Pass arguments to long_running_recognize via a request object, either of type LongRunningRecognizeRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V1::LongRunningRecognizeRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def long_running_recognize(config: nil, audio: nil, output_config: nil) -> ::Gapic::Operation
Pass arguments to long_running_recognize via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#operations_client

def operations_client() -> ::Google::Cloud::Speech::V1::Speech::Rest::Operations

Get the associated client for long-running operations.

#recognize

def recognize(request, options = nil) -> ::Google::Cloud::Speech::V1::RecognizeResponse
def recognize(config: nil, audio: nil) -> ::Google::Cloud::Speech::V1::RecognizeResponse

Performs synchronous speech recognition: receive results after all audio has been sent and processed.

Overloads
def recognize(request, options = nil) -> ::Google::Cloud::Speech::V1::RecognizeResponse
Pass arguments to recognize via a request object, either of type RecognizeRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V1::RecognizeRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def recognize(config: nil, audio: nil) -> ::Google::Cloud::Speech::V1::RecognizeResponse
Pass arguments to recognize via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.