google-cloud-vision-v1 0.1.4 → 0.2.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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +6 -6
  3. data/README.md +5 -1
  4. data/lib/google/cloud/vision/v1.rb +1 -1
  5. data/lib/google/cloud/vision/v1/image_annotator.rb +1 -1
  6. data/lib/google/cloud/vision/v1/image_annotator/client.rb +117 -112
  7. data/lib/google/cloud/vision/v1/image_annotator/credentials.rb +1 -1
  8. data/lib/google/cloud/vision/v1/image_annotator/operations.rb +109 -103
  9. data/lib/google/cloud/vision/v1/image_annotator/paths.rb +3 -3
  10. data/lib/google/cloud/vision/v1/product_search.rb +4 -4
  11. data/lib/google/cloud/vision/v1/product_search/client.rb +386 -381
  12. data/lib/google/cloud/vision/v1/product_search/credentials.rb +1 -1
  13. data/lib/google/cloud/vision/v1/product_search/operations.rb +109 -103
  14. data/lib/google/cloud/vision/v1/product_search/paths.rb +12 -12
  15. data/lib/google/cloud/vision/v1/version.rb +1 -1
  16. data/proto_docs/google/api/resource.rb +12 -12
  17. data/proto_docs/google/cloud/vision/v1/geometry.rb +17 -17
  18. data/proto_docs/google/cloud/vision/v1/image_annotator.rb +204 -204
  19. data/proto_docs/google/cloud/vision/v1/product_search.rb +28 -28
  20. data/proto_docs/google/cloud/vision/v1/product_search_service.rb +144 -144
  21. data/proto_docs/google/cloud/vision/v1/text_annotation.rb +49 -49
  22. data/proto_docs/google/cloud/vision/v1/web_detection.rb +28 -28
  23. data/proto_docs/google/longrunning/operations.rb +30 -30
  24. data/proto_docs/google/protobuf/any.rb +4 -4
  25. data/proto_docs/google/protobuf/empty.rb +2 -2
  26. data/proto_docs/google/protobuf/field_mask.rb +3 -3
  27. data/proto_docs/google/protobuf/timestamp.rb +4 -4
  28. data/proto_docs/google/protobuf/wrappers.rb +27 -27
  29. data/proto_docs/google/rpc/status.rb +6 -6
  30. data/proto_docs/google/type/color.rb +6 -6
  31. data/proto_docs/google/type/latlng.rb +4 -4
  32. metadata +33 -6
  33. 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: 458a6014a23f7ec8cf96e5f865846aa07ddf3af3697e37a7bf84b634e5056c85
4
- data.tar.gz: 9e7d505b52b89ad5a0fd273998d5249d619e62f54e407587851c35d91d9bd85b
3
+ metadata.gz: 170964c4307606d76b3530e2447564f1641691135ab4c8382f45bf483f58b6d0
4
+ data.tar.gz: f9c11db4226960a554f1d69ce2d69614244eb7b1100fa913b4f88277457b163d
5
5
  SHA512:
6
- metadata.gz: 85c0e192a8e244ca170fd0ff82c0a6b5539038c32c23742321f560338642781808be506ac91e0d50f50075978176e5127a02bdd5300d090ba057fba51f121fe0
7
- data.tar.gz: 5cca6953e0989095a655ff39a32966da464b81fd986c47bbfb6bedba7b66b8c5fc2ac9d9ef2b47e1113215138913c9851bf6c322d7025886cee562db3a596a19
6
+ metadata.gz: c9cd0ef3ceaa55757c201231d3204f9e48abf1553ea67be2f3eeaa2c1f6ec45cba0171b7088dfaa548b98b6963534b0422c9c00435c465ff948789cd9fdf46c8
7
+ data.tar.gz: cb4db1f3e26fe5e27f1d09ab307a331871a5b8b9689be6a758fe8ed01a085b2c74fef6636fa4111afb3a082bae71a72c0d8e1233a86b7e9b0f4718cacc50831d
@@ -27,7 +27,7 @@ export VISION_CREDENTIALS=path/to/keyfile.json
27
27
  ```ruby
28
28
  require "google/cloud/vision/v1"
29
29
 
30
- client = Google::Cloud::Vision::V1::ProductSearch::Client.new
30
+ client = ::Google::Cloud::Vision::V1::ProductSearch::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-vision-v1
66
66
  checks for credentials are configured on the service Credentials class (such as
67
- {Google::Cloud::Vision::V1::ProductSearch::Credentials}):
67
+ {::Google::Cloud::Vision::V1::ProductSearch::Credentials}):
68
68
 
69
69
  1. `VISION_CREDENTIALS` - Path to JSON file, or JSON contents
70
70
  2. `VISION_KEYFILE` - Path to JSON file, or JSON contents
@@ -77,7 +77,7 @@ require "google/cloud/vision/v1"
77
77
 
78
78
  ENV["VISION_CREDENTIALS"] = "path/to/keyfile.json"
79
79
 
80
- client = Google::Cloud::Vision::V1::ProductSearch::Client.new
80
+ client = ::Google::Cloud::Vision::V1::ProductSearch::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/vision/v1"
90
90
 
91
- client = Google::Cloud::Vision::V1::ProductSearch::Client.new do |config|
91
+ client = ::Google::Cloud::Vision::V1::ProductSearch::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/vision/v1"
100
100
 
101
- Google::Cloud::Vision::V1::ProductSearch::Client.configure do |config|
101
+ ::Google::Cloud::Vision::V1::ProductSearch::Client.configure do |config|
102
102
  config.credentials = "path/to/keyfile.json"
103
103
  end
104
104
 
105
- client = Google::Cloud::Vision::V1::ProductSearch::Client.new
105
+ client = ::Google::Cloud::Vision::V1::ProductSearch::Client.new
106
106
  ```
107
107
 
108
108
  ### Cloud SDK
data/README.md CHANGED
@@ -18,6 +18,7 @@ In order to use this library, you first need to go through the following steps:
18
18
 
19
19
  1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
20
20
  1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
21
+ 1. [Enable the API.](https://console.cloud.google.com/apis/library/vision.googleapis.com)
21
22
  1. {file:AUTHENTICATION.md Set up authentication.}
22
23
 
23
24
  ## Quick Start
@@ -25,7 +26,7 @@ In order to use this library, you first need to go through the following steps:
25
26
  ```ruby
26
27
  require "google/cloud/vision/v1"
27
28
 
28
- client = Google::Cloud::Vision::V1::ProductSearch::Client.new
29
+ client = ::Google::Cloud::Vision::V1::ProductSearch::Client.new
29
30
  request = my_create_request
30
31
  response = client.create_product_set request
31
32
  ```
@@ -33,6 +34,9 @@ response = client.create_product_set request
33
34
  View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-vision-v1/latest)
34
35
  for class and method documentation.
35
36
 
37
+ See also the [Product Documentation](https://cloud.google.com/vision)
38
+ for general usage information.
39
+
36
40
  ## Enabling Logging
37
41
 
38
42
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
@@ -27,7 +27,7 @@ module Google
27
27
  # To load this package, including all its services, and instantiate a client:
28
28
  #
29
29
  # require "google/cloud/vision/v1"
30
- # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
30
+ # client = ::Google::Cloud::Vision::V1::ProductSearch::Client.new
31
31
  #
32
32
  module V1
33
33
  end
@@ -39,7 +39,7 @@ module Google
39
39
  # To load this service and instantiate a client:
40
40
  #
41
41
  # require "google/cloud/vision/v1/image_annotator"
42
- # client = Google::Cloud::Vision::V1::ImageAnnotator::Client.new
42
+ # client = ::Google::Cloud::Vision::V1::ImageAnnotator::Client.new
43
43
  #
44
44
  module ImageAnnotator
45
45
  end
@@ -40,15 +40,15 @@ module Google
40
40
  ##
41
41
  # Configure the ImageAnnotator Client class.
42
42
  #
43
- # See {Google::Cloud::Vision::V1::ImageAnnotator::Client::Configuration}
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
48
  # To modify the configuration for all ImageAnnotator clients:
49
49
  #
50
- # Google::Cloud::Vision::V1::ImageAnnotator::Client.configure do |config|
51
- # config.timeout = 10_000
50
+ # ::Google::Cloud::Vision::V1::ImageAnnotator::Client.configure do |config|
51
+ # config.timeout = 10.0
52
52
  # end
53
53
  #
54
54
  # @yield [config] Configure the Client client.
@@ -112,7 +112,7 @@ module Google
112
112
  # but structural changes (adding new fields, etc.) are not allowed. Structural changes
113
113
  # should be made on {Client.configure}.
114
114
  #
115
- # See {Google::Cloud::Vision::V1::ImageAnnotator::Client::Configuration}
115
+ # See {::Google::Cloud::Vision::V1::ImageAnnotator::Client::Configuration}
116
116
  # for a description of the configuration fields.
117
117
  #
118
118
  # @yield [config] Configure the Client client.
@@ -133,13 +133,13 @@ module Google
133
133
  # To create a new ImageAnnotator client with the default
134
134
  # configuration:
135
135
  #
136
- # client = Google::Cloud::Vision::V1::ImageAnnotator::Client.new
136
+ # client = ::Google::Cloud::Vision::V1::ImageAnnotator::Client.new
137
137
  #
138
138
  # To create a new ImageAnnotator client with a custom
139
139
  # configuration:
140
140
  #
141
- # client = Google::Cloud::Vision::V1::ImageAnnotator::Client.new do |config|
142
- # config.timeout = 10_000
141
+ # client = ::Google::Cloud::Vision::V1::ImageAnnotator::Client.new do |config|
142
+ # config.timeout = 10.0
143
143
  # end
144
144
  #
145
145
  # @yield [config] Configure the ImageAnnotator client.
@@ -164,15 +164,16 @@ module Google
164
164
  if credentials.is_a?(String) || credentials.is_a?(Hash)
165
165
  credentials = Credentials.new credentials, scope: @config.scope
166
166
  end
167
- @quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
167
+ @quota_project_id = @config.quota_project
168
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
168
169
 
169
170
  @operations_client = Operations.new do |config|
170
171
  config.credentials = credentials
171
172
  config.endpoint = @config.endpoint
172
173
  end
173
174
 
174
- @image_annotator_stub = Gapic::ServiceStub.new(
175
- Google::Cloud::Vision::V1::ImageAnnotator::Stub,
175
+ @image_annotator_stub = ::Gapic::ServiceStub.new(
176
+ ::Google::Cloud::Vision::V1::ImageAnnotator::Stub,
176
177
  credentials: credentials,
177
178
  endpoint: @config.endpoint,
178
179
  channel_args: @config.channel_args,
@@ -183,7 +184,7 @@ module Google
183
184
  ##
184
185
  # Get the associated client for long-running operations.
185
186
  #
186
- # @return [Google::Cloud::Vision::V1::ImageAnnotator::Operations]
187
+ # @return [::Google::Cloud::Vision::V1::ImageAnnotator::Operations]
187
188
  #
188
189
  attr_reader :operations_client
189
190
 
@@ -194,12 +195,12 @@ module Google
194
195
  #
195
196
  # @overload batch_annotate_images(request, options = nil)
196
197
  # Pass arguments to `batch_annotate_images` via a request object, either of type
197
- # {Google::Cloud::Vision::V1::BatchAnnotateImagesRequest} or an equivalent Hash.
198
+ # {::Google::Cloud::Vision::V1::BatchAnnotateImagesRequest} or an equivalent Hash.
198
199
  #
199
- # @param request [Google::Cloud::Vision::V1::BatchAnnotateImagesRequest, Hash]
200
+ # @param request [::Google::Cloud::Vision::V1::BatchAnnotateImagesRequest, ::Hash]
200
201
  # A request object representing the call parameters. Required. To specify no
201
202
  # parameters, or to keep all the default parameter values, pass an empty Hash.
202
- # @param options [Gapic::CallOptions, Hash]
203
+ # @param options [::Gapic::CallOptions, ::Hash]
203
204
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
204
205
  #
205
206
  # @overload batch_annotate_images(requests: nil, parent: nil)
@@ -207,9 +208,9 @@ module Google
207
208
  # least one keyword argument is required. To specify no parameters, or to keep all
208
209
  # the default parameter values, pass an empty Hash as a request object (see above).
209
210
  #
210
- # @param requests [Array<Google::Cloud::Vision::V1::AnnotateImageRequest, Hash>]
211
+ # @param requests [::Array<::Google::Cloud::Vision::V1::AnnotateImageRequest, ::Hash>]
211
212
  # Required. Individual image annotation requests for this batch.
212
- # @param parent [String]
213
+ # @param parent [::String]
213
214
  # Optional. Target project and location to make a call.
214
215
  #
215
216
  # Format: `projects/{project-id}/locations/{location-id}`.
@@ -224,26 +225,26 @@ module Google
224
225
  # Example: `projects/project-A/locations/eu`.
225
226
  #
226
227
  # @yield [response, operation] Access the result along with the RPC operation
227
- # @yieldparam response [Google::Cloud::Vision::V1::BatchAnnotateImagesResponse]
228
- # @yieldparam operation [GRPC::ActiveCall::Operation]
228
+ # @yieldparam response [::Google::Cloud::Vision::V1::BatchAnnotateImagesResponse]
229
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
229
230
  #
230
- # @return [Google::Cloud::Vision::V1::BatchAnnotateImagesResponse]
231
+ # @return [::Google::Cloud::Vision::V1::BatchAnnotateImagesResponse]
231
232
  #
232
- # @raise [Google::Cloud::Error] if the RPC is aborted.
233
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
233
234
  #
234
235
  def batch_annotate_images request, options = nil
235
- raise ArgumentError, "request must be provided" if request.nil?
236
+ raise ::ArgumentError, "request must be provided" if request.nil?
236
237
 
237
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Vision::V1::BatchAnnotateImagesRequest
238
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::BatchAnnotateImagesRequest
238
239
 
239
240
  # Converts hash and nil to an options object
240
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
241
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
241
242
 
242
243
  # Customize the options with defaults
243
244
  metadata = @config.rpcs.batch_annotate_images.metadata.to_h
244
245
 
245
246
  # Set x-goog-api-client and x-goog-user-project headers
246
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
247
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
247
248
  lib_name: @config.lib_name, lib_version: @config.lib_version,
248
249
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
249
250
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -258,8 +259,8 @@ module Google
258
259
  yield response, operation if block_given?
259
260
  return response
260
261
  end
261
- rescue GRPC::BadStatus => e
262
- raise Google::Cloud::Error.from_error(e)
262
+ rescue ::GRPC::BadStatus => e
263
+ raise ::Google::Cloud::Error.from_error(e)
263
264
  end
264
265
 
265
266
  ##
@@ -273,12 +274,12 @@ module Google
273
274
  #
274
275
  # @overload batch_annotate_files(request, options = nil)
275
276
  # Pass arguments to `batch_annotate_files` via a request object, either of type
276
- # {Google::Cloud::Vision::V1::BatchAnnotateFilesRequest} or an equivalent Hash.
277
+ # {::Google::Cloud::Vision::V1::BatchAnnotateFilesRequest} or an equivalent Hash.
277
278
  #
278
- # @param request [Google::Cloud::Vision::V1::BatchAnnotateFilesRequest, Hash]
279
+ # @param request [::Google::Cloud::Vision::V1::BatchAnnotateFilesRequest, ::Hash]
279
280
  # A request object representing the call parameters. Required. To specify no
280
281
  # parameters, or to keep all the default parameter values, pass an empty Hash.
281
- # @param options [Gapic::CallOptions, Hash]
282
+ # @param options [::Gapic::CallOptions, ::Hash]
282
283
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
283
284
  #
284
285
  # @overload batch_annotate_files(requests: nil, parent: nil)
@@ -286,10 +287,10 @@ module Google
286
287
  # least one keyword argument is required. To specify no parameters, or to keep all
287
288
  # the default parameter values, pass an empty Hash as a request object (see above).
288
289
  #
289
- # @param requests [Array<Google::Cloud::Vision::V1::AnnotateFileRequest, Hash>]
290
+ # @param requests [::Array<::Google::Cloud::Vision::V1::AnnotateFileRequest, ::Hash>]
290
291
  # Required. The list of file annotation requests. Right now we support only one
291
292
  # AnnotateFileRequest in BatchAnnotateFilesRequest.
292
- # @param parent [String]
293
+ # @param parent [::String]
293
294
  # Optional. Target project and location to make a call.
294
295
  #
295
296
  # Format: `projects/{project-id}/locations/{location-id}`.
@@ -304,26 +305,26 @@ module Google
304
305
  # Example: `projects/project-A/locations/eu`.
305
306
  #
306
307
  # @yield [response, operation] Access the result along with the RPC operation
307
- # @yieldparam response [Google::Cloud::Vision::V1::BatchAnnotateFilesResponse]
308
- # @yieldparam operation [GRPC::ActiveCall::Operation]
308
+ # @yieldparam response [::Google::Cloud::Vision::V1::BatchAnnotateFilesResponse]
309
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
309
310
  #
310
- # @return [Google::Cloud::Vision::V1::BatchAnnotateFilesResponse]
311
+ # @return [::Google::Cloud::Vision::V1::BatchAnnotateFilesResponse]
311
312
  #
312
- # @raise [Google::Cloud::Error] if the RPC is aborted.
313
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
313
314
  #
314
315
  def batch_annotate_files request, options = nil
315
- raise ArgumentError, "request must be provided" if request.nil?
316
+ raise ::ArgumentError, "request must be provided" if request.nil?
316
317
 
317
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Vision::V1::BatchAnnotateFilesRequest
318
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::BatchAnnotateFilesRequest
318
319
 
319
320
  # Converts hash and nil to an options object
320
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
321
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
321
322
 
322
323
  # Customize the options with defaults
323
324
  metadata = @config.rpcs.batch_annotate_files.metadata.to_h
324
325
 
325
326
  # Set x-goog-api-client and x-goog-user-project headers
326
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
327
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
327
328
  lib_name: @config.lib_name, lib_version: @config.lib_version,
328
329
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
329
330
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -338,8 +339,8 @@ module Google
338
339
  yield response, operation if block_given?
339
340
  return response
340
341
  end
341
- rescue GRPC::BadStatus => e
342
- raise Google::Cloud::Error.from_error(e)
342
+ rescue ::GRPC::BadStatus => e
343
+ raise ::Google::Cloud::Error.from_error(e)
343
344
  end
344
345
 
345
346
  ##
@@ -355,12 +356,12 @@ module Google
355
356
  #
356
357
  # @overload async_batch_annotate_images(request, options = nil)
357
358
  # Pass arguments to `async_batch_annotate_images` via a request object, either of type
358
- # {Google::Cloud::Vision::V1::AsyncBatchAnnotateImagesRequest} or an equivalent Hash.
359
+ # {::Google::Cloud::Vision::V1::AsyncBatchAnnotateImagesRequest} or an equivalent Hash.
359
360
  #
360
- # @param request [Google::Cloud::Vision::V1::AsyncBatchAnnotateImagesRequest, Hash]
361
+ # @param request [::Google::Cloud::Vision::V1::AsyncBatchAnnotateImagesRequest, ::Hash]
361
362
  # A request object representing the call parameters. Required. To specify no
362
363
  # parameters, or to keep all the default parameter values, pass an empty Hash.
363
- # @param options [Gapic::CallOptions, Hash]
364
+ # @param options [::Gapic::CallOptions, ::Hash]
364
365
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
365
366
  #
366
367
  # @overload async_batch_annotate_images(requests: nil, output_config: nil, parent: nil)
@@ -368,11 +369,11 @@ module Google
368
369
  # least one keyword argument is required. To specify no parameters, or to keep all
369
370
  # the default parameter values, pass an empty Hash as a request object (see above).
370
371
  #
371
- # @param requests [Array<Google::Cloud::Vision::V1::AnnotateImageRequest, Hash>]
372
+ # @param requests [::Array<::Google::Cloud::Vision::V1::AnnotateImageRequest, ::Hash>]
372
373
  # Required. Individual image annotation requests for this batch.
373
- # @param output_config [Google::Cloud::Vision::V1::OutputConfig, Hash]
374
+ # @param output_config [::Google::Cloud::Vision::V1::OutputConfig, ::Hash]
374
375
  # Required. The desired output location and metadata (e.g. format).
375
- # @param parent [String]
376
+ # @param parent [::String]
376
377
  # Optional. Target project and location to make a call.
377
378
  #
378
379
  # Format: `projects/{project-id}/locations/{location-id}`.
@@ -387,26 +388,26 @@ module Google
387
388
  # Example: `projects/project-A/locations/eu`.
388
389
  #
389
390
  # @yield [response, operation] Access the result along with the RPC operation
390
- # @yieldparam response [Gapic::Operation]
391
- # @yieldparam operation [GRPC::ActiveCall::Operation]
391
+ # @yieldparam response [::Gapic::Operation]
392
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
392
393
  #
393
- # @return [Gapic::Operation]
394
+ # @return [::Gapic::Operation]
394
395
  #
395
- # @raise [Google::Cloud::Error] if the RPC is aborted.
396
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
396
397
  #
397
398
  def async_batch_annotate_images request, options = nil
398
- raise ArgumentError, "request must be provided" if request.nil?
399
+ raise ::ArgumentError, "request must be provided" if request.nil?
399
400
 
400
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Vision::V1::AsyncBatchAnnotateImagesRequest
401
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::AsyncBatchAnnotateImagesRequest
401
402
 
402
403
  # Converts hash and nil to an options object
403
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
404
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
404
405
 
405
406
  # Customize the options with defaults
406
407
  metadata = @config.rpcs.async_batch_annotate_images.metadata.to_h
407
408
 
408
409
  # Set x-goog-api-client and x-goog-user-project headers
409
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
410
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
410
411
  lib_name: @config.lib_name, lib_version: @config.lib_version,
411
412
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
412
413
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -418,12 +419,12 @@ module Google
418
419
  retry_policy: @config.retry_policy
419
420
 
420
421
  @image_annotator_stub.call_rpc :async_batch_annotate_images, request, options: options do |response, operation|
421
- response = Gapic::Operation.new response, @operations_client, options: options
422
+ response = ::Gapic::Operation.new response, @operations_client, options: options
422
423
  yield response, operation if block_given?
423
424
  return response
424
425
  end
425
- rescue GRPC::BadStatus => e
426
- raise Google::Cloud::Error.from_error(e)
426
+ rescue ::GRPC::BadStatus => e
427
+ raise ::Google::Cloud::Error.from_error(e)
427
428
  end
428
429
 
429
430
  ##
@@ -436,12 +437,12 @@ module Google
436
437
  #
437
438
  # @overload async_batch_annotate_files(request, options = nil)
438
439
  # Pass arguments to `async_batch_annotate_files` via a request object, either of type
439
- # {Google::Cloud::Vision::V1::AsyncBatchAnnotateFilesRequest} or an equivalent Hash.
440
+ # {::Google::Cloud::Vision::V1::AsyncBatchAnnotateFilesRequest} or an equivalent Hash.
440
441
  #
441
- # @param request [Google::Cloud::Vision::V1::AsyncBatchAnnotateFilesRequest, Hash]
442
+ # @param request [::Google::Cloud::Vision::V1::AsyncBatchAnnotateFilesRequest, ::Hash]
442
443
  # A request object representing the call parameters. Required. To specify no
443
444
  # parameters, or to keep all the default parameter values, pass an empty Hash.
444
- # @param options [Gapic::CallOptions, Hash]
445
+ # @param options [::Gapic::CallOptions, ::Hash]
445
446
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
446
447
  #
447
448
  # @overload async_batch_annotate_files(requests: nil, parent: nil)
@@ -449,9 +450,9 @@ module Google
449
450
  # least one keyword argument is required. To specify no parameters, or to keep all
450
451
  # the default parameter values, pass an empty Hash as a request object (see above).
451
452
  #
452
- # @param requests [Array<Google::Cloud::Vision::V1::AsyncAnnotateFileRequest, Hash>]
453
+ # @param requests [::Array<::Google::Cloud::Vision::V1::AsyncAnnotateFileRequest, ::Hash>]
453
454
  # Required. Individual async file annotation requests for this batch.
454
- # @param parent [String]
455
+ # @param parent [::String]
455
456
  # Optional. Target project and location to make a call.
456
457
  #
457
458
  # Format: `projects/{project-id}/locations/{location-id}`.
@@ -466,26 +467,26 @@ module Google
466
467
  # Example: `projects/project-A/locations/eu`.
467
468
  #
468
469
  # @yield [response, operation] Access the result along with the RPC operation
469
- # @yieldparam response [Gapic::Operation]
470
- # @yieldparam operation [GRPC::ActiveCall::Operation]
470
+ # @yieldparam response [::Gapic::Operation]
471
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
471
472
  #
472
- # @return [Gapic::Operation]
473
+ # @return [::Gapic::Operation]
473
474
  #
474
- # @raise [Google::Cloud::Error] if the RPC is aborted.
475
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
475
476
  #
476
477
  def async_batch_annotate_files request, options = nil
477
- raise ArgumentError, "request must be provided" if request.nil?
478
+ raise ::ArgumentError, "request must be provided" if request.nil?
478
479
 
479
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Vision::V1::AsyncBatchAnnotateFilesRequest
480
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::AsyncBatchAnnotateFilesRequest
480
481
 
481
482
  # Converts hash and nil to an options object
482
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
483
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
483
484
 
484
485
  # Customize the options with defaults
485
486
  metadata = @config.rpcs.async_batch_annotate_files.metadata.to_h
486
487
 
487
488
  # Set x-goog-api-client and x-goog-user-project headers
488
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
489
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
489
490
  lib_name: @config.lib_name, lib_version: @config.lib_version,
490
491
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
491
492
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -497,12 +498,12 @@ module Google
497
498
  retry_policy: @config.retry_policy
498
499
 
499
500
  @image_annotator_stub.call_rpc :async_batch_annotate_files, request, options: options do |response, operation|
500
- response = Gapic::Operation.new response, @operations_client, options: options
501
+ response = ::Gapic::Operation.new response, @operations_client, options: options
501
502
  yield response, operation if block_given?
502
503
  return response
503
504
  end
504
- rescue GRPC::BadStatus => e
505
- raise Google::Cloud::Error.from_error(e)
505
+ rescue ::GRPC::BadStatus => e
506
+ raise ::Google::Cloud::Error.from_error(e)
506
507
  end
507
508
 
508
509
  ##
@@ -512,7 +513,7 @@ module Google
512
513
  # providing control over timeouts, retry behavior, logging, transport
513
514
  # parameters, and other low-level controls. Certain parameters can also be
514
515
  # applied individually to specific RPCs. See
515
- # {Google::Cloud::Vision::V1::ImageAnnotator::Client::Configuration::Rpcs}
516
+ # {::Google::Cloud::Vision::V1::ImageAnnotator::Client::Configuration::Rpcs}
516
517
  # for a list of RPCs that can be configured independently.
517
518
  #
518
519
  # Configuration can be applied globally to all clients, or to a single client
@@ -523,22 +524,22 @@ module Google
523
524
  # To modify the global config, setting the timeout for batch_annotate_images
524
525
  # to 20 seconds, and all remaining timeouts to 10 seconds:
525
526
  #
526
- # Google::Cloud::Vision::V1::ImageAnnotator::Client.configure do |config|
527
- # config.timeout = 10_000
528
- # config.rpcs.batch_annotate_images.timeout = 20_000
527
+ # ::Google::Cloud::Vision::V1::ImageAnnotator::Client.configure do |config|
528
+ # config.timeout = 10.0
529
+ # config.rpcs.batch_annotate_images.timeout = 20.0
529
530
  # end
530
531
  #
531
532
  # To apply the above configuration only to a new client:
532
533
  #
533
- # client = Google::Cloud::Vision::V1::ImageAnnotator::Client.new do |config|
534
- # config.timeout = 10_000
535
- # config.rpcs.batch_annotate_images.timeout = 20_000
534
+ # client = ::Google::Cloud::Vision::V1::ImageAnnotator::Client.new do |config|
535
+ # config.timeout = 10.0
536
+ # config.rpcs.batch_annotate_images.timeout = 20.0
536
537
  # end
537
538
  #
538
539
  # @!attribute [rw] endpoint
539
540
  # The hostname or hostname:port of the service endpoint.
540
541
  # Defaults to `"vision.googleapis.com"`.
541
- # @return [String]
542
+ # @return [::String]
542
543
  # @!attribute [rw] credentials
543
544
  # Credentials to send with calls. You may provide any of the following types:
544
545
  # * (`String`) The path to a service account key file in JSON format
@@ -550,29 +551,29 @@ module Google
550
551
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
551
552
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
552
553
  # * (`nil`) indicating no credentials
553
- # @return [Object]
554
+ # @return [::Object]
554
555
  # @!attribute [rw] scope
555
556
  # The OAuth scopes
556
- # @return [Array<String>]
557
+ # @return [::Array<::String>]
557
558
  # @!attribute [rw] lib_name
558
559
  # The library name as recorded in instrumentation and logging
559
- # @return [String]
560
+ # @return [::String]
560
561
  # @!attribute [rw] lib_version
561
562
  # The library version as recorded in instrumentation and logging
562
- # @return [String]
563
+ # @return [::String]
563
564
  # @!attribute [rw] channel_args
564
565
  # Extra parameters passed to the gRPC channel. Note: this is ignored if a
565
566
  # `GRPC::Core::Channel` object is provided as the credential.
566
- # @return [Hash]
567
+ # @return [::Hash]
567
568
  # @!attribute [rw] interceptors
568
569
  # An array of interceptors that are run before calls are executed.
569
- # @return [Array<GRPC::ClientInterceptor>]
570
+ # @return [::Array<::GRPC::ClientInterceptor>]
570
571
  # @!attribute [rw] timeout
571
- # The call timeout in milliseconds.
572
- # @return [Numeric]
572
+ # The call timeout in seconds.
573
+ # @return [::Numeric]
573
574
  # @!attribute [rw] metadata
574
575
  # Additional gRPC headers to be sent with the call.
575
- # @return [Hash{Symbol=>String}]
576
+ # @return [::Hash{::Symbol=>::String}]
576
577
  # @!attribute [rw] retry_policy
577
578
  # The retry policy. The value is a hash with the following keys:
578
579
  # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
@@ -580,25 +581,29 @@ module Google
580
581
  # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
581
582
  # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
582
583
  # trigger a retry.
583
- # @return [Hash]
584
+ # @return [::Hash]
585
+ # @!attribute [rw] quota_project
586
+ # A separate project against which to charge quota.
587
+ # @return [::String]
584
588
  #
585
589
  class Configuration
586
- extend Gapic::Config
590
+ extend ::Gapic::Config
587
591
 
588
- config_attr :endpoint, "vision.googleapis.com", String
589
- config_attr :credentials, nil do |value|
592
+ config_attr :endpoint, "vision.googleapis.com", ::String
593
+ config_attr :credentials, nil do |value|
590
594
  allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
591
595
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
592
596
  allowed.any? { |klass| klass === value }
593
597
  end
594
- config_attr :scope, nil, String, Array, nil
595
- config_attr :lib_name, nil, String, nil
596
- config_attr :lib_version, nil, String, nil
597
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
598
- config_attr :interceptors, nil, Array, nil
599
- config_attr :timeout, nil, Numeric, nil
600
- config_attr :metadata, nil, Hash, nil
601
- config_attr :retry_policy, nil, Hash, Proc, nil
598
+ config_attr :scope, nil, ::String, ::Array, nil
599
+ config_attr :lib_name, nil, ::String, nil
600
+ config_attr :lib_version, nil, ::String, nil
601
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
602
+ config_attr :interceptors, nil, ::Array, nil
603
+ config_attr :timeout, nil, ::Numeric, nil
604
+ config_attr :metadata, nil, ::Hash, nil
605
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
606
+ config_attr :quota_project, nil, ::String, nil
602
607
 
603
608
  # @private
604
609
  def initialize parent_config = nil
@@ -614,7 +619,7 @@ module Google
614
619
  def rpcs
615
620
  @rpcs ||= begin
616
621
  parent_rpcs = nil
617
- parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
622
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
618
623
  Rpcs.new parent_rpcs
619
624
  end
620
625
  end
@@ -639,35 +644,35 @@ module Google
639
644
  class Rpcs
640
645
  ##
641
646
  # RPC-specific configuration for `batch_annotate_images`
642
- # @return [Gapic::Config::Method]
647
+ # @return [::Gapic::Config::Method]
643
648
  #
644
649
  attr_reader :batch_annotate_images
645
650
  ##
646
651
  # RPC-specific configuration for `batch_annotate_files`
647
- # @return [Gapic::Config::Method]
652
+ # @return [::Gapic::Config::Method]
648
653
  #
649
654
  attr_reader :batch_annotate_files
650
655
  ##
651
656
  # RPC-specific configuration for `async_batch_annotate_images`
652
- # @return [Gapic::Config::Method]
657
+ # @return [::Gapic::Config::Method]
653
658
  #
654
659
  attr_reader :async_batch_annotate_images
655
660
  ##
656
661
  # RPC-specific configuration for `async_batch_annotate_files`
657
- # @return [Gapic::Config::Method]
662
+ # @return [::Gapic::Config::Method]
658
663
  #
659
664
  attr_reader :async_batch_annotate_files
660
665
 
661
666
  # @private
662
667
  def initialize parent_rpcs = nil
663
668
  batch_annotate_images_config = parent_rpcs&.batch_annotate_images if parent_rpcs&.respond_to? :batch_annotate_images
664
- @batch_annotate_images = Gapic::Config::Method.new batch_annotate_images_config
669
+ @batch_annotate_images = ::Gapic::Config::Method.new batch_annotate_images_config
665
670
  batch_annotate_files_config = parent_rpcs&.batch_annotate_files if parent_rpcs&.respond_to? :batch_annotate_files
666
- @batch_annotate_files = Gapic::Config::Method.new batch_annotate_files_config
671
+ @batch_annotate_files = ::Gapic::Config::Method.new batch_annotate_files_config
667
672
  async_batch_annotate_images_config = parent_rpcs&.async_batch_annotate_images if parent_rpcs&.respond_to? :async_batch_annotate_images
668
- @async_batch_annotate_images = Gapic::Config::Method.new async_batch_annotate_images_config
673
+ @async_batch_annotate_images = ::Gapic::Config::Method.new async_batch_annotate_images_config
669
674
  async_batch_annotate_files_config = parent_rpcs&.async_batch_annotate_files if parent_rpcs&.respond_to? :async_batch_annotate_files
670
- @async_batch_annotate_files = Gapic::Config::Method.new async_batch_annotate_files_config
675
+ @async_batch_annotate_files = ::Gapic::Config::Method.new async_batch_annotate_files_config
671
676
 
672
677
  yield self if block_given?
673
678
  end