google-cloud-vision 0.37.2 → 1.0.2

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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/AUTHENTICATION.md +51 -59
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +343 -0
  6. data/README.md +94 -49
  7. data/lib/{google/cloud/vision/v1/doc/google/protobuf/wrappers.rb → google-cloud-vision.rb} +4 -11
  8. data/lib/google/cloud/vision.rb +131 -214
  9. data/lib/google/cloud/vision/version.rb +6 -2
  10. metadata +74 -102
  11. data/LICENSE +0 -201
  12. data/lib/google/cloud/vision/v1.rb +0 -249
  13. data/lib/google/cloud/vision/v1/credentials.rb +0 -42
  14. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/geometry.rb +0 -66
  15. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/image_annotator.rb +0 -923
  16. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search.rb +0 -115
  17. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search_service.rb +0 -569
  18. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/text_annotation.rb +0 -254
  19. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/web_detection.rb +0 -102
  20. data/lib/google/cloud/vision/v1/doc/google/longrunning/operations.rb +0 -51
  21. data/lib/google/cloud/vision/v1/doc/google/protobuf/any.rb +0 -131
  22. data/lib/google/cloud/vision/v1/doc/google/protobuf/empty.rb +0 -29
  23. data/lib/google/cloud/vision/v1/doc/google/protobuf/field_mask.rb +0 -222
  24. data/lib/google/cloud/vision/v1/doc/google/protobuf/timestamp.rb +0 -113
  25. data/lib/google/cloud/vision/v1/doc/google/rpc/status.rb +0 -39
  26. data/lib/google/cloud/vision/v1/doc/google/type/color.rb +0 -161
  27. data/lib/google/cloud/vision/v1/doc/google/type/latlng.rb +0 -31
  28. data/lib/google/cloud/vision/v1/geometry_pb.rb +0 -39
  29. data/lib/google/cloud/vision/v1/helpers.rb +0 -1154
  30. data/lib/google/cloud/vision/v1/image_annotator_client.rb +0 -516
  31. data/lib/google/cloud/vision/v1/image_annotator_client_config.json +0 -46
  32. data/lib/google/cloud/vision/v1/image_annotator_pb.rb +0 -344
  33. data/lib/google/cloud/vision/v1/image_annotator_services_pb.rb +0 -74
  34. data/lib/google/cloud/vision/v1/product_search_client.rb +0 -1490
  35. data/lib/google/cloud/vision/v1/product_search_client_config.json +0 -121
  36. data/lib/google/cloud/vision/v1/product_search_pb.rb +0 -54
  37. data/lib/google/cloud/vision/v1/product_search_service_pb.rb +0 -207
  38. data/lib/google/cloud/vision/v1/product_search_service_services_pb.rb +0 -233
  39. data/lib/google/cloud/vision/v1/text_annotation_pb.rb +0 -94
  40. data/lib/google/cloud/vision/v1/web_detection_pb.rb +0 -51
  41. data/lib/google/cloud/vision/v1p3beta1.rb +0 -253
  42. data/lib/google/cloud/vision/v1p3beta1/credentials.rb +0 -42
  43. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/geometry.rb +0 -72
  44. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/image_annotator.rb +0 -763
  45. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search.rb +0 -156
  46. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search_service.rb +0 -538
  47. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/text_annotation.rb +0 -255
  48. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/web_detection.rb +0 -101
  49. data/lib/google/cloud/vision/v1p3beta1/doc/google/longrunning/operations.rb +0 -51
  50. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/any.rb +0 -131
  51. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/empty.rb +0 -29
  52. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/field_mask.rb +0 -222
  53. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/timestamp.rb +0 -113
  54. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/wrappers.rb +0 -26
  55. data/lib/google/cloud/vision/v1p3beta1/doc/google/rpc/status.rb +0 -39
  56. data/lib/google/cloud/vision/v1p3beta1/doc/google/type/color.rb +0 -161
  57. data/lib/google/cloud/vision/v1p3beta1/doc/google/type/latlng.rb +0 -31
  58. data/lib/google/cloud/vision/v1p3beta1/geometry_pb.rb +0 -43
  59. data/lib/google/cloud/vision/v1p3beta1/helpers.rb +0 -1154
  60. data/lib/google/cloud/vision/v1p3beta1/image_annotator_client.rb +0 -312
  61. data/lib/google/cloud/vision/v1p3beta1/image_annotator_client_config.json +0 -36
  62. data/lib/google/cloud/vision/v1p3beta1/image_annotator_pb.rb +0 -304
  63. data/lib/google/cloud/vision/v1p3beta1/image_annotator_services_pb.rb +0 -55
  64. data/lib/google/cloud/vision/v1p3beta1/product_search_client.rb +0 -1419
  65. data/lib/google/cloud/vision/v1p3beta1/product_search_client_config.json +0 -116
  66. data/lib/google/cloud/vision/v1p3beta1/product_search_pb.rb +0 -64
  67. data/lib/google/cloud/vision/v1p3beta1/product_search_service_pb.rb +0 -191
  68. data/lib/google/cloud/vision/v1p3beta1/product_search_service_services_pb.rb +0 -226
  69. data/lib/google/cloud/vision/v1p3beta1/text_annotation_pb.rb +0 -94
  70. data/lib/google/cloud/vision/v1p3beta1/web_detection_pb.rb +0 -51
@@ -1,31 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Type
18
- # An object representing a latitude/longitude pair. This is expressed as a pair
19
- # of doubles representing degrees latitude and degrees longitude. Unless
20
- # specified otherwise, this must conform to the
21
- # <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
22
- # standard</a>. Values must be within normalized ranges.
23
- # @!attribute [rw] latitude
24
- # @return [Float]
25
- # The latitude in degrees. It must be in the range [-90.0, +90.0].
26
- # @!attribute [rw] longitude
27
- # @return [Float]
28
- # The longitude in degrees. It must be in the range [-180.0, +180.0].
29
- class LatLng; end
30
- end
31
- end
@@ -1,39 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: google/cloud/vision/v1/geometry.proto
3
-
4
-
5
- require 'google/protobuf'
6
-
7
- require 'google/api/annotations_pb'
8
- Google::Protobuf::DescriptorPool.generated_pool.build do
9
- add_message "google.cloud.vision.v1.Vertex" do
10
- optional :x, :int32, 1
11
- optional :y, :int32, 2
12
- end
13
- add_message "google.cloud.vision.v1.NormalizedVertex" do
14
- optional :x, :float, 1
15
- optional :y, :float, 2
16
- end
17
- add_message "google.cloud.vision.v1.BoundingPoly" do
18
- repeated :vertices, :message, 1, "google.cloud.vision.v1.Vertex"
19
- repeated :normalized_vertices, :message, 2, "google.cloud.vision.v1.NormalizedVertex"
20
- end
21
- add_message "google.cloud.vision.v1.Position" do
22
- optional :x, :float, 1
23
- optional :y, :float, 2
24
- optional :z, :float, 3
25
- end
26
- end
27
-
28
- module Google
29
- module Cloud
30
- module Vision
31
- module V1
32
- Vertex = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Vertex").msgclass
33
- NormalizedVertex = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.NormalizedVertex").msgclass
34
- BoundingPoly = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.BoundingPoly").msgclass
35
- Position = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Position").msgclass
36
- end
37
- end
38
- end
39
- end
@@ -1,1154 +0,0 @@
1
- # Copyright 2018 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # # limitations under the License.
14
-
15
-
16
- require "uri"
17
-
18
- module Google
19
- module Cloud
20
- module Vision
21
- module V1
22
- class ImageAnnotatorClient
23
-
24
- # @param images [Array<String>, Array<File>]
25
- # An array containing files, file paths, io objects, image urls, or Google Cloud Storage urls. Can be used with or instead of image.
26
- # @param image [File, String]
27
- # A file, file path, io object, url pointing to an image, or Google Cloud Storage url. Can be used with or instead of images.
28
- # @param max_results [Integer]
29
- # Optional. Defaults to 10.
30
- # @param options [Google::Gax::CallOptions]
31
- # Optional. Overrides the default settings for this call, e.g, timeout,
32
- # retries, etc.
33
- # @param async [Boolean]
34
- # Optional. Defaults to false. Specifies whether to preform the request synchronously and return a
35
- # BatchAnnotateImagesResponse instance or to return a Google::Gax::Operation.
36
- # @param mime_type [String]
37
- # Required only if async is true.
38
- # @param batch_size [Integer]
39
- # Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
40
- # @param destination [String]
41
- # Required only if async is true. A Google Cloud Storage location for storing the output.
42
- # @param image_context [Hash<Any>]
43
- # Optional. Image context and/or feature-specific parameters.
44
- # @yield [result, operation] Access the result along with the RPC operation
45
- # @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
46
- # @yieldparam operation [GRPC::ActiveCall::Operation]
47
- # @return [Google::Cloud::Vision::V1::BatchAnnotateImagesResponse, Google::Gax::Operation]
48
- # @example
49
- # require "google/cloud/vision"
50
- #
51
- # image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
52
- #
53
- # response = image_annotator_client.crop_hints_detection image: "path\to\image.png"
54
- # response.responses.each do |res|
55
- # puts res
56
- # end
57
-
58
- def crop_hints_detection \
59
- images: [],
60
- image: nil,
61
- max_results: 10,
62
- options: nil,
63
- async: false,
64
- mime_type: nil,
65
- batch_size: 10,
66
- destination: nil,
67
- image_context: nil,
68
- &blk
69
-
70
- feature = { type: :CROP_HINTS }
71
- feature[:max_results] = max_results
72
- images << image if image
73
-
74
- formatted_images = images.map do |img|
75
- formatted_image = normalize_image img
76
- formatted_image[:mime_type] = mime_type if mime_type
77
- formatted_image
78
- end
79
-
80
- requests = formatted_images.map do |img|
81
- request = {
82
- image: img,
83
- features: [feature]
84
- }
85
- request[:image_context] = image_context if image_context
86
- request
87
- end
88
-
89
- if async
90
- requests.map! do |request|
91
- {
92
- input_config: {
93
- gcs_source: {
94
- uri: request[:image][:source][:gcs_image_uri]
95
- },
96
- mime_type: mime_type
97
- },
98
- features: request[:features],
99
- output_config: {
100
- gcs_destination: {
101
- uri: destination
102
- },
103
- batch_size: batch_size
104
- }
105
- }
106
- end
107
- async_batch_annotate_files requests, options: options
108
- else
109
- batch_annotate_images requests, options: options, &blk
110
- end
111
- end
112
-
113
- # @param images [Array<String>, Array<File>]
114
- # An array containing files, file paths, io objects, image urls, or Google Cloud Storage urls. Can be used with or instead of image.
115
- # @param image [File, String]
116
- # A file, file path, io object, url pointing to an image, or Google Cloud Storage url. Can be used with or instead of images.
117
- # @param max_results [Integer]
118
- # Optional. Defaults to 10.
119
- # @param options [Google::Gax::CallOptions]
120
- # Optional. Overrides the default settings for this call, e.g, timeout,
121
- # retries, etc.
122
- # @param async [Boolean]
123
- # Optional. Defaults to false. Specifies whether to preform the request synchronously and return a
124
- # BatchAnnotateImagesResponse instance or to return a Google::Gax::Operation.
125
- # @param mime_type [String]
126
- # Required only if async is true.
127
- # @param batch_size [Integer]
128
- # Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
129
- # @param destination [String]
130
- # Required only if async is true. A Google Cloud Storage location for storing the output.
131
- # @param image_context [Hash<Any>]
132
- # Optional. Image context and/or feature-specific parameters.
133
- # @yield [result, operation] Access the result along with the RPC operation
134
- # @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
135
- # @yieldparam operation [GRPC::ActiveCall::Operation]
136
- # @return [Google::Cloud::Vision::V1::BatchAnnotateImagesResponse, Google::Gax::Operation]
137
- # @example
138
- # require "google/cloud/vision"
139
- #
140
- # image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
141
- #
142
- # response = image_annotator_client.document_text_detection image: "path\to\image.png"
143
- # response.responses.each do |res|
144
- # puts res
145
- # end
146
-
147
- def document_text_detection \
148
- images: [],
149
- image: nil,
150
- max_results: 10,
151
- options: nil,
152
- async: false,
153
- mime_type: nil,
154
- batch_size: 10,
155
- destination: nil,
156
- image_context: nil,
157
- &blk
158
-
159
- feature = { type: :DOCUMENT_TEXT_DETECTION }
160
- feature[:max_results] = max_results
161
- images << image if image
162
-
163
- formatted_images = images.map do |img|
164
- formatted_image = normalize_image img
165
- formatted_image[:mime_type] = mime_type if mime_type
166
- formatted_image
167
- end
168
-
169
- requests = formatted_images.map do |img|
170
- request = {
171
- image: img,
172
- features: [feature]
173
- }
174
- request[:image_context] = image_context if image_context
175
- request
176
- end
177
-
178
- if async
179
- requests.map! do |request|
180
- {
181
- input_config: {
182
- gcs_source: {
183
- uri: request[:image][:source][:gcs_image_uri]
184
- },
185
- mime_type: mime_type
186
- },
187
- features: request[:features],
188
- output_config: {
189
- gcs_destination: {
190
- uri: destination
191
- },
192
- batch_size: batch_size
193
- }
194
- }
195
- end
196
- async_batch_annotate_files requests, options: options
197
- else
198
- batch_annotate_images requests, options: options, &blk
199
- end
200
- end
201
-
202
- # @param images [Array<String>, Array<File>]
203
- # An array containing files, file paths, io objects, image urls, or Google Cloud Storage urls. Can be used with or instead of image.
204
- # @param image [File, String]
205
- # A file, file path, io object, url pointing to an image, or Google Cloud Storage url. Can be used with or instead of images.
206
- # @param max_results [Integer]
207
- # Optional. Defaults to 10.
208
- # @param options [Google::Gax::CallOptions]
209
- # Optional. Overrides the default settings for this call, e.g, timeout,
210
- # retries, etc.
211
- # @param async [Boolean]
212
- # Optional. Defaults to false. Specifies whether to preform the request synchronously and return a
213
- # BatchAnnotateImagesResponse instance or to return a Google::Gax::Operation.
214
- # @param mime_type [String]
215
- # Required only if async is true.
216
- # @param batch_size [Integer]
217
- # Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
218
- # @param destination [String]
219
- # Required only if async is true. A Google Cloud Storage location for storing the output.
220
- # @param image_context [Hash<Any>]
221
- # Optional. Image context and/or feature-specific parameters.
222
- # @yield [result, operation] Access the result along with the RPC operation
223
- # @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
224
- # @yieldparam operation [GRPC::ActiveCall::Operation]
225
- # @return [Google::Cloud::Vision::V1::BatchAnnotateImagesResponse, Google::Gax::Operation]
226
- # @example
227
- # require "google/cloud/vision"
228
- #
229
- # image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
230
- #
231
- # response = image_annotator_client.face_detection image: "path\to\image.png"
232
- # response.responses.each do |res|
233
- # puts res
234
- # end
235
-
236
- def face_detection \
237
- images: [],
238
- image: nil,
239
- max_results: 10,
240
- options: nil,
241
- async: false,
242
- mime_type: nil,
243
- batch_size: 10,
244
- destination: nil,
245
- image_context: nil,
246
- &blk
247
-
248
- feature = { type: :FACE_DETECTION }
249
- feature[:max_results] = max_results
250
- images << image if image
251
-
252
- formatted_images = images.map do |img|
253
- formatted_image = normalize_image img
254
- formatted_image[:mime_type] = mime_type if mime_type
255
- formatted_image
256
- end
257
-
258
- requests = formatted_images.map do |img|
259
- request = {
260
- image: img,
261
- features: [feature]
262
- }
263
- request[:image_context] = image_context if image_context
264
- request
265
- end
266
-
267
- if async
268
- requests.map! do |request|
269
- {
270
- input_config: {
271
- gcs_source: {
272
- uri: request[:image][:source][:gcs_image_uri]
273
- },
274
- mime_type: mime_type
275
- },
276
- features: request[:features],
277
- output_config: {
278
- gcs_destination: {
279
- uri: destination
280
- },
281
- batch_size: batch_size
282
- }
283
- }
284
- end
285
- async_batch_annotate_files requests, options: options
286
- else
287
- batch_annotate_images requests, options: options, &blk
288
- end
289
- end
290
-
291
- # @param images [Array<String>, Array<File>]
292
- # An array containing files, file paths, io objects, image urls, or Google Cloud Storage urls. Can be used with or instead of image.
293
- # @param image [File, String]
294
- # A file, file path, io object, url pointing to an image, or Google Cloud Storage url. Can be used with or instead of images.
295
- # @param max_results [Integer]
296
- # Optional. Defaults to 10.
297
- # @param options [Google::Gax::CallOptions]
298
- # Optional. Overrides the default settings for this call, e.g, timeout,
299
- # retries, etc.
300
- # @param async [Boolean]
301
- # Optional. Defaults to false. Specifies whether to preform the request synchronously and return a
302
- # BatchAnnotateImagesResponse instance or to return a Google::Gax::Operation.
303
- # @param mime_type [String]
304
- # Required only if async is true.
305
- # @param batch_size [Integer]
306
- # Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
307
- # @param destination [String]
308
- # Required only if async is true. A Google Cloud Storage location for storing the output.
309
- # @param image_context [Hash<Any>]
310
- # Optional. Image context and/or feature-specific parameters.
311
- # @yield [result, operation] Access the result along with the RPC operation
312
- # @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
313
- # @yieldparam operation [GRPC::ActiveCall::Operation]
314
- # @return [Google::Cloud::Vision::V1::BatchAnnotateImagesResponse, Google::Gax::Operation]
315
- # @example
316
- # require "google/cloud/vision"
317
- #
318
- # image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
319
- #
320
- # response = image_annotator_client.image_properties_detection image: "path\to\image.png"
321
- # response.responses.each do |res|
322
- # puts res
323
- # end
324
-
325
- def image_properties_detection \
326
- images: [],
327
- image: nil,
328
- max_results: 10,
329
- options: nil,
330
- async: false,
331
- mime_type: nil,
332
- batch_size: 10,
333
- destination: nil,
334
- image_context: nil,
335
- &blk
336
-
337
- feature = { type: :IMAGE_PROPERTIES }
338
- feature[:max_results] = max_results
339
- images << image if image
340
-
341
- formatted_images = images.map do |img|
342
- formatted_image = normalize_image img
343
- formatted_image[:mime_type] = mime_type if mime_type
344
- formatted_image
345
- end
346
-
347
- requests = formatted_images.map do |img|
348
- request = {
349
- image: img,
350
- features: [feature]
351
- }
352
- request[:image_context] = image_context if image_context
353
- request
354
- end
355
-
356
- if async
357
- requests.map! do |request|
358
- {
359
- input_config: {
360
- gcs_source: {
361
- uri: request[:image][:source][:gcs_image_uri]
362
- },
363
- mime_type: mime_type
364
- },
365
- features: request[:features],
366
- output_config: {
367
- gcs_destination: {
368
- uri: destination
369
- },
370
- batch_size: batch_size
371
- }
372
- }
373
- end
374
- async_batch_annotate_files requests, options: options
375
- else
376
- batch_annotate_images requests, options: options, &blk
377
- end
378
- end
379
-
380
- # @param images [Array<String>, Array<File>]
381
- # An array containing files, file paths, io objects, image urls, or Google Cloud Storage urls. Can be used with or instead of image.
382
- # @param image [File, String]
383
- # A file, file path, io object, url pointing to an image, or Google Cloud Storage url. Can be used with or instead of images.
384
- # @param max_results [Integer]
385
- # Optional. Defaults to 10.
386
- # @param options [Google::Gax::CallOptions]
387
- # Optional. Overrides the default settings for this call, e.g, timeout,
388
- # retries, etc.
389
- # @param async [Boolean]
390
- # Optional. Defaults to false. Specifies whether to preform the request synchronously and return a
391
- # BatchAnnotateImagesResponse instance or to return a Google::Gax::Operation.
392
- # @param mime_type [String]
393
- # Required only if async is true.
394
- # @param batch_size [Integer]
395
- # Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
396
- # @param destination [String]
397
- # Required only if async is true. A Google Cloud Storage location for storing the output.
398
- # @param image_context [Hash<Any>]
399
- # Optional. Image context and/or feature-specific parameters.
400
- # @yield [result, operation] Access the result along with the RPC operation
401
- # @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
402
- # @yieldparam operation [GRPC::ActiveCall::Operation]
403
- # @return [Google::Cloud::Vision::V1::BatchAnnotateImagesResponse, Google::Gax::Operation]
404
- # @example
405
- # require "google/cloud/vision"
406
- #
407
- # image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
408
- #
409
- # response = image_annotator_client.label_detection image: "path\to\image.png"
410
- # response.responses.each do |res|
411
- # puts res
412
- # end
413
-
414
- def label_detection \
415
- images: [],
416
- image: nil,
417
- max_results: 10,
418
- options: nil,
419
- async: false,
420
- mime_type: nil,
421
- batch_size: 10,
422
- destination: nil,
423
- image_context: nil,
424
- &blk
425
-
426
- feature = { type: :LABEL_DETECTION }
427
- feature[:max_results] = max_results
428
- images << image if image
429
-
430
- formatted_images = images.map do |img|
431
- formatted_image = normalize_image img
432
- formatted_image[:mime_type] = mime_type if mime_type
433
- formatted_image
434
- end
435
-
436
- requests = formatted_images.map do |img|
437
- request = {
438
- image: img,
439
- features: [feature]
440
- }
441
- request[:image_context] = image_context if image_context
442
- request
443
- end
444
-
445
- if async
446
- requests.map! do |request|
447
- {
448
- input_config: {
449
- gcs_source: {
450
- uri: request[:image][:source][:gcs_image_uri]
451
- },
452
- mime_type: mime_type
453
- },
454
- features: request[:features],
455
- output_config: {
456
- gcs_destination: {
457
- uri: destination
458
- },
459
- batch_size: batch_size
460
- }
461
- }
462
- end
463
- async_batch_annotate_files requests, options: options
464
- else
465
- batch_annotate_images requests, options: options, &blk
466
- end
467
- end
468
-
469
- # @param images [Array<String>, Array<File>]
470
- # An array containing files, file paths, io objects, image urls, or Google Cloud Storage urls. Can be used with or instead of image.
471
- # @param image [File, String]
472
- # A file, file path, io object, url pointing to an image, or Google Cloud Storage url. Can be used with or instead of images.
473
- # @param max_results [Integer]
474
- # Optional. Defaults to 10.
475
- # @param options [Google::Gax::CallOptions]
476
- # Optional. Overrides the default settings for this call, e.g, timeout,
477
- # retries, etc.
478
- # @param async [Boolean]
479
- # Optional. Defaults to false. Specifies whether to preform the request synchronously and return a
480
- # BatchAnnotateImagesResponse instance or to return a Google::Gax::Operation.
481
- # @param mime_type [String]
482
- # Required only if async is true.
483
- # @param batch_size [Integer]
484
- # Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
485
- # @param destination [String]
486
- # Required only if async is true. A Google Cloud Storage location for storing the output.
487
- # @param image_context [Hash<Any>]
488
- # Optional. Image context and/or feature-specific parameters.
489
- # @yield [result, operation] Access the result along with the RPC operation
490
- # @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
491
- # @yieldparam operation [GRPC::ActiveCall::Operation]
492
- # @return [Google::Cloud::Vision::V1::BatchAnnotateImagesResponse, Google::Gax::Operation]
493
- # @example
494
- # require "google/cloud/vision"
495
- #
496
- # image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
497
- #
498
- # response = image_annotator_client.landmark_detection image: "path\to\image.png"
499
- # response.responses.each do |res|
500
- # puts res
501
- # end
502
-
503
- def landmark_detection \
504
- images: [],
505
- image: nil,
506
- max_results: 10,
507
- options: nil,
508
- async: false,
509
- mime_type: nil,
510
- batch_size: 10,
511
- destination: nil,
512
- image_context: nil,
513
- &blk
514
-
515
- feature = { type: :LANDMARK_DETECTION }
516
- feature[:max_results] = max_results
517
- images << image if image
518
-
519
- formatted_images = images.map do |img|
520
- formatted_image = normalize_image img
521
- formatted_image[:mime_type] = mime_type if mime_type
522
- formatted_image
523
- end
524
-
525
- requests = formatted_images.map do |img|
526
- request = {
527
- image: img,
528
- features: [feature]
529
- }
530
- request[:image_context] = image_context if image_context
531
- request
532
- end
533
-
534
- if async
535
- requests.map! do |request|
536
- {
537
- input_config: {
538
- gcs_source: {
539
- uri: request[:image][:source][:gcs_image_uri]
540
- },
541
- mime_type: mime_type
542
- },
543
- features: request[:features],
544
- output_config: {
545
- gcs_destination: {
546
- uri: destination
547
- },
548
- batch_size: batch_size
549
- }
550
- }
551
- end
552
- async_batch_annotate_files requests, options: options
553
- else
554
- batch_annotate_images requests, options: options, &blk
555
- end
556
- end
557
-
558
- # @param images [Array<String>, Array<File>]
559
- # An array containing files, file paths, io objects, image urls, or Google Cloud Storage urls. Can be used with or instead of image.
560
- # @param image [File, String]
561
- # A file, file path, io object, url pointing to an image, or Google Cloud Storage url. Can be used with or instead of images.
562
- # @param max_results [Integer]
563
- # Optional. Defaults to 10.
564
- # @param options [Google::Gax::CallOptions]
565
- # Optional. Overrides the default settings for this call, e.g, timeout,
566
- # retries, etc.
567
- # @param async [Boolean]
568
- # Optional. Defaults to false. Specifies whether to preform the request synchronously and return a
569
- # BatchAnnotateImagesResponse instance or to return a Google::Gax::Operation.
570
- # @param mime_type [String]
571
- # Required only if async is true.
572
- # @param batch_size [Integer]
573
- # Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
574
- # @param destination [String]
575
- # Required only if async is true. A Google Cloud Storage location for storing the output.
576
- # @param image_context [Hash<Any>]
577
- # Optional. Image context and/or feature-specific parameters.
578
- # @yield [result, operation] Access the result along with the RPC operation
579
- # @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
580
- # @yieldparam operation [GRPC::ActiveCall::Operation]
581
- # @return [Google::Cloud::Vision::V1::BatchAnnotateImagesResponse, Google::Gax::Operation]
582
- # @example
583
- # require "google/cloud/vision"
584
- #
585
- # image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
586
- #
587
- # response = image_annotator_client.logo_detection image: "path\to\image.png"
588
- # response.responses.each do |res|
589
- # puts res
590
- # end
591
-
592
- def logo_detection \
593
- images: [],
594
- image: nil,
595
- max_results: 10,
596
- options: nil,
597
- async: false,
598
- mime_type: nil,
599
- batch_size: 10,
600
- destination: nil,
601
- image_context: nil,
602
- &blk
603
-
604
- feature = { type: :LOGO_DETECTION }
605
- feature[:max_results] = max_results
606
- images << image if image
607
-
608
- formatted_images = images.map do |img|
609
- formatted_image = normalize_image img
610
- formatted_image[:mime_type] = mime_type if mime_type
611
- formatted_image
612
- end
613
-
614
- requests = formatted_images.map do |img|
615
- request = {
616
- image: img,
617
- features: [feature]
618
- }
619
- request[:image_context] = image_context if image_context
620
- request
621
- end
622
-
623
- if async
624
- requests.map! do |request|
625
- {
626
- input_config: {
627
- gcs_source: {
628
- uri: request[:image][:source][:gcs_image_uri]
629
- },
630
- mime_type: mime_type
631
- },
632
- features: request[:features],
633
- output_config: {
634
- gcs_destination: {
635
- uri: destination
636
- },
637
- batch_size: batch_size
638
- }
639
- }
640
- end
641
- async_batch_annotate_files requests, options: options
642
- else
643
- batch_annotate_images requests, options: options, &blk
644
- end
645
- end
646
-
647
- # @param images [Array<String>, Array<File>]
648
- # An array containing files, file paths, io objects, image urls, or Google Cloud Storage urls. Can be used with or instead of image.
649
- # @param image [File, String]
650
- # A file, file path, io object, url pointing to an image, or Google Cloud Storage url. Can be used with or instead of images.
651
- # @param max_results [Integer]
652
- # Optional. Defaults to 10.
653
- # @param options [Google::Gax::CallOptions]
654
- # Optional. Overrides the default settings for this call, e.g, timeout,
655
- # retries, etc.
656
- # @param async [Boolean]
657
- # Optional. Defaults to false. Specifies whether to preform the request synchronously and return a
658
- # BatchAnnotateImagesResponse instance or to return a Google::Gax::Operation.
659
- # @param mime_type [String]
660
- # Required only if async is true.
661
- # @param batch_size [Integer]
662
- # Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
663
- # @param destination [String]
664
- # Required only if async is true. A Google Cloud Storage location for storing the output.
665
- # @param image_context [Hash<Any>]
666
- # Optional. Image context and/or feature-specific parameters.
667
- # @yield [result, operation] Access the result along with the RPC operation
668
- # @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
669
- # @yieldparam operation [GRPC::ActiveCall::Operation]
670
- # @return [Google::Cloud::Vision::V1::BatchAnnotateImagesResponse, Google::Gax::Operation]
671
- # @example
672
- # require "google/cloud/vision"
673
- #
674
- # image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
675
- #
676
- # response = image_annotator_client.object_localization_detection image: "path\to\image.png"
677
- # response.responses.each do |res|
678
- # puts res
679
- # end
680
-
681
- def object_localization_detection \
682
- images: [],
683
- image: nil,
684
- max_results: 10,
685
- options: nil,
686
- async: false,
687
- mime_type: nil,
688
- batch_size: 10,
689
- destination: nil,
690
- image_context: nil,
691
- &blk
692
-
693
- feature = { type: :OBJECT_LOCALIZATION }
694
- feature[:max_results] = max_results
695
- images << image if image
696
-
697
- formatted_images = images.map do |img|
698
- formatted_image = normalize_image img
699
- formatted_image[:mime_type] = mime_type if mime_type
700
- formatted_image
701
- end
702
-
703
- requests = formatted_images.map do |img|
704
- request = {
705
- image: img,
706
- features: [feature]
707
- }
708
- request[:image_context] = image_context if image_context
709
- request
710
- end
711
-
712
- if async
713
- requests.map! do |request|
714
- {
715
- input_config: {
716
- gcs_source: {
717
- uri: request[:image][:source][:gcs_image_uri]
718
- },
719
- mime_type: mime_type
720
- },
721
- features: request[:features],
722
- output_config: {
723
- gcs_destination: {
724
- uri: destination
725
- },
726
- batch_size: batch_size
727
- }
728
- }
729
- end
730
- async_batch_annotate_files requests, options: options
731
- else
732
- batch_annotate_images requests, options: options, &blk
733
- end
734
- end
735
-
736
- # @param images [Array<String>, Array<File>]
737
- # An array containing files, file paths, io objects, image urls, or Google Cloud Storage urls. Can be used with or instead of image.
738
- # @param image [File, String]
739
- # A file, file path, io object, url pointing to an image, or Google Cloud Storage url. Can be used with or instead of images.
740
- # @param max_results [Integer]
741
- # Optional. Defaults to 10.
742
- # @param options [Google::Gax::CallOptions]
743
- # Optional. Overrides the default settings for this call, e.g, timeout,
744
- # retries, etc.
745
- # @param async [Boolean]
746
- # Optional. Defaults to false. Specifies whether to preform the request synchronously and return a
747
- # BatchAnnotateImagesResponse instance or to return a Google::Gax::Operation.
748
- # @param mime_type [String]
749
- # Required only if async is true.
750
- # @param batch_size [Integer]
751
- # Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
752
- # @param destination [String]
753
- # Required only if async is true. A Google Cloud Storage location for storing the output.
754
- # @param image_context [Hash<Any>]
755
- # Optional. Image context and/or feature-specific parameters.
756
- # @yield [result, operation] Access the result along with the RPC operation
757
- # @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
758
- # @yieldparam operation [GRPC::ActiveCall::Operation]
759
- # @return [Google::Cloud::Vision::V1::BatchAnnotateImagesResponse, Google::Gax::Operation]
760
- # @example
761
- # require "google/cloud/vision"
762
- #
763
- # image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
764
- #
765
- # response = image_annotator_client.product_search_detection image: "path\to\image.png"
766
- # response.responses.each do |res|
767
- # puts res
768
- # end
769
-
770
- def product_search_detection \
771
- images: [],
772
- image: nil,
773
- max_results: 10,
774
- options: nil,
775
- async: false,
776
- mime_type: nil,
777
- batch_size: 10,
778
- destination: nil,
779
- image_context: nil,
780
- &blk
781
-
782
- feature = { type: :PRODUCT_SEARCH }
783
- feature[:max_results] = max_results
784
- images << image if image
785
-
786
- formatted_images = images.map do |img|
787
- formatted_image = normalize_image img
788
- formatted_image[:mime_type] = mime_type if mime_type
789
- formatted_image
790
- end
791
-
792
- requests = formatted_images.map do |img|
793
- request = {
794
- image: img,
795
- features: [feature]
796
- }
797
- request[:image_context] = image_context if image_context
798
- request
799
- end
800
-
801
- if async
802
- requests.map! do |request|
803
- {
804
- input_config: {
805
- gcs_source: {
806
- uri: request[:image][:source][:gcs_image_uri]
807
- },
808
- mime_type: mime_type
809
- },
810
- features: request[:features],
811
- output_config: {
812
- gcs_destination: {
813
- uri: destination
814
- },
815
- batch_size: batch_size
816
- }
817
- }
818
- end
819
- async_batch_annotate_files requests, options: options
820
- else
821
- batch_annotate_images requests, options: options, &blk
822
- end
823
- end
824
-
825
- # @param images [Array<String>, Array<File>]
826
- # An array containing files, file paths, io objects, image urls, or Google Cloud Storage urls. Can be used with or instead of image.
827
- # @param image [File, String]
828
- # A file, file path, io object, url pointing to an image, or Google Cloud Storage url. Can be used with or instead of images.
829
- # @param max_results [Integer]
830
- # Optional. Defaults to 10.
831
- # @param options [Google::Gax::CallOptions]
832
- # Optional. Overrides the default settings for this call, e.g, timeout,
833
- # retries, etc.
834
- # @param async [Boolean]
835
- # Optional. Defaults to false. Specifies whether to preform the request synchronously and return a
836
- # BatchAnnotateImagesResponse instance or to return a Google::Gax::Operation.
837
- # @param mime_type [String]
838
- # Required only if async is true.
839
- # @param batch_size [Integer]
840
- # Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
841
- # @param destination [String]
842
- # Required only if async is true. A Google Cloud Storage location for storing the output.
843
- # @param image_context [Hash<Any>]
844
- # Optional. Image context and/or feature-specific parameters.
845
- # @yield [result, operation] Access the result along with the RPC operation
846
- # @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
847
- # @yieldparam operation [GRPC::ActiveCall::Operation]
848
- # @return [Google::Cloud::Vision::V1::BatchAnnotateImagesResponse, Google::Gax::Operation]
849
- # @example
850
- # require "google/cloud/vision"
851
- #
852
- # image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
853
- #
854
- # response = image_annotator_client.safe_search_detection image: "path\to\image.png"
855
- # response.responses.each do |res|
856
- # puts res
857
- # end
858
-
859
- def safe_search_detection \
860
- images: [],
861
- image: nil,
862
- max_results: 10,
863
- options: nil,
864
- async: false,
865
- mime_type: nil,
866
- batch_size: 10,
867
- destination: nil,
868
- image_context: nil,
869
- &blk
870
-
871
- feature = { type: :SAFE_SEARCH_DETECTION }
872
- feature[:max_results] = max_results
873
- images << image if image
874
-
875
- formatted_images = images.map do |img|
876
- formatted_image = normalize_image img
877
- formatted_image[:mime_type] = mime_type if mime_type
878
- formatted_image
879
- end
880
-
881
- requests = formatted_images.map do |img|
882
- request = {
883
- image: img,
884
- features: [feature]
885
- }
886
- request[:image_context] = image_context if image_context
887
- request
888
- end
889
-
890
- if async
891
- requests.map! do |request|
892
- {
893
- input_config: {
894
- gcs_source: {
895
- uri: request[:image][:source][:gcs_image_uri]
896
- },
897
- mime_type: mime_type
898
- },
899
- features: request[:features],
900
- output_config: {
901
- gcs_destination: {
902
- uri: destination
903
- },
904
- batch_size: batch_size
905
- }
906
- }
907
- end
908
- async_batch_annotate_files requests, options: options
909
- else
910
- batch_annotate_images requests, options: options, &blk
911
- end
912
- end
913
-
914
- # @param images [Array<String>, Array<File>]
915
- # An array containing files, file paths, io objects, image urls, or Google Cloud Storage urls. Can be used with or instead of image.
916
- # @param image [File, String]
917
- # A file, file path, io object, url pointing to an image, or Google Cloud Storage url. Can be used with or instead of images.
918
- # @param max_results [Integer]
919
- # Optional. Defaults to 10.
920
- # @param options [Google::Gax::CallOptions]
921
- # Optional. Overrides the default settings for this call, e.g, timeout,
922
- # retries, etc.
923
- # @param async [Boolean]
924
- # Optional. Defaults to false. Specifies whether to preform the request synchronously and return a
925
- # BatchAnnotateImagesResponse instance or to return a Google::Gax::Operation.
926
- # @param mime_type [String]
927
- # Required only if async is true.
928
- # @param batch_size [Integer]
929
- # Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
930
- # @param destination [String]
931
- # Required only if async is true. A Google Cloud Storage location for storing the output.
932
- # @param image_context [Hash<Any>]
933
- # Optional. Image context and/or feature-specific parameters.
934
- # @yield [result, operation] Access the result along with the RPC operation
935
- # @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
936
- # @yieldparam operation [GRPC::ActiveCall::Operation]
937
- # @return [Google::Cloud::Vision::V1::BatchAnnotateImagesResponse, Google::Gax::Operation]
938
- # @example
939
- # require "google/cloud/vision"
940
- #
941
- # image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
942
- #
943
- # response = image_annotator_client.text_detection image: "path\to\image.png"
944
- # response.responses.each do |res|
945
- # puts res
946
- # end
947
-
948
- def text_detection \
949
- images: [],
950
- image: nil,
951
- max_results: 10,
952
- options: nil,
953
- async: false,
954
- mime_type: nil,
955
- batch_size: 10,
956
- destination: nil,
957
- image_context: nil,
958
- &blk
959
-
960
- feature = { type: :TEXT_DETECTION }
961
- feature[:max_results] = max_results
962
- images << image if image
963
-
964
- formatted_images = images.map do |img|
965
- formatted_image = normalize_image img
966
- formatted_image[:mime_type] = mime_type if mime_type
967
- formatted_image
968
- end
969
-
970
- requests = formatted_images.map do |img|
971
- request = {
972
- image: img,
973
- features: [feature]
974
- }
975
- request[:image_context] = image_context if image_context
976
- request
977
- end
978
-
979
- if async
980
- requests.map! do |request|
981
- {
982
- input_config: {
983
- gcs_source: {
984
- uri: request[:image][:source][:gcs_image_uri]
985
- },
986
- mime_type: mime_type
987
- },
988
- features: request[:features],
989
- output_config: {
990
- gcs_destination: {
991
- uri: destination
992
- },
993
- batch_size: batch_size
994
- }
995
- }
996
- end
997
- async_batch_annotate_files requests, options: options
998
- else
999
- batch_annotate_images requests, options: options, &blk
1000
- end
1001
- end
1002
-
1003
- # @param images [Array<String>, Array<File>]
1004
- # An array containing files, file paths, io objects, image urls, or Google Cloud Storage urls. Can be used with or instead of image.
1005
- # @param image [File, String]
1006
- # A file, file path, io object, url pointing to an image, or Google Cloud Storage url. Can be used with or instead of images.
1007
- # @param max_results [Integer]
1008
- # Optional. Defaults to 10.
1009
- # @param options [Google::Gax::CallOptions]
1010
- # Optional. Overrides the default settings for this call, e.g, timeout,
1011
- # retries, etc.
1012
- # @param async [Boolean]
1013
- # Optional. Defaults to false. Specifies whether to preform the request synchronously and return a
1014
- # BatchAnnotateImagesResponse instance or to return a Google::Gax::Operation.
1015
- # @param mime_type [String]
1016
- # Required only if async is true.
1017
- # @param batch_size [Integer]
1018
- # Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
1019
- # @param destination [String]
1020
- # Required only if async is true. A Google Cloud Storage location for storing the output.
1021
- # @param image_context [Hash<Any>]
1022
- # Optional. Image context and/or feature-specific parameters.
1023
- # @yield [result, operation] Access the result along with the RPC operation
1024
- # @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
1025
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1026
- # @return [Google::Cloud::Vision::V1::BatchAnnotateImagesResponse, Google::Gax::Operation]
1027
- # @example
1028
- # require "google/cloud/vision"
1029
- #
1030
- # image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
1031
- #
1032
- # response = image_annotator_client.web_detection image: "path\to\image.png"
1033
- # response.responses.each do |res|
1034
- # puts res
1035
- # end
1036
-
1037
- def web_detection \
1038
- images: [],
1039
- image: nil,
1040
- max_results: 10,
1041
- options: nil,
1042
- async: false,
1043
- mime_type: nil,
1044
- batch_size: 10,
1045
- destination: nil,
1046
- image_context: nil,
1047
- &blk
1048
-
1049
- feature = { type: :WEB_DETECTION }
1050
- feature[:max_results] = max_results
1051
- images << image if image
1052
-
1053
- formatted_images = images.map do |img|
1054
- formatted_image = normalize_image img
1055
- formatted_image[:mime_type] = mime_type if mime_type
1056
- formatted_image
1057
- end
1058
-
1059
- requests = formatted_images.map do |img|
1060
- request = {
1061
- image: img,
1062
- features: [feature]
1063
- }
1064
- request[:image_context] = image_context if image_context
1065
- request
1066
- end
1067
-
1068
- if async
1069
- requests.map! do |request|
1070
- {
1071
- input_config: {
1072
- gcs_source: {
1073
- uri: request[:image][:source][:gcs_image_uri]
1074
- },
1075
- mime_type: mime_type
1076
- },
1077
- features: request[:features],
1078
- output_config: {
1079
- gcs_destination: {
1080
- uri: destination
1081
- },
1082
- batch_size: batch_size
1083
- }
1084
- }
1085
- end
1086
- async_batch_annotate_files requests, options: options
1087
- else
1088
- batch_annotate_images requests, options: options, &blk
1089
- end
1090
- end
1091
-
1092
- private
1093
-
1094
- def normalize_image image
1095
- formatted_image =
1096
- if image.respond_to? :binmode
1097
- { content: image.binmode.read }
1098
- elsif image.is_a? String
1099
- if File.file? image
1100
- { content: File.binread(image) }
1101
- elsif image =~ URI::DEFAULT_PARSER.make_regexp
1102
- if URI(image).scheme == "gs"
1103
- { source: { gcs_image_uri: image } }
1104
- else
1105
- { source: { image_uri: image } }
1106
- end
1107
- end
1108
- end
1109
- raise TypeError.new("Image must be a filepath, url, or IO object") unless formatted_image
1110
- formatted_image
1111
- end
1112
- end
1113
-
1114
- class ProductSearchClient
1115
- # Alias for Google::Cloud::Vision::V1::ProductSearchClient.location_path.
1116
- # @param project [String]
1117
- # @param location [String]
1118
- # @return [String]
1119
- def location_path project, location
1120
- self.class.location_path project, location
1121
- end
1122
-
1123
- # Alias for Google::Cloud::Vision::V1::ProductSearchClient.product_path.
1124
- # @param project [String]
1125
- # @param location [String]
1126
- # @param product [String]
1127
- # @return [String]
1128
- def product_path project, location, product
1129
- self.class.product_path project, location, product
1130
- end
1131
-
1132
- # Alias for Google::Cloud::Vision::V1::ProductSearchClient.product_set_path.
1133
- # @param project [String]
1134
- # @param location [String]
1135
- # @param product_set [String]
1136
- # @return [String]
1137
- def product_set_path project, location, product_set
1138
- self.class.product_set_path project, location, product_set
1139
- end
1140
-
1141
- # Alias for Google::Cloud::Vision::V1::ProductSearchClient.reference_image_path.
1142
- # @param project [String]
1143
- # @param location [String]
1144
- # @param product [String]
1145
- # @param reference_image [String]
1146
- # @return [String]
1147
- def reference_image_path project, location, product, reference_image
1148
- self.class.reference_image_path project, location, product, reference_image
1149
- end
1150
- end
1151
- end
1152
- end
1153
- end
1154
- end