google-cloud-speech-v1p1beta1 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +6 -6
- data/README.md +1 -1
- data/lib/google/cloud/speech/v1p1beta1/speech/client.rb +88 -88
- data/lib/google/cloud/speech/v1p1beta1/speech/credentials.rb +1 -1
- data/lib/google/cloud/speech/v1p1beta1/speech/operations.rb +100 -100
- data/lib/google/cloud/speech/v1p1beta1/speech/paths.rb +6 -6
- data/lib/google/cloud/speech/v1p1beta1/speech.rb +1 -1
- data/lib/google/cloud/speech/v1p1beta1/version.rb +1 -1
- data/lib/google/cloud/speech/v1p1beta1.rb +1 -1
- data/proto_docs/google/api/resource.rb +12 -12
- data/proto_docs/google/cloud/speech/v1p1beta1/cloud_speech.rb +109 -109
- data/proto_docs/google/cloud/speech/v1p1beta1/resource.rb +21 -21
- data/proto_docs/google/longrunning/operations.rb +30 -30
- data/proto_docs/google/protobuf/any.rb +4 -4
- data/proto_docs/google/protobuf/duration.rb +4 -4
- data/proto_docs/google/protobuf/empty.rb +2 -2
- data/proto_docs/google/protobuf/timestamp.rb +4 -4
- data/proto_docs/google/rpc/status.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4adf8d1e4eeaa7f2155224cecb3e8c0e92c2a5ccafac16e989a532f58cc34c61
|
|
4
|
+
data.tar.gz: 1d0cbe2deab182a6216f549a2067deab137103c2440e4c1c19156ae2365f7edc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ef921b6faf8847146e3bf9bd1a6b8ec036818c1871fed7681768e5352e2dce8cdea2b77181665ba5d6f292971c261e65517ab1bcd1b8a1ae0a0fb1c8e4354cf
|
|
7
|
+
data.tar.gz: 6f661908a45d4c6dadb9e5a14ece5d78ff25f1786aa110bb867b4aba0827cd4011d0588782579640d4897fe861c69b5a64b411c3ba50957152cf85c9bca114ca
|
data/AUTHENTICATION.md
CHANGED
|
@@ -27,7 +27,7 @@ export SPEECH_CREDENTIALS=path/to/keyfile.json
|
|
|
27
27
|
```ruby
|
|
28
28
|
require "google/cloud/speech/v1p1beta1"
|
|
29
29
|
|
|
30
|
-
client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
|
30
|
+
client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
## Credential Lookup
|
|
@@ -64,7 +64,7 @@ containers where writing files is difficult or not encouraged.
|
|
|
64
64
|
|
|
65
65
|
The environment variables that google-cloud-speech-v1p1beta1
|
|
66
66
|
checks for credentials are configured on the service Credentials class (such as
|
|
67
|
-
{Google::Cloud::Speech::V1p1beta1::Speech::Credentials}):
|
|
67
|
+
{::Google::Cloud::Speech::V1p1beta1::Speech::Credentials}):
|
|
68
68
|
|
|
69
69
|
1. `SPEECH_CREDENTIALS` - Path to JSON file, or JSON contents
|
|
70
70
|
2. `SPEECH_KEYFILE` - Path to JSON file, or JSON contents
|
|
@@ -77,7 +77,7 @@ require "google/cloud/speech/v1p1beta1"
|
|
|
77
77
|
|
|
78
78
|
ENV["SPEECH_CREDENTIALS"] = "path/to/keyfile.json"
|
|
79
79
|
|
|
80
|
-
client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
|
80
|
+
client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
### Configuration
|
|
@@ -88,7 +88,7 @@ environment variables. Either on an individual client initialization:
|
|
|
88
88
|
```ruby
|
|
89
89
|
require "google/cloud/speech/v1p1beta1"
|
|
90
90
|
|
|
91
|
-
client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
|
|
91
|
+
client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
|
|
92
92
|
config.credentials = "path/to/keyfile.json"
|
|
93
93
|
end
|
|
94
94
|
```
|
|
@@ -98,11 +98,11 @@ Or configured globally for all clients:
|
|
|
98
98
|
```ruby
|
|
99
99
|
require "google/cloud/speech/v1p1beta1"
|
|
100
100
|
|
|
101
|
-
Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
|
|
101
|
+
::Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
|
|
102
102
|
config.credentials = "path/to/keyfile.json"
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
-
client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
|
105
|
+
client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
### Cloud SDK
|
data/README.md
CHANGED
|
@@ -25,7 +25,7 @@ In order to use this library, you first need to go through the following steps:
|
|
|
25
25
|
```ruby
|
|
26
26
|
require "google/cloud/speech/v1p1beta1"
|
|
27
27
|
|
|
28
|
-
client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
|
28
|
+
client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
|
29
29
|
request = my_create_request
|
|
30
30
|
response = client.recognize request
|
|
31
31
|
```
|
|
@@ -38,15 +38,15 @@ module Google
|
|
|
38
38
|
##
|
|
39
39
|
# Configure the Speech Client class.
|
|
40
40
|
#
|
|
41
|
-
# See {Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration}
|
|
41
|
+
# See {::Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration}
|
|
42
42
|
# for a description of the configuration fields.
|
|
43
43
|
#
|
|
44
44
|
# ## Example
|
|
45
45
|
#
|
|
46
46
|
# To modify the configuration for all Speech clients:
|
|
47
47
|
#
|
|
48
|
-
# Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
|
|
49
|
-
# config.timeout =
|
|
48
|
+
# ::Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
|
|
49
|
+
# config.timeout = 10.0
|
|
50
50
|
# end
|
|
51
51
|
#
|
|
52
52
|
# @yield [config] Configure the Client client.
|
|
@@ -96,7 +96,7 @@ module Google
|
|
|
96
96
|
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
97
97
|
# should be made on {Client.configure}.
|
|
98
98
|
#
|
|
99
|
-
# See {Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration}
|
|
99
|
+
# See {::Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration}
|
|
100
100
|
# for a description of the configuration fields.
|
|
101
101
|
#
|
|
102
102
|
# @yield [config] Configure the Client client.
|
|
@@ -117,13 +117,13 @@ module Google
|
|
|
117
117
|
# To create a new Speech client with the default
|
|
118
118
|
# configuration:
|
|
119
119
|
#
|
|
120
|
-
# client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
|
120
|
+
# client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
|
121
121
|
#
|
|
122
122
|
# To create a new Speech client with a custom
|
|
123
123
|
# configuration:
|
|
124
124
|
#
|
|
125
|
-
# client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
|
|
126
|
-
# config.timeout =
|
|
125
|
+
# client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
|
|
126
|
+
# config.timeout = 10.0
|
|
127
127
|
# end
|
|
128
128
|
#
|
|
129
129
|
# @yield [config] Configure the Speech client.
|
|
@@ -155,8 +155,8 @@ module Google
|
|
|
155
155
|
config.endpoint = @config.endpoint
|
|
156
156
|
end
|
|
157
157
|
|
|
158
|
-
@speech_stub = Gapic::ServiceStub.new(
|
|
159
|
-
Google::Cloud::Speech::V1p1beta1::Speech::Stub,
|
|
158
|
+
@speech_stub = ::Gapic::ServiceStub.new(
|
|
159
|
+
::Google::Cloud::Speech::V1p1beta1::Speech::Stub,
|
|
160
160
|
credentials: credentials,
|
|
161
161
|
endpoint: @config.endpoint,
|
|
162
162
|
channel_args: @config.channel_args,
|
|
@@ -167,7 +167,7 @@ module Google
|
|
|
167
167
|
##
|
|
168
168
|
# Get the associated client for long-running operations.
|
|
169
169
|
#
|
|
170
|
-
# @return [Google::Cloud::Speech::V1p1beta1::Speech::Operations]
|
|
170
|
+
# @return [::Google::Cloud::Speech::V1p1beta1::Speech::Operations]
|
|
171
171
|
#
|
|
172
172
|
attr_reader :operations_client
|
|
173
173
|
|
|
@@ -179,12 +179,12 @@ module Google
|
|
|
179
179
|
#
|
|
180
180
|
# @overload recognize(request, options = nil)
|
|
181
181
|
# Pass arguments to `recognize` via a request object, either of type
|
|
182
|
-
# {Google::Cloud::Speech::V1p1beta1::RecognizeRequest} or an equivalent Hash.
|
|
182
|
+
# {::Google::Cloud::Speech::V1p1beta1::RecognizeRequest} or an equivalent Hash.
|
|
183
183
|
#
|
|
184
|
-
# @param request [Google::Cloud::Speech::V1p1beta1::RecognizeRequest, Hash]
|
|
184
|
+
# @param request [::Google::Cloud::Speech::V1p1beta1::RecognizeRequest, ::Hash]
|
|
185
185
|
# A request object representing the call parameters. Required. To specify no
|
|
186
186
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
187
|
-
# @param options [Gapic::CallOptions, Hash]
|
|
187
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
188
188
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
189
189
|
#
|
|
190
190
|
# @overload recognize(config: nil, audio: nil)
|
|
@@ -192,33 +192,33 @@ module Google
|
|
|
192
192
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
193
193
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
194
194
|
#
|
|
195
|
-
# @param config [Google::Cloud::Speech::V1p1beta1::RecognitionConfig, Hash]
|
|
195
|
+
# @param config [::Google::Cloud::Speech::V1p1beta1::RecognitionConfig, ::Hash]
|
|
196
196
|
# Required. Provides information to the recognizer that specifies how to
|
|
197
197
|
# process the request.
|
|
198
|
-
# @param audio [Google::Cloud::Speech::V1p1beta1::RecognitionAudio, Hash]
|
|
198
|
+
# @param audio [::Google::Cloud::Speech::V1p1beta1::RecognitionAudio, ::Hash]
|
|
199
199
|
# Required. The audio data to be recognized.
|
|
200
200
|
#
|
|
201
201
|
# @yield [response, operation] Access the result along with the RPC operation
|
|
202
|
-
# @yieldparam response [Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
|
|
203
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
|
202
|
+
# @yieldparam response [::Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
|
|
203
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
204
204
|
#
|
|
205
|
-
# @return [Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
|
|
205
|
+
# @return [::Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
|
|
206
206
|
#
|
|
207
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
|
207
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
208
208
|
#
|
|
209
209
|
def recognize request, options = nil
|
|
210
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
|
210
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
211
211
|
|
|
212
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Speech::V1p1beta1::RecognizeRequest
|
|
212
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1p1beta1::RecognizeRequest
|
|
213
213
|
|
|
214
214
|
# Converts hash and nil to an options object
|
|
215
|
-
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
215
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
216
216
|
|
|
217
217
|
# Customize the options with defaults
|
|
218
218
|
metadata = @config.rpcs.recognize.metadata.to_h
|
|
219
219
|
|
|
220
220
|
# Set x-goog-api-client and x-goog-user-project headers
|
|
221
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
|
221
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
222
222
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
223
223
|
gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
|
|
224
224
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
@@ -233,8 +233,8 @@ module Google
|
|
|
233
233
|
yield response, operation if block_given?
|
|
234
234
|
return response
|
|
235
235
|
end
|
|
236
|
-
rescue GRPC::BadStatus => e
|
|
237
|
-
raise Google::Cloud::Error.from_error(e)
|
|
236
|
+
rescue ::GRPC::BadStatus => e
|
|
237
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
238
238
|
end
|
|
239
239
|
|
|
240
240
|
##
|
|
@@ -247,12 +247,12 @@ module Google
|
|
|
247
247
|
#
|
|
248
248
|
# @overload long_running_recognize(request, options = nil)
|
|
249
249
|
# Pass arguments to `long_running_recognize` via a request object, either of type
|
|
250
|
-
# {Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest} or an equivalent Hash.
|
|
250
|
+
# {::Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest} or an equivalent Hash.
|
|
251
251
|
#
|
|
252
|
-
# @param request [Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest, Hash]
|
|
252
|
+
# @param request [::Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest, ::Hash]
|
|
253
253
|
# A request object representing the call parameters. Required. To specify no
|
|
254
254
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
255
|
-
# @param options [Gapic::CallOptions, Hash]
|
|
255
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
256
256
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
257
257
|
#
|
|
258
258
|
# @overload long_running_recognize(config: nil, audio: nil)
|
|
@@ -260,33 +260,33 @@ module Google
|
|
|
260
260
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
261
261
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
262
262
|
#
|
|
263
|
-
# @param config [Google::Cloud::Speech::V1p1beta1::RecognitionConfig, Hash]
|
|
263
|
+
# @param config [::Google::Cloud::Speech::V1p1beta1::RecognitionConfig, ::Hash]
|
|
264
264
|
# Required. Provides information to the recognizer that specifies how to
|
|
265
265
|
# process the request.
|
|
266
|
-
# @param audio [Google::Cloud::Speech::V1p1beta1::RecognitionAudio, Hash]
|
|
266
|
+
# @param audio [::Google::Cloud::Speech::V1p1beta1::RecognitionAudio, ::Hash]
|
|
267
267
|
# Required. The audio data to be recognized.
|
|
268
268
|
#
|
|
269
269
|
# @yield [response, operation] Access the result along with the RPC operation
|
|
270
|
-
# @yieldparam response [Gapic::Operation]
|
|
271
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
|
270
|
+
# @yieldparam response [::Gapic::Operation]
|
|
271
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
272
272
|
#
|
|
273
|
-
# @return [Gapic::Operation]
|
|
273
|
+
# @return [::Gapic::Operation]
|
|
274
274
|
#
|
|
275
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
|
275
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
276
276
|
#
|
|
277
277
|
def long_running_recognize request, options = nil
|
|
278
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
|
278
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
279
279
|
|
|
280
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest
|
|
280
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest
|
|
281
281
|
|
|
282
282
|
# Converts hash and nil to an options object
|
|
283
|
-
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
283
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
284
284
|
|
|
285
285
|
# Customize the options with defaults
|
|
286
286
|
metadata = @config.rpcs.long_running_recognize.metadata.to_h
|
|
287
287
|
|
|
288
288
|
# Set x-goog-api-client and x-goog-user-project headers
|
|
289
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
|
289
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
290
290
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
291
291
|
gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
|
|
292
292
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
@@ -298,49 +298,49 @@ module Google
|
|
|
298
298
|
retry_policy: @config.retry_policy
|
|
299
299
|
|
|
300
300
|
@speech_stub.call_rpc :long_running_recognize, request, options: options do |response, operation|
|
|
301
|
-
response = Gapic::Operation.new response, @operations_client, options: options
|
|
301
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
|
302
302
|
yield response, operation if block_given?
|
|
303
303
|
return response
|
|
304
304
|
end
|
|
305
|
-
rescue GRPC::BadStatus => e
|
|
306
|
-
raise Google::Cloud::Error.from_error(e)
|
|
305
|
+
rescue ::GRPC::BadStatus => e
|
|
306
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
307
307
|
end
|
|
308
308
|
|
|
309
309
|
##
|
|
310
310
|
# Performs bidirectional streaming speech recognition: receive results while
|
|
311
311
|
# sending audio. This method is only available via the gRPC API (not REST).
|
|
312
312
|
#
|
|
313
|
-
# @param request [Gapic::StreamInput, Enumerable
|
|
314
|
-
# An enumerable of {Google::Cloud::Speech::V1p1beta1::StreamingRecognizeRequest} instances.
|
|
315
|
-
# @param options [Gapic::CallOptions, Hash]
|
|
313
|
+
# @param request [::Gapic::StreamInput, ::Enumerable<::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeRequest, ::Hash>]
|
|
314
|
+
# An enumerable of {::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeRequest} instances.
|
|
315
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
316
316
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
317
317
|
#
|
|
318
318
|
# @yield [response, operation] Access the result along with the RPC operation
|
|
319
|
-
# @yieldparam response [Enumerable
|
|
320
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
|
319
|
+
# @yieldparam response [::Enumerable<::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeResponse>]
|
|
320
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
321
321
|
#
|
|
322
|
-
# @return [Enumerable
|
|
322
|
+
# @return [::Enumerable<::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeResponse>]
|
|
323
323
|
#
|
|
324
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
|
324
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
325
325
|
#
|
|
326
326
|
def streaming_recognize request, options = nil
|
|
327
|
-
unless request.is_a? Enumerable
|
|
328
|
-
raise ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
|
|
327
|
+
unless request.is_a? ::Enumerable
|
|
328
|
+
raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
|
|
329
329
|
request = request.to_enum
|
|
330
330
|
end
|
|
331
331
|
|
|
332
332
|
request = request.lazy.map do |req|
|
|
333
|
-
Gapic::Protobuf.coerce req, to: Google::Cloud::Speech::V1p1beta1::StreamingRecognizeRequest
|
|
333
|
+
::Gapic::Protobuf.coerce req, to: ::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeRequest
|
|
334
334
|
end
|
|
335
335
|
|
|
336
336
|
# Converts hash and nil to an options object
|
|
337
|
-
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
337
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
338
338
|
|
|
339
339
|
# Customize the options with defaults
|
|
340
340
|
metadata = @config.rpcs.streaming_recognize.metadata.to_h
|
|
341
341
|
|
|
342
342
|
# Set x-goog-api-client and x-goog-user-project headers
|
|
343
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
|
343
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
344
344
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
345
345
|
gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
|
|
346
346
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
@@ -355,8 +355,8 @@ module Google
|
|
|
355
355
|
yield response, operation if block_given?
|
|
356
356
|
return response
|
|
357
357
|
end
|
|
358
|
-
rescue GRPC::BadStatus => e
|
|
359
|
-
raise Google::Cloud::Error.from_error(e)
|
|
358
|
+
rescue ::GRPC::BadStatus => e
|
|
359
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
360
360
|
end
|
|
361
361
|
|
|
362
362
|
##
|
|
@@ -366,7 +366,7 @@ module Google
|
|
|
366
366
|
# providing control over timeouts, retry behavior, logging, transport
|
|
367
367
|
# parameters, and other low-level controls. Certain parameters can also be
|
|
368
368
|
# applied individually to specific RPCs. See
|
|
369
|
-
# {Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration::Rpcs}
|
|
369
|
+
# {::Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration::Rpcs}
|
|
370
370
|
# for a list of RPCs that can be configured independently.
|
|
371
371
|
#
|
|
372
372
|
# Configuration can be applied globally to all clients, or to a single client
|
|
@@ -377,22 +377,22 @@ module Google
|
|
|
377
377
|
# To modify the global config, setting the timeout for recognize
|
|
378
378
|
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
|
379
379
|
#
|
|
380
|
-
# Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
|
|
381
|
-
# config.timeout =
|
|
382
|
-
# config.rpcs.recognize.timeout =
|
|
380
|
+
# ::Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
|
|
381
|
+
# config.timeout = 10.0
|
|
382
|
+
# config.rpcs.recognize.timeout = 20.0
|
|
383
383
|
# end
|
|
384
384
|
#
|
|
385
385
|
# To apply the above configuration only to a new client:
|
|
386
386
|
#
|
|
387
|
-
# client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
|
|
388
|
-
# config.timeout =
|
|
389
|
-
# config.rpcs.recognize.timeout =
|
|
387
|
+
# client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
|
|
388
|
+
# config.timeout = 10.0
|
|
389
|
+
# config.rpcs.recognize.timeout = 20.0
|
|
390
390
|
# end
|
|
391
391
|
#
|
|
392
392
|
# @!attribute [rw] endpoint
|
|
393
393
|
# The hostname or hostname:port of the service endpoint.
|
|
394
394
|
# Defaults to `"speech.googleapis.com"`.
|
|
395
|
-
# @return [String]
|
|
395
|
+
# @return [::String]
|
|
396
396
|
# @!attribute [rw] credentials
|
|
397
397
|
# Credentials to send with calls. You may provide any of the following types:
|
|
398
398
|
# * (`String`) The path to a service account key file in JSON format
|
|
@@ -404,29 +404,29 @@ module Google
|
|
|
404
404
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
|
405
405
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
|
406
406
|
# * (`nil`) indicating no credentials
|
|
407
|
-
# @return [Object]
|
|
407
|
+
# @return [::Object]
|
|
408
408
|
# @!attribute [rw] scope
|
|
409
409
|
# The OAuth scopes
|
|
410
|
-
# @return [Array
|
|
410
|
+
# @return [::Array<::String>]
|
|
411
411
|
# @!attribute [rw] lib_name
|
|
412
412
|
# The library name as recorded in instrumentation and logging
|
|
413
|
-
# @return [String]
|
|
413
|
+
# @return [::String]
|
|
414
414
|
# @!attribute [rw] lib_version
|
|
415
415
|
# The library version as recorded in instrumentation and logging
|
|
416
|
-
# @return [String]
|
|
416
|
+
# @return [::String]
|
|
417
417
|
# @!attribute [rw] channel_args
|
|
418
418
|
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
|
419
419
|
# `GRPC::Core::Channel` object is provided as the credential.
|
|
420
|
-
# @return [Hash]
|
|
420
|
+
# @return [::Hash]
|
|
421
421
|
# @!attribute [rw] interceptors
|
|
422
422
|
# An array of interceptors that are run before calls are executed.
|
|
423
|
-
# @return [Array
|
|
423
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
|
424
424
|
# @!attribute [rw] timeout
|
|
425
|
-
# The call timeout in
|
|
426
|
-
# @return [Numeric]
|
|
425
|
+
# The call timeout in seconds.
|
|
426
|
+
# @return [::Numeric]
|
|
427
427
|
# @!attribute [rw] metadata
|
|
428
428
|
# Additional gRPC headers to be sent with the call.
|
|
429
|
-
# @return [Hash{Symbol
|
|
429
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
430
430
|
# @!attribute [rw] retry_policy
|
|
431
431
|
# The retry policy. The value is a hash with the following keys:
|
|
432
432
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
@@ -434,10 +434,10 @@ module Google
|
|
|
434
434
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
435
435
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
436
436
|
# trigger a retry.
|
|
437
|
-
# @return [Hash]
|
|
437
|
+
# @return [::Hash]
|
|
438
438
|
#
|
|
439
439
|
class Configuration
|
|
440
|
-
extend Gapic::Config
|
|
440
|
+
extend ::Gapic::Config
|
|
441
441
|
|
|
442
442
|
config_attr :endpoint, "speech.googleapis.com", String
|
|
443
443
|
config_attr :credentials, nil do |value|
|
|
@@ -445,14 +445,14 @@ module Google
|
|
|
445
445
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
|
446
446
|
allowed.any? { |klass| klass === value }
|
|
447
447
|
end
|
|
448
|
-
config_attr :scope, nil, String, Array, nil
|
|
449
|
-
config_attr :lib_name, nil, String, nil
|
|
450
|
-
config_attr :lib_version, nil, String, nil
|
|
451
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
|
|
452
|
-
config_attr :interceptors, nil, Array, nil
|
|
453
|
-
config_attr :timeout, nil, Numeric, nil
|
|
454
|
-
config_attr :metadata, nil, Hash, nil
|
|
455
|
-
config_attr :retry_policy, nil, Hash, Proc, nil
|
|
448
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
449
|
+
config_attr :lib_name, nil, ::String, nil
|
|
450
|
+
config_attr :lib_version, nil, ::String, nil
|
|
451
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
|
452
|
+
config_attr :interceptors, nil, ::Array, nil
|
|
453
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
454
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
455
|
+
config_attr :retry_policy, nil, ::Hash, Proc, nil
|
|
456
456
|
|
|
457
457
|
# @private
|
|
458
458
|
def initialize parent_config = nil
|
|
@@ -493,28 +493,28 @@ module Google
|
|
|
493
493
|
class Rpcs
|
|
494
494
|
##
|
|
495
495
|
# RPC-specific configuration for `recognize`
|
|
496
|
-
# @return [Gapic::Config::Method]
|
|
496
|
+
# @return [::Gapic::Config::Method]
|
|
497
497
|
#
|
|
498
498
|
attr_reader :recognize
|
|
499
499
|
##
|
|
500
500
|
# RPC-specific configuration for `long_running_recognize`
|
|
501
|
-
# @return [Gapic::Config::Method]
|
|
501
|
+
# @return [::Gapic::Config::Method]
|
|
502
502
|
#
|
|
503
503
|
attr_reader :long_running_recognize
|
|
504
504
|
##
|
|
505
505
|
# RPC-specific configuration for `streaming_recognize`
|
|
506
|
-
# @return [Gapic::Config::Method]
|
|
506
|
+
# @return [::Gapic::Config::Method]
|
|
507
507
|
#
|
|
508
508
|
attr_reader :streaming_recognize
|
|
509
509
|
|
|
510
510
|
# @private
|
|
511
511
|
def initialize parent_rpcs = nil
|
|
512
512
|
recognize_config = parent_rpcs&.recognize if parent_rpcs&.respond_to? :recognize
|
|
513
|
-
@recognize = Gapic::Config::Method.new recognize_config
|
|
513
|
+
@recognize = ::Gapic::Config::Method.new recognize_config
|
|
514
514
|
long_running_recognize_config = parent_rpcs&.long_running_recognize if parent_rpcs&.respond_to? :long_running_recognize
|
|
515
|
-
@long_running_recognize = Gapic::Config::Method.new long_running_recognize_config
|
|
515
|
+
@long_running_recognize = ::Gapic::Config::Method.new long_running_recognize_config
|
|
516
516
|
streaming_recognize_config = parent_rpcs&.streaming_recognize if parent_rpcs&.respond_to? :streaming_recognize
|
|
517
|
-
@streaming_recognize = Gapic::Config::Method.new streaming_recognize_config
|
|
517
|
+
@streaming_recognize = ::Gapic::Config::Method.new streaming_recognize_config
|
|
518
518
|
|
|
519
519
|
yield self if block_given?
|
|
520
520
|
end
|