google-cloud-speech-v1 0.1.2 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +6 -6
- data/README.md +1 -1
- data/lib/google/cloud/speech/v1.rb +1 -1
- data/lib/google/cloud/speech/v1/speech.rb +1 -1
- data/lib/google/cloud/speech/v1/speech/client.rb +104 -91
- data/lib/google/cloud/speech/v1/speech/credentials.rb +1 -1
- data/lib/google/cloud/speech/v1/speech/operations.rb +109 -103
- data/lib/google/cloud/speech/v1/version.rb +1 -1
- data/proto_docs/google/api/resource.rb +12 -12
- data/proto_docs/google/cloud/speech/v1/cloud_speech.rb +99 -99
- 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 +33 -6
- data/lib/google/cloud/common_resources_pb.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a91dbd00e663385a4b27885d67fdb643f423cf8e67fee787eacefd322d436a73
|
4
|
+
data.tar.gz: f9b73c3c625f0bb6ae489d6e89ef947aa5d4377eddd542136460f14aadf7ed50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d250f303114b6e9831da889076f9e481dec4d0642fe123df844e454648add61656cf73148c740960022c0b84dda8d866aaecaf43e209f26670fc13ee374a043
|
7
|
+
data.tar.gz: 5f8e78b7207c3b767da40dd9544f9aa7b6d50bc54fa8b491c9914466df9c319f4288d702b96f21304c3023a2763b2d1911f8a24d8eb3c14666cff9aad3af5438
|
data/AUTHENTICATION.md
CHANGED
@@ -27,7 +27,7 @@ export SPEECH_CREDENTIALS=path/to/keyfile.json
|
|
27
27
|
```ruby
|
28
28
|
require "google/cloud/speech/v1"
|
29
29
|
|
30
|
-
client = Google::Cloud::Speech::V1::Speech::Client.new
|
30
|
+
client = ::Google::Cloud::Speech::V1::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-v1
|
66
66
|
checks for credentials are configured on the service Credentials class (such as
|
67
|
-
{Google::Cloud::Speech::V1::Speech::Credentials}):
|
67
|
+
{::Google::Cloud::Speech::V1::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/v1"
|
|
77
77
|
|
78
78
|
ENV["SPEECH_CREDENTIALS"] = "path/to/keyfile.json"
|
79
79
|
|
80
|
-
client = Google::Cloud::Speech::V1::Speech::Client.new
|
80
|
+
client = ::Google::Cloud::Speech::V1::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/v1"
|
90
90
|
|
91
|
-
client = Google::Cloud::Speech::V1::Speech::Client.new do |config|
|
91
|
+
client = ::Google::Cloud::Speech::V1::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/v1"
|
100
100
|
|
101
|
-
Google::Cloud::Speech::V1::Speech::Client.configure do |config|
|
101
|
+
::Google::Cloud::Speech::V1::Speech::Client.configure do |config|
|
102
102
|
config.credentials = "path/to/keyfile.json"
|
103
103
|
end
|
104
104
|
|
105
|
-
client = Google::Cloud::Speech::V1::Speech::Client.new
|
105
|
+
client = ::Google::Cloud::Speech::V1::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/v1"
|
27
27
|
|
28
|
-
client = Google::Cloud::Speech::V1::Speech::Client.new
|
28
|
+
client = ::Google::Cloud::Speech::V1::Speech::Client.new
|
29
29
|
request = my_create_request
|
30
30
|
response = client.recognize request
|
31
31
|
```
|
@@ -26,7 +26,7 @@ module Google
|
|
26
26
|
# To load this package, including all its services, and instantiate a client:
|
27
27
|
#
|
28
28
|
# require "google/cloud/speech/v1"
|
29
|
-
# client = Google::Cloud::Speech::V1::Speech::Client.new
|
29
|
+
# client = ::Google::Cloud::Speech::V1::Speech::Client.new
|
30
30
|
#
|
31
31
|
module V1
|
32
32
|
end
|
@@ -36,7 +36,7 @@ module Google
|
|
36
36
|
# To load this service and instantiate a client:
|
37
37
|
#
|
38
38
|
# require "google/cloud/speech/v1/speech"
|
39
|
-
# client = Google::Cloud::Speech::V1::Speech::Client.new
|
39
|
+
# client = ::Google::Cloud::Speech::V1::Speech::Client.new
|
40
40
|
#
|
41
41
|
module Speech
|
42
42
|
end
|
@@ -36,15 +36,15 @@ module Google
|
|
36
36
|
##
|
37
37
|
# Configure the Speech Client class.
|
38
38
|
#
|
39
|
-
# See {Google::Cloud::Speech::V1::Speech::Client::Configuration}
|
39
|
+
# See {::Google::Cloud::Speech::V1::Speech::Client::Configuration}
|
40
40
|
# for a description of the configuration fields.
|
41
41
|
#
|
42
42
|
# ## Example
|
43
43
|
#
|
44
44
|
# To modify the configuration for all Speech clients:
|
45
45
|
#
|
46
|
-
# Google::Cloud::Speech::V1::Speech::Client.configure do |config|
|
47
|
-
# config.timeout =
|
46
|
+
# ::Google::Cloud::Speech::V1::Speech::Client.configure do |config|
|
47
|
+
# config.timeout = 10.0
|
48
48
|
# end
|
49
49
|
#
|
50
50
|
# @yield [config] Configure the Client client.
|
@@ -94,7 +94,7 @@ module Google
|
|
94
94
|
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
95
95
|
# should be made on {Client.configure}.
|
96
96
|
#
|
97
|
-
# See {Google::Cloud::Speech::V1::Speech::Client::Configuration}
|
97
|
+
# See {::Google::Cloud::Speech::V1::Speech::Client::Configuration}
|
98
98
|
# for a description of the configuration fields.
|
99
99
|
#
|
100
100
|
# @yield [config] Configure the Client client.
|
@@ -115,13 +115,13 @@ module Google
|
|
115
115
|
# To create a new Speech client with the default
|
116
116
|
# configuration:
|
117
117
|
#
|
118
|
-
# client = Google::Cloud::Speech::V1::Speech::Client.new
|
118
|
+
# client = ::Google::Cloud::Speech::V1::Speech::Client.new
|
119
119
|
#
|
120
120
|
# To create a new Speech client with a custom
|
121
121
|
# configuration:
|
122
122
|
#
|
123
|
-
# client = Google::Cloud::Speech::V1::Speech::Client.new do |config|
|
124
|
-
# config.timeout =
|
123
|
+
# client = ::Google::Cloud::Speech::V1::Speech::Client.new do |config|
|
124
|
+
# config.timeout = 10.0
|
125
125
|
# end
|
126
126
|
#
|
127
127
|
# @yield [config] Configure the Speech client.
|
@@ -146,14 +146,16 @@ module Google
|
|
146
146
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
147
147
|
credentials = Credentials.new credentials, scope: @config.scope
|
148
148
|
end
|
149
|
-
@quota_project_id =
|
149
|
+
@quota_project_id = @config.quota_project
|
150
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
150
151
|
|
151
152
|
@operations_client = Operations.new do |config|
|
152
153
|
config.credentials = credentials
|
154
|
+
config.endpoint = @config.endpoint
|
153
155
|
end
|
154
156
|
|
155
|
-
@speech_stub = Gapic::ServiceStub.new(
|
156
|
-
Google::Cloud::Speech::V1::Speech::Stub,
|
157
|
+
@speech_stub = ::Gapic::ServiceStub.new(
|
158
|
+
::Google::Cloud::Speech::V1::Speech::Stub,
|
157
159
|
credentials: credentials,
|
158
160
|
endpoint: @config.endpoint,
|
159
161
|
channel_args: @config.channel_args,
|
@@ -161,6 +163,13 @@ module Google
|
|
161
163
|
)
|
162
164
|
end
|
163
165
|
|
166
|
+
##
|
167
|
+
# Get the associated client for long-running operations.
|
168
|
+
#
|
169
|
+
# @return [::Google::Cloud::Speech::V1::Speech::Operations]
|
170
|
+
#
|
171
|
+
attr_reader :operations_client
|
172
|
+
|
164
173
|
# Service calls
|
165
174
|
|
166
175
|
##
|
@@ -169,12 +178,12 @@ module Google
|
|
169
178
|
#
|
170
179
|
# @overload recognize(request, options = nil)
|
171
180
|
# Pass arguments to `recognize` via a request object, either of type
|
172
|
-
# {Google::Cloud::Speech::V1::RecognizeRequest} or an equivalent Hash.
|
181
|
+
# {::Google::Cloud::Speech::V1::RecognizeRequest} or an equivalent Hash.
|
173
182
|
#
|
174
|
-
# @param request [Google::Cloud::Speech::V1::RecognizeRequest, Hash]
|
183
|
+
# @param request [::Google::Cloud::Speech::V1::RecognizeRequest, ::Hash]
|
175
184
|
# A request object representing the call parameters. Required. To specify no
|
176
185
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
177
|
-
# @param options [Gapic::CallOptions, Hash]
|
186
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
178
187
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
179
188
|
#
|
180
189
|
# @overload recognize(config: nil, audio: nil)
|
@@ -182,33 +191,33 @@ module Google
|
|
182
191
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
183
192
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
184
193
|
#
|
185
|
-
# @param config [Google::Cloud::Speech::V1::RecognitionConfig, Hash]
|
194
|
+
# @param config [::Google::Cloud::Speech::V1::RecognitionConfig, ::Hash]
|
186
195
|
# Required. Provides information to the recognizer that specifies how to
|
187
196
|
# process the request.
|
188
|
-
# @param audio [Google::Cloud::Speech::V1::RecognitionAudio, Hash]
|
197
|
+
# @param audio [::Google::Cloud::Speech::V1::RecognitionAudio, ::Hash]
|
189
198
|
# Required. The audio data to be recognized.
|
190
199
|
#
|
191
200
|
# @yield [response, operation] Access the result along with the RPC operation
|
192
|
-
# @yieldparam response [Google::Cloud::Speech::V1::RecognizeResponse]
|
193
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
201
|
+
# @yieldparam response [::Google::Cloud::Speech::V1::RecognizeResponse]
|
202
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
194
203
|
#
|
195
|
-
# @return [Google::Cloud::Speech::V1::RecognizeResponse]
|
204
|
+
# @return [::Google::Cloud::Speech::V1::RecognizeResponse]
|
196
205
|
#
|
197
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
206
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
198
207
|
#
|
199
208
|
def recognize request, options = nil
|
200
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
209
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
201
210
|
|
202
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Speech::V1::RecognizeRequest
|
211
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1::RecognizeRequest
|
203
212
|
|
204
213
|
# Converts hash and nil to an options object
|
205
|
-
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
214
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
206
215
|
|
207
216
|
# Customize the options with defaults
|
208
217
|
metadata = @config.rpcs.recognize.metadata.to_h
|
209
218
|
|
210
219
|
# Set x-goog-api-client and x-goog-user-project headers
|
211
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
220
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
212
221
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
213
222
|
gapic_version: ::Google::Cloud::Speech::V1::VERSION
|
214
223
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -223,8 +232,8 @@ module Google
|
|
223
232
|
yield response, operation if block_given?
|
224
233
|
return response
|
225
234
|
end
|
226
|
-
rescue GRPC::BadStatus => e
|
227
|
-
raise Google::Cloud::Error.from_error(e)
|
235
|
+
rescue ::GRPC::BadStatus => e
|
236
|
+
raise ::Google::Cloud::Error.from_error(e)
|
228
237
|
end
|
229
238
|
|
230
239
|
##
|
@@ -237,12 +246,12 @@ module Google
|
|
237
246
|
#
|
238
247
|
# @overload long_running_recognize(request, options = nil)
|
239
248
|
# Pass arguments to `long_running_recognize` via a request object, either of type
|
240
|
-
# {Google::Cloud::Speech::V1::LongRunningRecognizeRequest} or an equivalent Hash.
|
249
|
+
# {::Google::Cloud::Speech::V1::LongRunningRecognizeRequest} or an equivalent Hash.
|
241
250
|
#
|
242
|
-
# @param request [Google::Cloud::Speech::V1::LongRunningRecognizeRequest, Hash]
|
251
|
+
# @param request [::Google::Cloud::Speech::V1::LongRunningRecognizeRequest, ::Hash]
|
243
252
|
# A request object representing the call parameters. Required. To specify no
|
244
253
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
245
|
-
# @param options [Gapic::CallOptions, Hash]
|
254
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
246
255
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
247
256
|
#
|
248
257
|
# @overload long_running_recognize(config: nil, audio: nil)
|
@@ -250,33 +259,33 @@ module Google
|
|
250
259
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
251
260
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
252
261
|
#
|
253
|
-
# @param config [Google::Cloud::Speech::V1::RecognitionConfig, Hash]
|
262
|
+
# @param config [::Google::Cloud::Speech::V1::RecognitionConfig, ::Hash]
|
254
263
|
# Required. Provides information to the recognizer that specifies how to
|
255
264
|
# process the request.
|
256
|
-
# @param audio [Google::Cloud::Speech::V1::RecognitionAudio, Hash]
|
265
|
+
# @param audio [::Google::Cloud::Speech::V1::RecognitionAudio, ::Hash]
|
257
266
|
# Required. The audio data to be recognized.
|
258
267
|
#
|
259
268
|
# @yield [response, operation] Access the result along with the RPC operation
|
260
|
-
# @yieldparam response [Gapic::Operation]
|
261
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
269
|
+
# @yieldparam response [::Gapic::Operation]
|
270
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
262
271
|
#
|
263
|
-
# @return [Gapic::Operation]
|
272
|
+
# @return [::Gapic::Operation]
|
264
273
|
#
|
265
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
274
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
266
275
|
#
|
267
276
|
def long_running_recognize request, options = nil
|
268
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
277
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
269
278
|
|
270
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Speech::V1::LongRunningRecognizeRequest
|
279
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1::LongRunningRecognizeRequest
|
271
280
|
|
272
281
|
# Converts hash and nil to an options object
|
273
|
-
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
282
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
274
283
|
|
275
284
|
# Customize the options with defaults
|
276
285
|
metadata = @config.rpcs.long_running_recognize.metadata.to_h
|
277
286
|
|
278
287
|
# Set x-goog-api-client and x-goog-user-project headers
|
279
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
288
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
280
289
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
281
290
|
gapic_version: ::Google::Cloud::Speech::V1::VERSION
|
282
291
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -288,49 +297,49 @@ module Google
|
|
288
297
|
retry_policy: @config.retry_policy
|
289
298
|
|
290
299
|
@speech_stub.call_rpc :long_running_recognize, request, options: options do |response, operation|
|
291
|
-
response = Gapic::Operation.new response, @operations_client, options: options
|
300
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
292
301
|
yield response, operation if block_given?
|
293
302
|
return response
|
294
303
|
end
|
295
|
-
rescue GRPC::BadStatus => e
|
296
|
-
raise Google::Cloud::Error.from_error(e)
|
304
|
+
rescue ::GRPC::BadStatus => e
|
305
|
+
raise ::Google::Cloud::Error.from_error(e)
|
297
306
|
end
|
298
307
|
|
299
308
|
##
|
300
309
|
# Performs bidirectional streaming speech recognition: receive results while
|
301
310
|
# sending audio. This method is only available via the gRPC API (not REST).
|
302
311
|
#
|
303
|
-
# @param request [Gapic::StreamInput, Enumerable
|
304
|
-
# An enumerable of {Google::Cloud::Speech::V1::StreamingRecognizeRequest} instances.
|
305
|
-
# @param options [Gapic::CallOptions, Hash]
|
312
|
+
# @param request [::Gapic::StreamInput, ::Enumerable<::Google::Cloud::Speech::V1::StreamingRecognizeRequest, ::Hash>]
|
313
|
+
# An enumerable of {::Google::Cloud::Speech::V1::StreamingRecognizeRequest} instances.
|
314
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
306
315
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
307
316
|
#
|
308
317
|
# @yield [response, operation] Access the result along with the RPC operation
|
309
|
-
# @yieldparam response [Enumerable
|
310
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
318
|
+
# @yieldparam response [::Enumerable<::Google::Cloud::Speech::V1::StreamingRecognizeResponse>]
|
319
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
311
320
|
#
|
312
|
-
# @return [Enumerable
|
321
|
+
# @return [::Enumerable<::Google::Cloud::Speech::V1::StreamingRecognizeResponse>]
|
313
322
|
#
|
314
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
323
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
315
324
|
#
|
316
325
|
def streaming_recognize request, options = nil
|
317
|
-
unless request.is_a? Enumerable
|
318
|
-
raise ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
|
326
|
+
unless request.is_a? ::Enumerable
|
327
|
+
raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
|
319
328
|
request = request.to_enum
|
320
329
|
end
|
321
330
|
|
322
331
|
request = request.lazy.map do |req|
|
323
|
-
Gapic::Protobuf.coerce req, to: Google::Cloud::Speech::V1::StreamingRecognizeRequest
|
332
|
+
::Gapic::Protobuf.coerce req, to: ::Google::Cloud::Speech::V1::StreamingRecognizeRequest
|
324
333
|
end
|
325
334
|
|
326
335
|
# Converts hash and nil to an options object
|
327
|
-
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
336
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
328
337
|
|
329
338
|
# Customize the options with defaults
|
330
339
|
metadata = @config.rpcs.streaming_recognize.metadata.to_h
|
331
340
|
|
332
341
|
# Set x-goog-api-client and x-goog-user-project headers
|
333
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
342
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
334
343
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
335
344
|
gapic_version: ::Google::Cloud::Speech::V1::VERSION
|
336
345
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -345,8 +354,8 @@ module Google
|
|
345
354
|
yield response, operation if block_given?
|
346
355
|
return response
|
347
356
|
end
|
348
|
-
rescue GRPC::BadStatus => e
|
349
|
-
raise Google::Cloud::Error.from_error(e)
|
357
|
+
rescue ::GRPC::BadStatus => e
|
358
|
+
raise ::Google::Cloud::Error.from_error(e)
|
350
359
|
end
|
351
360
|
|
352
361
|
##
|
@@ -356,7 +365,7 @@ module Google
|
|
356
365
|
# providing control over timeouts, retry behavior, logging, transport
|
357
366
|
# parameters, and other low-level controls. Certain parameters can also be
|
358
367
|
# applied individually to specific RPCs. See
|
359
|
-
# {Google::Cloud::Speech::V1::Speech::Client::Configuration::Rpcs}
|
368
|
+
# {::Google::Cloud::Speech::V1::Speech::Client::Configuration::Rpcs}
|
360
369
|
# for a list of RPCs that can be configured independently.
|
361
370
|
#
|
362
371
|
# Configuration can be applied globally to all clients, or to a single client
|
@@ -367,22 +376,22 @@ module Google
|
|
367
376
|
# To modify the global config, setting the timeout for recognize
|
368
377
|
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
369
378
|
#
|
370
|
-
# Google::Cloud::Speech::V1::Speech::Client.configure do |config|
|
371
|
-
# config.timeout =
|
372
|
-
# config.rpcs.recognize.timeout =
|
379
|
+
# ::Google::Cloud::Speech::V1::Speech::Client.configure do |config|
|
380
|
+
# config.timeout = 10.0
|
381
|
+
# config.rpcs.recognize.timeout = 20.0
|
373
382
|
# end
|
374
383
|
#
|
375
384
|
# To apply the above configuration only to a new client:
|
376
385
|
#
|
377
|
-
# client = Google::Cloud::Speech::V1::Speech::Client.new do |config|
|
378
|
-
# config.timeout =
|
379
|
-
# config.rpcs.recognize.timeout =
|
386
|
+
# client = ::Google::Cloud::Speech::V1::Speech::Client.new do |config|
|
387
|
+
# config.timeout = 10.0
|
388
|
+
# config.rpcs.recognize.timeout = 20.0
|
380
389
|
# end
|
381
390
|
#
|
382
391
|
# @!attribute [rw] endpoint
|
383
392
|
# The hostname or hostname:port of the service endpoint.
|
384
393
|
# Defaults to `"speech.googleapis.com"`.
|
385
|
-
# @return [String]
|
394
|
+
# @return [::String]
|
386
395
|
# @!attribute [rw] credentials
|
387
396
|
# Credentials to send with calls. You may provide any of the following types:
|
388
397
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -394,29 +403,29 @@ module Google
|
|
394
403
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
395
404
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
396
405
|
# * (`nil`) indicating no credentials
|
397
|
-
# @return [Object]
|
406
|
+
# @return [::Object]
|
398
407
|
# @!attribute [rw] scope
|
399
408
|
# The OAuth scopes
|
400
|
-
# @return [Array
|
409
|
+
# @return [::Array<::String>]
|
401
410
|
# @!attribute [rw] lib_name
|
402
411
|
# The library name as recorded in instrumentation and logging
|
403
|
-
# @return [String]
|
412
|
+
# @return [::String]
|
404
413
|
# @!attribute [rw] lib_version
|
405
414
|
# The library version as recorded in instrumentation and logging
|
406
|
-
# @return [String]
|
415
|
+
# @return [::String]
|
407
416
|
# @!attribute [rw] channel_args
|
408
417
|
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
409
418
|
# `GRPC::Core::Channel` object is provided as the credential.
|
410
|
-
# @return [Hash]
|
419
|
+
# @return [::Hash]
|
411
420
|
# @!attribute [rw] interceptors
|
412
421
|
# An array of interceptors that are run before calls are executed.
|
413
|
-
# @return [Array
|
422
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
414
423
|
# @!attribute [rw] timeout
|
415
|
-
# The call timeout in
|
416
|
-
# @return [Numeric]
|
424
|
+
# The call timeout in seconds.
|
425
|
+
# @return [::Numeric]
|
417
426
|
# @!attribute [rw] metadata
|
418
427
|
# Additional gRPC headers to be sent with the call.
|
419
|
-
# @return [Hash{Symbol
|
428
|
+
# @return [::Hash{::Symbol=>::String}]
|
420
429
|
# @!attribute [rw] retry_policy
|
421
430
|
# The retry policy. The value is a hash with the following keys:
|
422
431
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
@@ -424,25 +433,29 @@ module Google
|
|
424
433
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
425
434
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
426
435
|
# trigger a retry.
|
427
|
-
# @return [Hash]
|
436
|
+
# @return [::Hash]
|
437
|
+
# @!attribute [rw] quota_project
|
438
|
+
# A separate project against which to charge quota.
|
439
|
+
# @return [::String]
|
428
440
|
#
|
429
441
|
class Configuration
|
430
|
-
extend Gapic::Config
|
442
|
+
extend ::Gapic::Config
|
431
443
|
|
432
|
-
config_attr :endpoint,
|
433
|
-
config_attr :credentials,
|
444
|
+
config_attr :endpoint, "speech.googleapis.com", ::String
|
445
|
+
config_attr :credentials, nil do |value|
|
434
446
|
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
435
447
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
436
448
|
allowed.any? { |klass| klass === value }
|
437
449
|
end
|
438
|
-
config_attr :scope,
|
439
|
-
config_attr :lib_name,
|
440
|
-
config_attr :lib_version,
|
441
|
-
config_attr(:channel_args,
|
442
|
-
config_attr :interceptors,
|
443
|
-
config_attr :timeout,
|
444
|
-
config_attr :metadata,
|
445
|
-
config_attr :retry_policy,
|
450
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
451
|
+
config_attr :lib_name, nil, ::String, nil
|
452
|
+
config_attr :lib_version, nil, ::String, nil
|
453
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
454
|
+
config_attr :interceptors, nil, ::Array, nil
|
455
|
+
config_attr :timeout, nil, ::Numeric, nil
|
456
|
+
config_attr :metadata, nil, ::Hash, nil
|
457
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
458
|
+
config_attr :quota_project, nil, ::String, nil
|
446
459
|
|
447
460
|
# @private
|
448
461
|
def initialize parent_config = nil
|
@@ -458,7 +471,7 @@ module Google
|
|
458
471
|
def rpcs
|
459
472
|
@rpcs ||= begin
|
460
473
|
parent_rpcs = nil
|
461
|
-
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to?
|
474
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
462
475
|
Rpcs.new parent_rpcs
|
463
476
|
end
|
464
477
|
end
|
@@ -483,28 +496,28 @@ module Google
|
|
483
496
|
class Rpcs
|
484
497
|
##
|
485
498
|
# RPC-specific configuration for `recognize`
|
486
|
-
# @return [Gapic::Config::Method]
|
499
|
+
# @return [::Gapic::Config::Method]
|
487
500
|
#
|
488
501
|
attr_reader :recognize
|
489
502
|
##
|
490
503
|
# RPC-specific configuration for `long_running_recognize`
|
491
|
-
# @return [Gapic::Config::Method]
|
504
|
+
# @return [::Gapic::Config::Method]
|
492
505
|
#
|
493
506
|
attr_reader :long_running_recognize
|
494
507
|
##
|
495
508
|
# RPC-specific configuration for `streaming_recognize`
|
496
|
-
# @return [Gapic::Config::Method]
|
509
|
+
# @return [::Gapic::Config::Method]
|
497
510
|
#
|
498
511
|
attr_reader :streaming_recognize
|
499
512
|
|
500
513
|
# @private
|
501
514
|
def initialize parent_rpcs = nil
|
502
515
|
recognize_config = parent_rpcs&.recognize if parent_rpcs&.respond_to? :recognize
|
503
|
-
@recognize = Gapic::Config::Method.new recognize_config
|
516
|
+
@recognize = ::Gapic::Config::Method.new recognize_config
|
504
517
|
long_running_recognize_config = parent_rpcs&.long_running_recognize if parent_rpcs&.respond_to? :long_running_recognize
|
505
|
-
@long_running_recognize = Gapic::Config::Method.new long_running_recognize_config
|
518
|
+
@long_running_recognize = ::Gapic::Config::Method.new long_running_recognize_config
|
506
519
|
streaming_recognize_config = parent_rpcs&.streaming_recognize if parent_rpcs&.respond_to? :streaming_recognize
|
507
|
-
@streaming_recognize = Gapic::Config::Method.new streaming_recognize_config
|
520
|
+
@streaming_recognize = ::Gapic::Config::Method.new streaming_recognize_config
|
508
521
|
|
509
522
|
yield self if block_given?
|
510
523
|
end
|