Cloud Speech-to-Text V2 API - Class Google::Cloud::Speech::V2::Speech::Rest::Client (v0.7.0)

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

REST client for the Speech service.

Enables speech transcription and resource management.

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::V2::Speech::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#batch_recognize

def batch_recognize(request, options = nil) -> ::Gapic::Operation
def batch_recognize(recognizer: nil, config: nil, config_mask: nil, files: nil, recognition_output_config: nil, processing_strategy: nil) -> ::Gapic::Operation

Performs batch asynchronous speech recognition: send a request with N audio files and receive a long running operation that can be polled to see when the transcriptions are finished.

Overloads
def batch_recognize(request, options = nil) -> ::Gapic::Operation
Pass arguments to batch_recognize via a request object, either of type BatchRecognizeRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::BatchRecognizeRequest, ::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 batch_recognize(recognizer: nil, config: nil, config_mask: nil, files: nil, recognition_output_config: nil, processing_strategy: nil) -> ::Gapic::Operation
Pass arguments to batch_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.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::BatchRecognizeRequest.new

# Call the batch_recognize method.
result = client.batch_recognize request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
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

#create_custom_class

def create_custom_class(request, options = nil) -> ::Gapic::Operation
def create_custom_class(custom_class: nil, validate_only: nil, custom_class_id: nil, parent: nil) -> ::Gapic::Operation

Creates a CustomClass.

Overloads
def create_custom_class(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_custom_class via a request object, either of type CreateCustomClassRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::CreateCustomClassRequest, ::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 create_custom_class(custom_class: nil, validate_only: nil, custom_class_id: nil, parent: nil) -> ::Gapic::Operation
Pass arguments to create_custom_class 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
  • custom_class (::Google::Cloud::Speech::V2::CustomClass, ::Hash) — Required. The CustomClass to create.
  • validate_only (::Boolean) — If set, validate the request and preview the CustomClass, but do not actually create it.
  • custom_class_id (::String) — The ID to use for the CustomClass, which will become the final component of the CustomClass's resource name.

    This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.

  • parent (::String) — Required. The project and location where this CustomClass will be created. The expected format is projects/{project}/locations/{location}.
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.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::CreateCustomClassRequest.new

# Call the create_custom_class method.
result = client.create_custom_class request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#create_phrase_set

def create_phrase_set(request, options = nil) -> ::Gapic::Operation
def create_phrase_set(phrase_set: nil, validate_only: nil, phrase_set_id: nil, parent: nil) -> ::Gapic::Operation

Creates a PhraseSet.

Overloads
def create_phrase_set(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_phrase_set via a request object, either of type CreatePhraseSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::CreatePhraseSetRequest, ::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 create_phrase_set(phrase_set: nil, validate_only: nil, phrase_set_id: nil, parent: nil) -> ::Gapic::Operation
Pass arguments to create_phrase_set 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
  • phrase_set (::Google::Cloud::Speech::V2::PhraseSet, ::Hash) — Required. The PhraseSet to create.
  • validate_only (::Boolean) — If set, validate the request and preview the PhraseSet, but do not actually create it.
  • phrase_set_id (::String) — The ID to use for the PhraseSet, which will become the final component of the PhraseSet's resource name.

    This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.

  • parent (::String) — Required. The project and location where this PhraseSet will be created. The expected format is projects/{project}/locations/{location}.
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.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::CreatePhraseSetRequest.new

# Call the create_phrase_set method.
result = client.create_phrase_set request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#create_recognizer

def create_recognizer(request, options = nil) -> ::Gapic::Operation
def create_recognizer(recognizer: nil, validate_only: nil, recognizer_id: nil, parent: nil) -> ::Gapic::Operation

Creates a Recognizer.

Overloads
def create_recognizer(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_recognizer via a request object, either of type CreateRecognizerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::CreateRecognizerRequest, ::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 create_recognizer(recognizer: nil, validate_only: nil, recognizer_id: nil, parent: nil) -> ::Gapic::Operation
Pass arguments to create_recognizer 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
  • recognizer (::Google::Cloud::Speech::V2::Recognizer, ::Hash) — Required. The Recognizer to create.
  • validate_only (::Boolean) — If set, validate the request and preview the Recognizer, but do not actually create it.
  • recognizer_id (::String) — The ID to use for the Recognizer, which will become the final component of the Recognizer's resource name.

    This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.

  • parent (::String) — Required. The project and location where this Recognizer will be created. The expected format is projects/{project}/locations/{location}.
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.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::CreateRecognizerRequest.new

# Call the create_recognizer method.
result = client.create_recognizer request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#delete_custom_class

def delete_custom_class(request, options = nil) -> ::Gapic::Operation
def delete_custom_class(name: nil, validate_only: nil, allow_missing: nil, etag: nil) -> ::Gapic::Operation

Deletes the CustomClass.

Overloads
def delete_custom_class(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_custom_class via a request object, either of type DeleteCustomClassRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::DeleteCustomClassRequest, ::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 delete_custom_class(name: nil, validate_only: nil, allow_missing: nil, etag: nil) -> ::Gapic::Operation
Pass arguments to delete_custom_class 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
  • name (::String) — Required. The name of the CustomClass to delete. Format: projects/{project}/locations/{location}/customClasses/{custom_class}
  • validate_only (::Boolean) — If set, validate the request and preview the deleted CustomClass, but do not actually delete it.
  • allow_missing (::Boolean) — If set to true, and the CustomClass is not found, the request will succeed and be a no-op (no Operation is recorded in this case).
  • etag (::String) — This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.
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.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::DeleteCustomClassRequest.new

# Call the delete_custom_class method.
result = client.delete_custom_class request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#delete_phrase_set

def delete_phrase_set(request, options = nil) -> ::Gapic::Operation
def delete_phrase_set(name: nil, validate_only: nil, allow_missing: nil, etag: nil) -> ::Gapic::Operation

Deletes the PhraseSet.

Overloads
def delete_phrase_set(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_phrase_set via a request object, either of type DeletePhraseSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::DeletePhraseSetRequest, ::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 delete_phrase_set(name: nil, validate_only: nil, allow_missing: nil, etag: nil) -> ::Gapic::Operation
Pass arguments to delete_phrase_set 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
  • name (::String) — Required. The name of the PhraseSet to delete. Format: projects/{project}/locations/{location}/phraseSets/{phrase_set}
  • validate_only (::Boolean) — If set, validate the request and preview the deleted PhraseSet, but do not actually delete it.
  • allow_missing (::Boolean) — If set to true, and the PhraseSet is not found, the request will succeed and be a no-op (no Operation is recorded in this case).
  • etag (::String) — This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.
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.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::DeletePhraseSetRequest.new

# Call the delete_phrase_set method.
result = client.delete_phrase_set request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#delete_recognizer

def delete_recognizer(request, options = nil) -> ::Gapic::Operation
def delete_recognizer(name: nil, validate_only: nil, allow_missing: nil, etag: nil) -> ::Gapic::Operation

Deletes the Recognizer.

Overloads
def delete_recognizer(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_recognizer via a request object, either of type DeleteRecognizerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::DeleteRecognizerRequest, ::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 delete_recognizer(name: nil, validate_only: nil, allow_missing: nil, etag: nil) -> ::Gapic::Operation
Pass arguments to delete_recognizer 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
  • name (::String) — Required. The name of the Recognizer to delete. Format: projects/{project}/locations/{location}/recognizers/{recognizer}
  • validate_only (::Boolean) — If set, validate the request and preview the deleted Recognizer, but do not actually delete it.
  • allow_missing (::Boolean) — If set to true, and the Recognizer is not found, the request will succeed and be a no-op (no Operation is recorded in this case).
  • etag (::String) — This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.
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.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::DeleteRecognizerRequest.new

# Call the delete_recognizer method.
result = client.delete_recognizer request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#get_config

def get_config(request, options = nil) -> ::Google::Cloud::Speech::V2::Config
def get_config(name: nil) -> ::Google::Cloud::Speech::V2::Config

Returns the requested Config.

Overloads
def get_config(request, options = nil) -> ::Google::Cloud::Speech::V2::Config
Pass arguments to get_config via a request object, either of type GetConfigRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::GetConfigRequest, ::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 get_config(name: nil) -> ::Google::Cloud::Speech::V2::Config
Pass arguments to get_config 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).
Parameter
  • name (::String) — Required. The name of the config to retrieve. There is exactly one config resource per project per location. The expected format is projects/{project}/locations/{location}/config.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::GetConfigRequest.new

# Call the get_config method.
result = client.get_config request

# The returned object is of type Google::Cloud::Speech::V2::Config.
p result

#get_custom_class

def get_custom_class(request, options = nil) -> ::Google::Cloud::Speech::V2::CustomClass
def get_custom_class(name: nil) -> ::Google::Cloud::Speech::V2::CustomClass

Returns the requested CustomClass.

Overloads
def get_custom_class(request, options = nil) -> ::Google::Cloud::Speech::V2::CustomClass
Pass arguments to get_custom_class via a request object, either of type GetCustomClassRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::GetCustomClassRequest, ::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 get_custom_class(name: nil) -> ::Google::Cloud::Speech::V2::CustomClass
Pass arguments to get_custom_class 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).
Parameter
  • name (::String) — Required. The name of the CustomClass to retrieve. The expected format is projects/{project}/locations/{location}/customClasses/{custom_class}.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::GetCustomClassRequest.new

# Call the get_custom_class method.
result = client.get_custom_class request

# The returned object is of type Google::Cloud::Speech::V2::CustomClass.
p result

#get_phrase_set

def get_phrase_set(request, options = nil) -> ::Google::Cloud::Speech::V2::PhraseSet
def get_phrase_set(name: nil) -> ::Google::Cloud::Speech::V2::PhraseSet

Returns the requested PhraseSet.

Overloads
def get_phrase_set(request, options = nil) -> ::Google::Cloud::Speech::V2::PhraseSet
Pass arguments to get_phrase_set via a request object, either of type GetPhraseSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::GetPhraseSetRequest, ::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 get_phrase_set(name: nil) -> ::Google::Cloud::Speech::V2::PhraseSet
Pass arguments to get_phrase_set 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).
Parameter
  • name (::String) — Required. The name of the PhraseSet to retrieve. The expected format is projects/{project}/locations/{location}/phraseSets/{phrase_set}.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::GetPhraseSetRequest.new

# Call the get_phrase_set method.
result = client.get_phrase_set request

# The returned object is of type Google::Cloud::Speech::V2::PhraseSet.
p result

#get_recognizer

def get_recognizer(request, options = nil) -> ::Google::Cloud::Speech::V2::Recognizer
def get_recognizer(name: nil) -> ::Google::Cloud::Speech::V2::Recognizer

Returns the requested Recognizer. Fails with [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested Recognizer doesn't exist.

Overloads
def get_recognizer(request, options = nil) -> ::Google::Cloud::Speech::V2::Recognizer
Pass arguments to get_recognizer via a request object, either of type GetRecognizerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::GetRecognizerRequest, ::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 get_recognizer(name: nil) -> ::Google::Cloud::Speech::V2::Recognizer
Pass arguments to get_recognizer 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).
Parameter
  • name (::String) — Required. The name of the Recognizer to retrieve. The expected format is projects/{project}/locations/{location}/recognizers/{recognizer}.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::GetRecognizerRequest.new

# Call the get_recognizer method.
result = client.get_recognizer request

# The returned object is of type Google::Cloud::Speech::V2::Recognizer.
p result

#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::V2::Speech::Rest::Client.new

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

#list_custom_classes

def list_custom_classes(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::CustomClass>
def list_custom_classes(parent: nil, page_size: nil, page_token: nil, show_deleted: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::CustomClass>

Lists CustomClasses.

Overloads
def list_custom_classes(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::CustomClass>
Pass arguments to list_custom_classes via a request object, either of type ListCustomClassesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::ListCustomClassesRequest, ::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 list_custom_classes(parent: nil, page_size: nil, page_token: nil, show_deleted: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::CustomClass>
Pass arguments to list_custom_classes 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
  • parent (::String) — Required. The project and location of CustomClass resources to list. The expected format is projects/{project}/locations/{location}.
  • page_size (::Integer) — Number of results per requests. A valid page_size ranges from 0 to 100 inclusive. If the page_size is zero or unspecified, a page size of 5 will be chosen. If the page size exceeds 100, it will be coerced down to 100. Note that a call might return fewer results than the requested page size.
  • page_token (::String) — A page token, received from a previous ListCustomClasses call. Provide this to retrieve the subsequent page.

    When paginating, all other parameters provided to ListCustomClasses must match the call that provided the page token.

  • show_deleted (::Boolean) — Whether, or not, to show resources that have been deleted.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::ListCustomClassesRequest.new

# Call the list_custom_classes method.
result = client.list_custom_classes request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Speech::V2::CustomClass.
  p item
end

#list_phrase_sets

def list_phrase_sets(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::PhraseSet>
def list_phrase_sets(parent: nil, page_size: nil, page_token: nil, show_deleted: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::PhraseSet>

Lists PhraseSets.

Overloads
def list_phrase_sets(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::PhraseSet>
Pass arguments to list_phrase_sets via a request object, either of type ListPhraseSetsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::ListPhraseSetsRequest, ::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 list_phrase_sets(parent: nil, page_size: nil, page_token: nil, show_deleted: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::PhraseSet>
Pass arguments to list_phrase_sets 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
  • parent (::String) — Required. The project and location of PhraseSet resources to list. The expected format is projects/{project}/locations/{location}.
  • page_size (::Integer) — The maximum number of PhraseSets to return. The service may return fewer than this value. If unspecified, at most 5 PhraseSets will be returned. The maximum value is 100; values above 100 will be coerced to 100.
  • page_token (::String) — A page token, received from a previous ListPhraseSets call. Provide this to retrieve the subsequent page.

    When paginating, all other parameters provided to ListPhraseSets must match the call that provided the page token.

  • show_deleted (::Boolean) — Whether, or not, to show resources that have been deleted.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::ListPhraseSetsRequest.new

# Call the list_phrase_sets method.
result = client.list_phrase_sets request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Speech::V2::PhraseSet.
  p item
end

#list_recognizers

def list_recognizers(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::Recognizer>
def list_recognizers(parent: nil, page_size: nil, page_token: nil, show_deleted: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::Recognizer>

Lists Recognizers.

Overloads
def list_recognizers(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::Recognizer>
Pass arguments to list_recognizers via a request object, either of type ListRecognizersRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::ListRecognizersRequest, ::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 list_recognizers(parent: nil, page_size: nil, page_token: nil, show_deleted: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::Recognizer>
Pass arguments to list_recognizers 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
  • parent (::String) — Required. The project and location of Recognizers to list. The expected format is projects/{project}/locations/{location}.
  • page_size (::Integer) — The maximum number of Recognizers to return. The service may return fewer than this value. If unspecified, at most 5 Recognizers will be returned. The maximum value is 100; values above 100 will be coerced to 100.
  • page_token (::String) — A page token, received from a previous ListRecognizers call. Provide this to retrieve the subsequent page.

    When paginating, all other parameters provided to ListRecognizers must match the call that provided the page token.

  • show_deleted (::Boolean) — Whether, or not, to show resources that have been deleted.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::ListRecognizersRequest.new

# Call the list_recognizers method.
result = client.list_recognizers request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Speech::V2::Recognizer.
  p item
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Rest::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Rest::Client)

#operations_client

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

Get the associated client for long-running operations.

#recognize

def recognize(request, options = nil) -> ::Google::Cloud::Speech::V2::RecognizeResponse
def recognize(recognizer: nil, config: nil, config_mask: nil, content: nil, uri: nil) -> ::Google::Cloud::Speech::V2::RecognizeResponse

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

Overloads
def recognize(request, options = nil) -> ::Google::Cloud::Speech::V2::RecognizeResponse
Pass arguments to recognize via a request object, either of type RecognizeRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::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(recognizer: nil, config: nil, config_mask: nil, content: nil, uri: nil) -> ::Google::Cloud::Speech::V2::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
  • recognizer (::String) — Required. The name of the Recognizer to use during recognition. The expected format is projects/{project}/locations/{location}/recognizers/{recognizer}. The {recognizer} segment may be set to _ to use an empty implicit Recognizer.
  • config (::Google::Cloud::Speech::V2::RecognitionConfig, ::Hash) — Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the config_mask field can be used to override parts of the default_recognition_config of the Recognizer resource.
  • config_mask (::Google::Protobuf::FieldMask, ::Hash) — The list of fields in config that override the values in the default_recognition_config of the recognizer during this recognition request. If no mask is provided, all non-default valued fields in config override the values in the recognizer for this recognition request. If a mask is provided, only the fields listed in the mask override the config in the recognizer for this recognition request. If a wildcard (*) is provided, config completely overrides and replaces the config in the recognizer for this recognition request.
  • content (::String) — The audio data bytes encoded as specified in RecognitionConfig. As with all bytes fields, proto buffers use a pure binary representation, whereas JSON representations use base64.
  • uri (::String) — URI that points to a file that contains audio data bytes as specified in RecognitionConfig. The file must not be compressed (for example, gzip). Currently, only Google Cloud Storage URIs are supported, which must be specified in the following format: gs://bucket_name/object_name (other URI formats return [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see Request URIs.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::RecognizeRequest.new

# Call the recognize method.
result = client.recognize request

# The returned object is of type Google::Cloud::Speech::V2::RecognizeResponse.
p result

#undelete_custom_class

def undelete_custom_class(request, options = nil) -> ::Gapic::Operation
def undelete_custom_class(name: nil, validate_only: nil, etag: nil) -> ::Gapic::Operation

Undeletes the CustomClass.

Overloads
def undelete_custom_class(request, options = nil) -> ::Gapic::Operation
Pass arguments to undelete_custom_class via a request object, either of type UndeleteCustomClassRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::UndeleteCustomClassRequest, ::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 undelete_custom_class(name: nil, validate_only: nil, etag: nil) -> ::Gapic::Operation
Pass arguments to undelete_custom_class 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
  • name (::String) — Required. The name of the CustomClass to undelete. Format: projects/{project}/locations/{location}/customClasses/{custom_class}
  • validate_only (::Boolean) — If set, validate the request and preview the undeleted CustomClass, but do not actually undelete it.
  • etag (::String) — This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.
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.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::UndeleteCustomClassRequest.new

# Call the undelete_custom_class method.
result = client.undelete_custom_class request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#undelete_phrase_set

def undelete_phrase_set(request, options = nil) -> ::Gapic::Operation
def undelete_phrase_set(name: nil, validate_only: nil, etag: nil) -> ::Gapic::Operation

Undeletes the PhraseSet.

Overloads
def undelete_phrase_set(request, options = nil) -> ::Gapic::Operation
Pass arguments to undelete_phrase_set via a request object, either of type UndeletePhraseSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::UndeletePhraseSetRequest, ::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 undelete_phrase_set(name: nil, validate_only: nil, etag: nil) -> ::Gapic::Operation
Pass arguments to undelete_phrase_set 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
  • name (::String) — Required. The name of the PhraseSet to undelete. Format: projects/{project}/locations/{location}/phraseSets/{phrase_set}
  • validate_only (::Boolean) — If set, validate the request and preview the undeleted PhraseSet, but do not actually undelete it.
  • etag (::String) — This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.
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.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::UndeletePhraseSetRequest.new

# Call the undelete_phrase_set method.
result = client.undelete_phrase_set request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#undelete_recognizer

def undelete_recognizer(request, options = nil) -> ::Gapic::Operation
def undelete_recognizer(name: nil, validate_only: nil, etag: nil) -> ::Gapic::Operation

Undeletes the Recognizer.

Overloads
def undelete_recognizer(request, options = nil) -> ::Gapic::Operation
Pass arguments to undelete_recognizer via a request object, either of type UndeleteRecognizerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::UndeleteRecognizerRequest, ::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 undelete_recognizer(name: nil, validate_only: nil, etag: nil) -> ::Gapic::Operation
Pass arguments to undelete_recognizer 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
  • name (::String) — Required. The name of the Recognizer to undelete. Format: projects/{project}/locations/{location}/recognizers/{recognizer}
  • validate_only (::Boolean) — If set, validate the request and preview the undeleted Recognizer, but do not actually undelete it.
  • etag (::String) — This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.
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.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::UndeleteRecognizerRequest.new

# Call the undelete_recognizer method.
result = client.undelete_recognizer request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#update_config

def update_config(request, options = nil) -> ::Google::Cloud::Speech::V2::Config
def update_config(config: nil, update_mask: nil) -> ::Google::Cloud::Speech::V2::Config

Updates the Config.

Overloads
def update_config(request, options = nil) -> ::Google::Cloud::Speech::V2::Config
Pass arguments to update_config via a request object, either of type UpdateConfigRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::UpdateConfigRequest, ::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 update_config(config: nil, update_mask: nil) -> ::Google::Cloud::Speech::V2::Config
Pass arguments to update_config 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
  • config (::Google::Cloud::Speech::V2::Config, ::Hash) — Required. The config to update.

    The config's name field is used to identify the config to be updated. The expected format is projects/{project}/locations/{location}/config.

  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — The list of fields to be updated.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::UpdateConfigRequest.new

# Call the update_config method.
result = client.update_config request

# The returned object is of type Google::Cloud::Speech::V2::Config.
p result

#update_custom_class

def update_custom_class(request, options = nil) -> ::Gapic::Operation
def update_custom_class(custom_class: nil, update_mask: nil, validate_only: nil) -> ::Gapic::Operation

Updates the CustomClass.

Overloads
def update_custom_class(request, options = nil) -> ::Gapic::Operation
Pass arguments to update_custom_class via a request object, either of type UpdateCustomClassRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::UpdateCustomClassRequest, ::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 update_custom_class(custom_class: nil, update_mask: nil, validate_only: nil) -> ::Gapic::Operation
Pass arguments to update_custom_class 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
  • custom_class (::Google::Cloud::Speech::V2::CustomClass, ::Hash) — Required. The CustomClass to update.

    The CustomClass's name field is used to identify the CustomClass to update. Format: projects/{project}/locations/{location}/customClasses/{custom_class}.

  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — The list of fields to be updated. If empty, all fields are considered for update.
  • validate_only (::Boolean) — If set, validate the request and preview the updated CustomClass, but do not actually update it.
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.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::UpdateCustomClassRequest.new

# Call the update_custom_class method.
result = client.update_custom_class request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#update_phrase_set

def update_phrase_set(request, options = nil) -> ::Gapic::Operation
def update_phrase_set(phrase_set: nil, update_mask: nil, validate_only: nil) -> ::Gapic::Operation

Updates the PhraseSet.

Overloads
def update_phrase_set(request, options = nil) -> ::Gapic::Operation
Pass arguments to update_phrase_set via a request object, either of type UpdatePhraseSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::UpdatePhraseSetRequest, ::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 update_phrase_set(phrase_set: nil, update_mask: nil, validate_only: nil) -> ::Gapic::Operation
Pass arguments to update_phrase_set 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
  • phrase_set (::Google::Cloud::Speech::V2::PhraseSet, ::Hash) — Required. The PhraseSet to update.

    The PhraseSet's name field is used to identify the PhraseSet to update. Format: projects/{project}/locations/{location}/phraseSets/{phrase_set}.

  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — The list of fields to update. If empty, all non-default valued fields are considered for update. Use * to update the entire PhraseSet resource.
  • validate_only (::Boolean) — If set, validate the request and preview the updated PhraseSet, but do not actually update it.
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.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::UpdatePhraseSetRequest.new

# Call the update_phrase_set method.
result = client.update_phrase_set request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#update_recognizer

def update_recognizer(request, options = nil) -> ::Gapic::Operation
def update_recognizer(recognizer: nil, update_mask: nil, validate_only: nil) -> ::Gapic::Operation

Updates the Recognizer.

Overloads
def update_recognizer(request, options = nil) -> ::Gapic::Operation
Pass arguments to update_recognizer via a request object, either of type UpdateRecognizerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::UpdateRecognizerRequest, ::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 update_recognizer(recognizer: nil, update_mask: nil, validate_only: nil) -> ::Gapic::Operation
Pass arguments to update_recognizer 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
  • recognizer (::Google::Cloud::Speech::V2::Recognizer, ::Hash) — Required. The Recognizer to update.

    The Recognizer's name field is used to identify the Recognizer to update. Format: projects/{project}/locations/{location}/recognizers/{recognizer}.

  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — The list of fields to update. If empty, all non-default valued fields are considered for update. Use * to update the entire Recognizer resource.
  • validate_only (::Boolean) — If set, validate the request and preview the updated Recognizer, but do not actually update it.
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.
Example

Basic example

require "google/cloud/speech/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V2::Speech::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V2::UpdateRecognizerRequest.new

# Call the update_recognizer method.
result = client.update_recognizer request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end