google-cloud-vision-v1 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/google/cloud/vision/v1/image_annotator/client.rb +115 -40
- data/lib/google/cloud/vision/v1/image_annotator/operations.rb +125 -21
- data/lib/google/cloud/vision/v1/product_search/client.rb +409 -55
- data/lib/google/cloud/vision/v1/product_search/operations.rb +125 -21
- data/lib/google/cloud/vision/v1/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c77437a1643aa114692c2d45788291efe93b07eb6fc5ba60174d51c145ba90c
|
4
|
+
data.tar.gz: 1ec4cca3f1ba2221f985737730eece25d0c3dc824fb87c9561354ce9ba12eedd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 844f20d2a4d0358fb38c67736cea671921cd9fc9ee90e1d0649344e46d4319b388db36bd612b30e9cd98d244eba456cf6b9cbf516cae48035ef417ba74856c2c
|
7
|
+
data.tar.gz: 71fc7560c2188fbfa889842d45f981adb964ed781f307e60e9cb6f317328b6cd49017a7ccdb8d08cfa595c00ba61b965cbd29ed29cb24480bd40c4fa3f4570b7
|
@@ -43,13 +43,12 @@ module Google
|
|
43
43
|
# See {::Google::Cloud::Vision::V1::ImageAnnotator::Client::Configuration}
|
44
44
|
# for a description of the configuration fields.
|
45
45
|
#
|
46
|
-
#
|
46
|
+
# @example
|
47
47
|
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
# end
|
48
|
+
# # Modify the configuration for all ImageAnnotator clients
|
49
|
+
# ::Google::Cloud::Vision::V1::ImageAnnotator::Client.configure do |config|
|
50
|
+
# config.timeout = 10.0
|
51
|
+
# end
|
53
52
|
#
|
54
53
|
# @yield [config] Configure the Client client.
|
55
54
|
# @yieldparam config [Client::Configuration]
|
@@ -116,19 +115,15 @@ module Google
|
|
116
115
|
##
|
117
116
|
# Create a new ImageAnnotator client object.
|
118
117
|
#
|
119
|
-
#
|
120
|
-
#
|
121
|
-
# To create a new ImageAnnotator client with the default
|
122
|
-
# configuration:
|
118
|
+
# @example
|
123
119
|
#
|
124
|
-
#
|
120
|
+
# # Create a client using the default configuration
|
121
|
+
# client = ::Google::Cloud::Vision::V1::ImageAnnotator::Client.new
|
125
122
|
#
|
126
|
-
#
|
127
|
-
#
|
128
|
-
#
|
129
|
-
#
|
130
|
-
# config.timeout = 10.0
|
131
|
-
# end
|
123
|
+
# # Create a client using a custom configuration
|
124
|
+
# client = ::Google::Cloud::Vision::V1::ImageAnnotator::Client.new do |config|
|
125
|
+
# config.timeout = 10.0
|
126
|
+
# end
|
132
127
|
#
|
133
128
|
# @yield [config] Configure the ImageAnnotator client.
|
134
129
|
# @yieldparam config [Client::Configuration]
|
@@ -148,10 +143,9 @@ module Google
|
|
148
143
|
|
149
144
|
# Create credentials
|
150
145
|
credentials = @config.credentials
|
151
|
-
# Use self-signed JWT if the
|
146
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
152
147
|
# but only if the default endpoint does not have a region prefix.
|
153
|
-
enable_self_signed_jwt = @config.
|
154
|
-
@config.endpoint == Client.configure.endpoint &&
|
148
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
155
149
|
!@config.endpoint.split(".").first.include?("-")
|
156
150
|
credentials ||= Credentials.default scope: @config.scope,
|
157
151
|
enable_self_signed_jwt: enable_self_signed_jwt
|
@@ -226,6 +220,21 @@ module Google
|
|
226
220
|
#
|
227
221
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
228
222
|
#
|
223
|
+
# @example Basic example
|
224
|
+
# require "google/cloud/vision/v1"
|
225
|
+
#
|
226
|
+
# # Create a client object. The client can be reused for multiple calls.
|
227
|
+
# client = Google::Cloud::Vision::V1::ImageAnnotator::Client.new
|
228
|
+
#
|
229
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
230
|
+
# request = Google::Cloud::Vision::V1::BatchAnnotateImagesRequest.new
|
231
|
+
#
|
232
|
+
# # Call the batch_annotate_images method.
|
233
|
+
# result = client.batch_annotate_images request
|
234
|
+
#
|
235
|
+
# # The returned object is of type Google::Cloud::Vision::V1::BatchAnnotateImagesResponse.
|
236
|
+
# p result
|
237
|
+
#
|
229
238
|
def batch_annotate_images request, options = nil
|
230
239
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
231
240
|
|
@@ -246,7 +255,9 @@ module Google
|
|
246
255
|
options.apply_defaults timeout: @config.rpcs.batch_annotate_images.timeout,
|
247
256
|
metadata: metadata,
|
248
257
|
retry_policy: @config.rpcs.batch_annotate_images.retry_policy
|
249
|
-
|
258
|
+
|
259
|
+
options.apply_defaults timeout: @config.timeout,
|
260
|
+
metadata: @config.metadata,
|
250
261
|
retry_policy: @config.retry_policy
|
251
262
|
|
252
263
|
@image_annotator_stub.call_rpc :batch_annotate_images, request, options: options do |response, operation|
|
@@ -306,6 +317,21 @@ module Google
|
|
306
317
|
#
|
307
318
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
308
319
|
#
|
320
|
+
# @example Basic example
|
321
|
+
# require "google/cloud/vision/v1"
|
322
|
+
#
|
323
|
+
# # Create a client object. The client can be reused for multiple calls.
|
324
|
+
# client = Google::Cloud::Vision::V1::ImageAnnotator::Client.new
|
325
|
+
#
|
326
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
327
|
+
# request = Google::Cloud::Vision::V1::BatchAnnotateFilesRequest.new
|
328
|
+
#
|
329
|
+
# # Call the batch_annotate_files method.
|
330
|
+
# result = client.batch_annotate_files request
|
331
|
+
#
|
332
|
+
# # The returned object is of type Google::Cloud::Vision::V1::BatchAnnotateFilesResponse.
|
333
|
+
# p result
|
334
|
+
#
|
309
335
|
def batch_annotate_files request, options = nil
|
310
336
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
311
337
|
|
@@ -326,7 +352,9 @@ module Google
|
|
326
352
|
options.apply_defaults timeout: @config.rpcs.batch_annotate_files.timeout,
|
327
353
|
metadata: metadata,
|
328
354
|
retry_policy: @config.rpcs.batch_annotate_files.retry_policy
|
329
|
-
|
355
|
+
|
356
|
+
options.apply_defaults timeout: @config.timeout,
|
357
|
+
metadata: @config.metadata,
|
330
358
|
retry_policy: @config.retry_policy
|
331
359
|
|
332
360
|
@image_annotator_stub.call_rpc :batch_annotate_files, request, options: options do |response, operation|
|
@@ -389,6 +417,28 @@ module Google
|
|
389
417
|
#
|
390
418
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
391
419
|
#
|
420
|
+
# @example Basic example
|
421
|
+
# require "google/cloud/vision/v1"
|
422
|
+
#
|
423
|
+
# # Create a client object. The client can be reused for multiple calls.
|
424
|
+
# client = Google::Cloud::Vision::V1::ImageAnnotator::Client.new
|
425
|
+
#
|
426
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
427
|
+
# request = Google::Cloud::Vision::V1::AsyncBatchAnnotateImagesRequest.new
|
428
|
+
#
|
429
|
+
# # Call the async_batch_annotate_images method.
|
430
|
+
# result = client.async_batch_annotate_images request
|
431
|
+
#
|
432
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
433
|
+
# # object to check the status of an operation, cancel it, or wait
|
434
|
+
# # for results. Here is how to block until completion:
|
435
|
+
# result.wait_until_done! timeout: 60
|
436
|
+
# if result.response?
|
437
|
+
# p result.response
|
438
|
+
# else
|
439
|
+
# puts "Error!"
|
440
|
+
# end
|
441
|
+
#
|
392
442
|
def async_batch_annotate_images request, options = nil
|
393
443
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
394
444
|
|
@@ -409,7 +459,9 @@ module Google
|
|
409
459
|
options.apply_defaults timeout: @config.rpcs.async_batch_annotate_images.timeout,
|
410
460
|
metadata: metadata,
|
411
461
|
retry_policy: @config.rpcs.async_batch_annotate_images.retry_policy
|
412
|
-
|
462
|
+
|
463
|
+
options.apply_defaults timeout: @config.timeout,
|
464
|
+
metadata: @config.metadata,
|
413
465
|
retry_policy: @config.retry_policy
|
414
466
|
|
415
467
|
@image_annotator_stub.call_rpc :async_batch_annotate_images, request, options: options do |response, operation|
|
@@ -468,6 +520,28 @@ module Google
|
|
468
520
|
#
|
469
521
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
470
522
|
#
|
523
|
+
# @example Basic example
|
524
|
+
# require "google/cloud/vision/v1"
|
525
|
+
#
|
526
|
+
# # Create a client object. The client can be reused for multiple calls.
|
527
|
+
# client = Google::Cloud::Vision::V1::ImageAnnotator::Client.new
|
528
|
+
#
|
529
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
530
|
+
# request = Google::Cloud::Vision::V1::AsyncBatchAnnotateFilesRequest.new
|
531
|
+
#
|
532
|
+
# # Call the async_batch_annotate_files method.
|
533
|
+
# result = client.async_batch_annotate_files request
|
534
|
+
#
|
535
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
536
|
+
# # object to check the status of an operation, cancel it, or wait
|
537
|
+
# # for results. Here is how to block until completion:
|
538
|
+
# result.wait_until_done! timeout: 60
|
539
|
+
# if result.response?
|
540
|
+
# p result.response
|
541
|
+
# else
|
542
|
+
# puts "Error!"
|
543
|
+
# end
|
544
|
+
#
|
471
545
|
def async_batch_annotate_files request, options = nil
|
472
546
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
473
547
|
|
@@ -488,7 +562,9 @@ module Google
|
|
488
562
|
options.apply_defaults timeout: @config.rpcs.async_batch_annotate_files.timeout,
|
489
563
|
metadata: metadata,
|
490
564
|
retry_policy: @config.rpcs.async_batch_annotate_files.retry_policy
|
491
|
-
|
565
|
+
|
566
|
+
options.apply_defaults timeout: @config.timeout,
|
567
|
+
metadata: @config.metadata,
|
492
568
|
retry_policy: @config.retry_policy
|
493
569
|
|
494
570
|
@image_annotator_stub.call_rpc :async_batch_annotate_files, request, options: options do |response, operation|
|
@@ -513,22 +589,21 @@ module Google
|
|
513
589
|
# Configuration can be applied globally to all clients, or to a single client
|
514
590
|
# on construction.
|
515
591
|
#
|
516
|
-
#
|
517
|
-
#
|
518
|
-
#
|
519
|
-
# to 20 seconds,
|
520
|
-
#
|
521
|
-
#
|
522
|
-
#
|
523
|
-
#
|
524
|
-
#
|
525
|
-
#
|
526
|
-
#
|
527
|
-
#
|
528
|
-
#
|
529
|
-
#
|
530
|
-
#
|
531
|
-
# end
|
592
|
+
# @example
|
593
|
+
#
|
594
|
+
# # Modify the global config, setting the timeout for
|
595
|
+
# # batch_annotate_images to 20 seconds,
|
596
|
+
# # and all remaining timeouts to 10 seconds.
|
597
|
+
# ::Google::Cloud::Vision::V1::ImageAnnotator::Client.configure do |config|
|
598
|
+
# config.timeout = 10.0
|
599
|
+
# config.rpcs.batch_annotate_images.timeout = 20.0
|
600
|
+
# end
|
601
|
+
#
|
602
|
+
# # Apply the above configuration only to a new client.
|
603
|
+
# client = ::Google::Cloud::Vision::V1::ImageAnnotator::Client.new do |config|
|
604
|
+
# config.timeout = 10.0
|
605
|
+
# config.rpcs.batch_annotate_images.timeout = 20.0
|
606
|
+
# end
|
532
607
|
#
|
533
608
|
# @!attribute [rw] endpoint
|
534
609
|
# The hostname or hostname:port of the service endpoint.
|
@@ -143,6 +143,27 @@ module Google
|
|
143
143
|
#
|
144
144
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
145
145
|
#
|
146
|
+
# @example Basic example
|
147
|
+
# require "google/longrunning"
|
148
|
+
#
|
149
|
+
# # Create a client object. The client can be reused for multiple calls.
|
150
|
+
# client = Google::Longrunning::Operations::Client.new
|
151
|
+
#
|
152
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
153
|
+
# request = Google::Longrunning::ListOperationsRequest.new
|
154
|
+
#
|
155
|
+
# # Call the list_operations method.
|
156
|
+
# result = client.list_operations request
|
157
|
+
#
|
158
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
159
|
+
# # iterate over all elements by calling #each, and the enumerable
|
160
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
161
|
+
# # methods are also available for managing paging directly.
|
162
|
+
# result.each do |response|
|
163
|
+
# # Each element is of type ::Google::Longrunning::Operation.
|
164
|
+
# p response
|
165
|
+
# end
|
166
|
+
#
|
146
167
|
def list_operations request, options = nil
|
147
168
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
148
169
|
|
@@ -169,7 +190,9 @@ module Google
|
|
169
190
|
options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
|
170
191
|
metadata: metadata,
|
171
192
|
retry_policy: @config.rpcs.list_operations.retry_policy
|
172
|
-
|
193
|
+
|
194
|
+
options.apply_defaults timeout: @config.timeout,
|
195
|
+
metadata: @config.metadata,
|
173
196
|
retry_policy: @config.retry_policy
|
174
197
|
|
175
198
|
@operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
|
@@ -213,6 +236,28 @@ module Google
|
|
213
236
|
#
|
214
237
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
215
238
|
#
|
239
|
+
# @example Basic example
|
240
|
+
# require "google/longrunning"
|
241
|
+
#
|
242
|
+
# # Create a client object. The client can be reused for multiple calls.
|
243
|
+
# client = Google::Longrunning::Operations::Client.new
|
244
|
+
#
|
245
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
246
|
+
# request = Google::Longrunning::GetOperationRequest.new
|
247
|
+
#
|
248
|
+
# # Call the get_operation method.
|
249
|
+
# result = client.get_operation request
|
250
|
+
#
|
251
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
252
|
+
# # object to check the status of an operation, cancel it, or wait
|
253
|
+
# # for results. Here is how to block until completion:
|
254
|
+
# result.wait_until_done! timeout: 60
|
255
|
+
# if result.response?
|
256
|
+
# p result.response
|
257
|
+
# else
|
258
|
+
# puts "Error!"
|
259
|
+
# end
|
260
|
+
#
|
216
261
|
def get_operation request, options = nil
|
217
262
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
218
263
|
|
@@ -239,7 +284,9 @@ module Google
|
|
239
284
|
options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
|
240
285
|
metadata: metadata,
|
241
286
|
retry_policy: @config.rpcs.get_operation.retry_policy
|
242
|
-
|
287
|
+
|
288
|
+
options.apply_defaults timeout: @config.timeout,
|
289
|
+
metadata: @config.metadata,
|
243
290
|
retry_policy: @config.retry_policy
|
244
291
|
|
245
292
|
@operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
|
@@ -283,6 +330,21 @@ module Google
|
|
283
330
|
#
|
284
331
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
285
332
|
#
|
333
|
+
# @example Basic example
|
334
|
+
# require "google/longrunning"
|
335
|
+
#
|
336
|
+
# # Create a client object. The client can be reused for multiple calls.
|
337
|
+
# client = Google::Longrunning::Operations::Client.new
|
338
|
+
#
|
339
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
340
|
+
# request = Google::Longrunning::DeleteOperationRequest.new
|
341
|
+
#
|
342
|
+
# # Call the delete_operation method.
|
343
|
+
# result = client.delete_operation request
|
344
|
+
#
|
345
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
346
|
+
# p result
|
347
|
+
#
|
286
348
|
def delete_operation request, options = nil
|
287
349
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
288
350
|
|
@@ -309,7 +371,9 @@ module Google
|
|
309
371
|
options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
|
310
372
|
metadata: metadata,
|
311
373
|
retry_policy: @config.rpcs.delete_operation.retry_policy
|
312
|
-
|
374
|
+
|
375
|
+
options.apply_defaults timeout: @config.timeout,
|
376
|
+
metadata: @config.metadata,
|
313
377
|
retry_policy: @config.retry_policy
|
314
378
|
|
315
379
|
@operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
|
@@ -358,6 +422,21 @@ module Google
|
|
358
422
|
#
|
359
423
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
360
424
|
#
|
425
|
+
# @example Basic example
|
426
|
+
# require "google/longrunning"
|
427
|
+
#
|
428
|
+
# # Create a client object. The client can be reused for multiple calls.
|
429
|
+
# client = Google::Longrunning::Operations::Client.new
|
430
|
+
#
|
431
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
432
|
+
# request = Google::Longrunning::CancelOperationRequest.new
|
433
|
+
#
|
434
|
+
# # Call the cancel_operation method.
|
435
|
+
# result = client.cancel_operation request
|
436
|
+
#
|
437
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
438
|
+
# p result
|
439
|
+
#
|
361
440
|
def cancel_operation request, options = nil
|
362
441
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
363
442
|
|
@@ -384,7 +463,9 @@ module Google
|
|
384
463
|
options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
|
385
464
|
metadata: metadata,
|
386
465
|
retry_policy: @config.rpcs.cancel_operation.retry_policy
|
387
|
-
|
466
|
+
|
467
|
+
options.apply_defaults timeout: @config.timeout,
|
468
|
+
metadata: @config.metadata,
|
388
469
|
retry_policy: @config.retry_policy
|
389
470
|
|
390
471
|
@operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
|
@@ -436,6 +517,28 @@ module Google
|
|
436
517
|
#
|
437
518
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
438
519
|
#
|
520
|
+
# @example Basic example
|
521
|
+
# require "google/longrunning"
|
522
|
+
#
|
523
|
+
# # Create a client object. The client can be reused for multiple calls.
|
524
|
+
# client = Google::Longrunning::Operations::Client.new
|
525
|
+
#
|
526
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
527
|
+
# request = Google::Longrunning::WaitOperationRequest.new
|
528
|
+
#
|
529
|
+
# # Call the wait_operation method.
|
530
|
+
# result = client.wait_operation request
|
531
|
+
#
|
532
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
533
|
+
# # object to check the status of an operation, cancel it, or wait
|
534
|
+
# # for results. Here is how to block until completion:
|
535
|
+
# result.wait_until_done! timeout: 60
|
536
|
+
# if result.response?
|
537
|
+
# p result.response
|
538
|
+
# else
|
539
|
+
# puts "Error!"
|
540
|
+
# end
|
541
|
+
#
|
439
542
|
def wait_operation request, options = nil
|
440
543
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
441
544
|
|
@@ -456,7 +559,9 @@ module Google
|
|
456
559
|
options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
|
457
560
|
metadata: metadata,
|
458
561
|
retry_policy: @config.rpcs.wait_operation.retry_policy
|
459
|
-
|
562
|
+
|
563
|
+
options.apply_defaults timeout: @config.timeout,
|
564
|
+
metadata: @config.metadata,
|
460
565
|
retry_policy: @config.retry_policy
|
461
566
|
|
462
567
|
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
@@ -481,22 +586,21 @@ module Google
|
|
481
586
|
# Configuration can be applied globally to all clients, or to a single client
|
482
587
|
# on construction.
|
483
588
|
#
|
484
|
-
#
|
485
|
-
#
|
486
|
-
#
|
487
|
-
# to 20 seconds,
|
488
|
-
#
|
489
|
-
#
|
490
|
-
#
|
491
|
-
#
|
492
|
-
#
|
493
|
-
#
|
494
|
-
#
|
495
|
-
#
|
496
|
-
#
|
497
|
-
#
|
498
|
-
#
|
499
|
-
# end
|
589
|
+
# @example
|
590
|
+
#
|
591
|
+
# # Modify the global config, setting the timeout for
|
592
|
+
# # list_operations to 20 seconds,
|
593
|
+
# # and all remaining timeouts to 10 seconds.
|
594
|
+
# ::Google::Longrunning::Operations::Client.configure do |config|
|
595
|
+
# config.timeout = 10.0
|
596
|
+
# config.rpcs.list_operations.timeout = 20.0
|
597
|
+
# end
|
598
|
+
#
|
599
|
+
# # Apply the above configuration only to a new client.
|
600
|
+
# client = ::Google::Longrunning::Operations::Client.new do |config|
|
601
|
+
# config.timeout = 10.0
|
602
|
+
# config.rpcs.list_operations.timeout = 20.0
|
603
|
+
# end
|
500
604
|
#
|
501
605
|
# @!attribute [rw] endpoint
|
502
606
|
# The hostname or hostname:port of the service endpoint.
|