google-cloud-vision-v1 0.5.0 → 0.6.3
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 +8 -8
- data/LICENSE.md +188 -190
- data/README.md +3 -3
- data/lib/google/cloud/vision/v1/image_annotator/client.rb +126 -63
- data/lib/google/cloud/vision/v1/image_annotator/operations.rb +134 -30
- data/lib/google/cloud/vision/v1/product_search/client.rb +450 -153
- data/lib/google/cloud/vision/v1/product_search/operations.rb +134 -30
- data/lib/google/cloud/vision/v1/version.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +7 -1
- data/proto_docs/google/type/color.rb +16 -11
- metadata +16 -10
@@ -82,7 +82,7 @@ module Google
|
|
82
82
|
# Create credentials
|
83
83
|
credentials = @config.credentials
|
84
84
|
credentials ||= Credentials.default scope: @config.scope
|
85
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
85
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
86
86
|
credentials = Credentials.new credentials, scope: @config.scope
|
87
87
|
end
|
88
88
|
@quota_project_id = @config.quota_project
|
@@ -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|
|
@@ -396,9 +477,9 @@ module Google
|
|
396
477
|
end
|
397
478
|
|
398
479
|
##
|
399
|
-
# Waits
|
400
|
-
#
|
401
|
-
#
|
480
|
+
# Waits until the specified long-running operation is done or reaches at most
|
481
|
+
# a specified timeout, returning the latest state. If the operation is
|
482
|
+
# already done, the latest state is immediately returned. If the timeout
|
402
483
|
# specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
|
403
484
|
# timeout is used. If the server does not support this method, it returns
|
404
485
|
# `google.rpc.Code.UNIMPLEMENTED`.
|
@@ -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
|
-
# To modify the global config, setting the timeout for list_operations
|
487
|
-
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
488
|
-
#
|
489
|
-
# ::Google::Longrunning::Operations::Client.configure do |config|
|
490
|
-
# config.timeout = 10.0
|
491
|
-
# config.rpcs.list_operations.timeout = 20.0
|
492
|
-
# end
|
589
|
+
# @example
|
493
590
|
#
|
494
|
-
#
|
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
|
495
598
|
#
|
496
|
-
#
|
497
|
-
#
|
498
|
-
#
|
499
|
-
#
|
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.
|
@@ -560,7 +664,7 @@ module Google
|
|
560
664
|
config_attr :scope, nil, ::String, ::Array, nil
|
561
665
|
config_attr :lib_name, nil, ::String, nil
|
562
666
|
config_attr :lib_version, nil, ::String, nil
|
563
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
667
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
564
668
|
config_attr :interceptors, nil, ::Array, nil
|
565
669
|
config_attr :timeout, nil, ::Numeric, nil
|
566
670
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -581,7 +685,7 @@ module Google
|
|
581
685
|
def rpcs
|
582
686
|
@rpcs ||= begin
|
583
687
|
parent_rpcs = nil
|
584
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
688
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
585
689
|
Rpcs.new parent_rpcs
|
586
690
|
end
|
587
691
|
end
|
@@ -632,15 +736,15 @@ module Google
|
|
632
736
|
|
633
737
|
# @private
|
634
738
|
def initialize parent_rpcs = nil
|
635
|
-
list_operations_config = parent_rpcs
|
739
|
+
list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
|
636
740
|
@list_operations = ::Gapic::Config::Method.new list_operations_config
|
637
|
-
get_operation_config = parent_rpcs
|
741
|
+
get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
|
638
742
|
@get_operation = ::Gapic::Config::Method.new get_operation_config
|
639
|
-
delete_operation_config = parent_rpcs
|
743
|
+
delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
|
640
744
|
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
641
|
-
cancel_operation_config = parent_rpcs
|
745
|
+
cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
|
642
746
|
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
643
|
-
wait_operation_config = parent_rpcs
|
747
|
+
wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
|
644
748
|
@wait_operation = ::Gapic::Config::Method.new wait_operation_config
|
645
749
|
|
646
750
|
yield self if block_given?
|
@@ -57,9 +57,15 @@ module Google
|
|
57
57
|
|
58
58
|
# Denotes that a (repeated) field is an unordered list.
|
59
59
|
# This indicates that the service may provide the elements of the list
|
60
|
-
# in any arbitrary
|
60
|
+
# in any arbitrary order, rather than the order the user originally
|
61
61
|
# provided. Additionally, the list's order may or may not be stable.
|
62
62
|
UNORDERED_LIST = 6
|
63
|
+
|
64
|
+
# Denotes that this field returns a non-empty default value if not set.
|
65
|
+
# This indicates that if the user provides the empty value in a request,
|
66
|
+
# a non-empty value will be returned. The user will not be aware of what
|
67
|
+
# non-empty value to expect.
|
68
|
+
NON_EMPTY_DEFAULT = 7
|
63
69
|
end
|
64
70
|
end
|
65
71
|
end
|
@@ -21,17 +21,22 @@ module Google
|
|
21
21
|
module Type
|
22
22
|
# Represents a color in the RGBA color space. This representation is designed
|
23
23
|
# for simplicity of conversion to/from color representations in various
|
24
|
-
# languages over compactness
|
25
|
-
# can be trivially provided to the constructor of
|
26
|
-
# can also be trivially provided to UIColor's
|
24
|
+
# languages over compactness. For example, the fields of this representation
|
25
|
+
# can be trivially provided to the constructor of `java.awt.Color` in Java; it
|
26
|
+
# can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha`
|
27
27
|
# method in iOS; and, with just a little work, it can be easily formatted into
|
28
|
-
# a CSS
|
28
|
+
# a CSS `rgba()` string in JavaScript.
|
29
29
|
#
|
30
|
-
#
|
30
|
+
# This reference page doesn't carry information about the absolute color
|
31
|
+
# space
|
31
32
|
# that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB,
|
32
|
-
# DCI-P3, BT.2020, etc.). By default, applications
|
33
|
+
# DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color
|
33
34
|
# space.
|
34
35
|
#
|
36
|
+
# When color equality needs to be decided, implementations, unless
|
37
|
+
# documented otherwise, treat two colors as equal if all their red,
|
38
|
+
# green, blue, and alpha values each differ by at most 1e-5.
|
39
|
+
#
|
35
40
|
# Example (Java):
|
36
41
|
#
|
37
42
|
# import com.google.type.Color;
|
@@ -117,7 +122,7 @@ module Google
|
|
117
122
|
# var blue = Math.floor(blueFrac * 255);
|
118
123
|
#
|
119
124
|
# if (!('alpha' in rgb_color)) {
|
120
|
-
# return
|
125
|
+
# return rgbToCssColor(red, green, blue);
|
121
126
|
# }
|
122
127
|
#
|
123
128
|
# var alphaFrac = rgb_color.alpha.value || 0.0;
|
@@ -125,7 +130,7 @@ module Google
|
|
125
130
|
# return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
|
126
131
|
# };
|
127
132
|
#
|
128
|
-
# var
|
133
|
+
# var rgbToCssColor = function(red, green, blue) {
|
129
134
|
# var rgbNumber = new Number((red << 16) | (green << 8) | blue);
|
130
135
|
# var hexString = rgbNumber.toString(16);
|
131
136
|
# var missingZeros = 6 - hexString.length;
|
@@ -152,14 +157,14 @@ module Google
|
|
152
157
|
# The fraction of this color that should be applied to the pixel. That is,
|
153
158
|
# the final pixel color is defined by the equation:
|
154
159
|
#
|
155
|
-
# pixel color = alpha * (this color) + (1.0 - alpha) * (background color)
|
160
|
+
# `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)`
|
156
161
|
#
|
157
162
|
# This means that a value of 1.0 corresponds to a solid color, whereas
|
158
163
|
# a value of 0.0 corresponds to a completely transparent color. This
|
159
164
|
# uses a wrapper message rather than a simple float scalar so that it is
|
160
165
|
# possible to distinguish between a default value and the value being unset.
|
161
|
-
# If omitted, this color object is
|
162
|
-
# (as if the alpha value had been explicitly given
|
166
|
+
# If omitted, this color object is rendered as a solid color
|
167
|
+
# (as if the alpha value had been explicitly given a value of 1.0).
|
163
168
|
class Color
|
164
169
|
include ::Google::Protobuf::MessageExts
|
165
170
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-vision-v1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gapic-common
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.7'
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
22
|
+
version: 2.a
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.7'
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
32
|
+
version: 2.a
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: google-cloud-errors
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +50,14 @@ dependencies:
|
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
53
|
+
version: 1.25.1
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
60
|
+
version: 1.25.1
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: minitest
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -218,14 +224,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
218
224
|
requirements:
|
219
225
|
- - ">="
|
220
226
|
- !ruby/object:Gem::Version
|
221
|
-
version: '2.
|
227
|
+
version: '2.5'
|
222
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
229
|
requirements:
|
224
230
|
- - ">="
|
225
231
|
- !ruby/object:Gem::Version
|
226
232
|
version: '0'
|
227
233
|
requirements: []
|
228
|
-
rubygems_version: 3.2.
|
234
|
+
rubygems_version: 3.2.17
|
229
235
|
signing_key:
|
230
236
|
specification_version: 4
|
231
237
|
summary: API Client library for the Cloud Vision V1 API
|