google-cloud-vision-v1p3beta1 0.4.0 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,13 +43,12 @@ module Google
43
43
  # See {::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client::Configuration}
44
44
  # for a description of the configuration fields.
45
45
  #
46
- # ## Example
46
+ # @example
47
47
  #
48
- # To modify the configuration for all ImageAnnotator clients:
49
- #
50
- # ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.configure do |config|
51
- # config.timeout = 10.0
52
- # end
48
+ # # Modify the configuration for all ImageAnnotator clients
49
+ # ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
53
52
  #
54
53
  # @yield [config] Configure the Client client.
55
54
  # @yieldparam config [Client::Configuration]
@@ -62,25 +61,19 @@ module Google
62
61
  parent_config = while namespace.any?
63
62
  parent_name = namespace.join "::"
64
63
  parent_const = const_get parent_name
65
- break parent_const.configure if parent_const&.respond_to? :configure
64
+ break parent_const.configure if parent_const.respond_to? :configure
66
65
  namespace.pop
67
66
  end
68
67
  default_config = Client::Configuration.new parent_config
69
68
 
70
69
  default_config.rpcs.batch_annotate_images.timeout = 600.0
71
70
  default_config.rpcs.batch_annotate_images.retry_policy = {
72
- initial_delay: 0.1,
73
- max_delay: 60.0,
74
- multiplier: 1.3,
75
- retry_codes: [14, 4]
71
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
76
72
  }
77
73
 
78
74
  default_config.rpcs.async_batch_annotate_files.timeout = 600.0
79
75
  default_config.rpcs.async_batch_annotate_files.retry_policy = {
80
- initial_delay: 0.1,
81
- max_delay: 60.0,
82
- multiplier: 1.3,
83
- retry_codes: []
76
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
84
77
  }
85
78
 
86
79
  default_config
@@ -112,19 +105,15 @@ module Google
112
105
  ##
113
106
  # Create a new ImageAnnotator client object.
114
107
  #
115
- # ## Examples
116
- #
117
- # To create a new ImageAnnotator client with the default
118
- # configuration:
108
+ # @example
119
109
  #
120
- # client = ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.new
110
+ # # Create a client using the default configuration
111
+ # client = ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.new
121
112
  #
122
- # To create a new ImageAnnotator client with a custom
123
- # configuration:
124
- #
125
- # client = ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.new do |config|
126
- # config.timeout = 10.0
127
- # end
113
+ # # Create a client using a custom configuration
114
+ # client = ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.new do |config|
115
+ # config.timeout = 10.0
116
+ # end
128
117
  #
129
118
  # @yield [config] Configure the ImageAnnotator client.
130
119
  # @yieldparam config [Client::Configuration]
@@ -144,14 +133,13 @@ module Google
144
133
 
145
134
  # Create credentials
146
135
  credentials = @config.credentials
147
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
136
+ # Use self-signed JWT if the endpoint is unchanged from default,
148
137
  # but only if the default endpoint does not have a region prefix.
149
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
150
- @config.endpoint == Client.configure.endpoint &&
138
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
151
139
  !@config.endpoint.split(".").first.include?("-")
152
- credentials ||= Credentials.default scope: @config.scope,
140
+ credentials ||= Credentials.default scope: @config.scope,
153
141
  enable_self_signed_jwt: enable_self_signed_jwt
154
- if credentials.is_a?(String) || credentials.is_a?(Hash)
142
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
155
143
  credentials = Credentials.new credentials, scope: @config.scope
156
144
  end
157
145
  @quota_project_id = @config.quota_project
@@ -229,7 +217,9 @@ module Google
229
217
  options.apply_defaults timeout: @config.rpcs.batch_annotate_images.timeout,
230
218
  metadata: metadata,
231
219
  retry_policy: @config.rpcs.batch_annotate_images.retry_policy
232
- options.apply_defaults metadata: @config.metadata,
220
+
221
+ options.apply_defaults timeout: @config.timeout,
222
+ metadata: @config.metadata,
233
223
  retry_policy: @config.retry_policy
234
224
 
235
225
  @image_annotator_stub.call_rpc :batch_annotate_images, request, options: options do |response, operation|
@@ -294,7 +284,9 @@ module Google
294
284
  options.apply_defaults timeout: @config.rpcs.async_batch_annotate_files.timeout,
295
285
  metadata: metadata,
296
286
  retry_policy: @config.rpcs.async_batch_annotate_files.retry_policy
297
- options.apply_defaults metadata: @config.metadata,
287
+
288
+ options.apply_defaults timeout: @config.timeout,
289
+ metadata: @config.metadata,
298
290
  retry_policy: @config.retry_policy
299
291
 
300
292
  @image_annotator_stub.call_rpc :async_batch_annotate_files, request, options: options do |response, operation|
@@ -319,22 +311,21 @@ module Google
319
311
  # Configuration can be applied globally to all clients, or to a single client
320
312
  # on construction.
321
313
  #
322
- # # Examples
323
- #
324
- # To modify the global config, setting the timeout for batch_annotate_images
325
- # to 20 seconds, and all remaining timeouts to 10 seconds:
326
- #
327
- # ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.configure do |config|
328
- # config.timeout = 10.0
329
- # config.rpcs.batch_annotate_images.timeout = 20.0
330
- # end
314
+ # @example
331
315
  #
332
- # To apply the above configuration only to a new client:
316
+ # # Modify the global config, setting the timeout for
317
+ # # batch_annotate_images to 20 seconds,
318
+ # # and all remaining timeouts to 10 seconds.
319
+ # ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.configure do |config|
320
+ # config.timeout = 10.0
321
+ # config.rpcs.batch_annotate_images.timeout = 20.0
322
+ # end
333
323
  #
334
- # client = ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.new do |config|
335
- # config.timeout = 10.0
336
- # config.rpcs.batch_annotate_images.timeout = 20.0
337
- # end
324
+ # # Apply the above configuration only to a new client.
325
+ # client = ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.new do |config|
326
+ # config.timeout = 10.0
327
+ # config.rpcs.batch_annotate_images.timeout = 20.0
328
+ # end
338
329
  #
339
330
  # @!attribute [rw] endpoint
340
331
  # The hostname or hostname:port of the service endpoint.
@@ -398,7 +389,7 @@ module Google
398
389
  config_attr :scope, nil, ::String, ::Array, nil
399
390
  config_attr :lib_name, nil, ::String, nil
400
391
  config_attr :lib_version, nil, ::String, nil
401
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
392
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
402
393
  config_attr :interceptors, nil, ::Array, nil
403
394
  config_attr :timeout, nil, ::Numeric, nil
404
395
  config_attr :metadata, nil, ::Hash, nil
@@ -419,7 +410,7 @@ module Google
419
410
  def rpcs
420
411
  @rpcs ||= begin
421
412
  parent_rpcs = nil
422
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
413
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
423
414
  Rpcs.new parent_rpcs
424
415
  end
425
416
  end
@@ -455,9 +446,9 @@ module Google
455
446
 
456
447
  # @private
457
448
  def initialize parent_rpcs = nil
458
- batch_annotate_images_config = parent_rpcs&.batch_annotate_images if parent_rpcs&.respond_to? :batch_annotate_images
449
+ batch_annotate_images_config = parent_rpcs.batch_annotate_images if parent_rpcs.respond_to? :batch_annotate_images
459
450
  @batch_annotate_images = ::Gapic::Config::Method.new batch_annotate_images_config
460
- async_batch_annotate_files_config = parent_rpcs&.async_batch_annotate_files if parent_rpcs&.respond_to? :async_batch_annotate_files
451
+ async_batch_annotate_files_config = parent_rpcs.async_batch_annotate_files if parent_rpcs.respond_to? :async_batch_annotate_files
461
452
  @async_batch_annotate_files = ::Gapic::Config::Method.new async_batch_annotate_files_config
462
453
 
463
454
  yield self if block_given?
@@ -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
@@ -169,7 +169,9 @@ module Google
169
169
  options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
170
170
  metadata: metadata,
171
171
  retry_policy: @config.rpcs.list_operations.retry_policy
172
- options.apply_defaults metadata: @config.metadata,
172
+
173
+ options.apply_defaults timeout: @config.timeout,
174
+ metadata: @config.metadata,
173
175
  retry_policy: @config.retry_policy
174
176
 
175
177
  @operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
@@ -239,7 +241,9 @@ module Google
239
241
  options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
240
242
  metadata: metadata,
241
243
  retry_policy: @config.rpcs.get_operation.retry_policy
242
- options.apply_defaults metadata: @config.metadata,
244
+
245
+ options.apply_defaults timeout: @config.timeout,
246
+ metadata: @config.metadata,
243
247
  retry_policy: @config.retry_policy
244
248
 
245
249
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
@@ -309,7 +313,9 @@ module Google
309
313
  options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
310
314
  metadata: metadata,
311
315
  retry_policy: @config.rpcs.delete_operation.retry_policy
312
- options.apply_defaults metadata: @config.metadata,
316
+
317
+ options.apply_defaults timeout: @config.timeout,
318
+ metadata: @config.metadata,
313
319
  retry_policy: @config.retry_policy
314
320
 
315
321
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
@@ -384,7 +390,9 @@ module Google
384
390
  options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
385
391
  metadata: metadata,
386
392
  retry_policy: @config.rpcs.cancel_operation.retry_policy
387
- options.apply_defaults metadata: @config.metadata,
393
+
394
+ options.apply_defaults timeout: @config.timeout,
395
+ metadata: @config.metadata,
388
396
  retry_policy: @config.retry_policy
389
397
 
390
398
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
@@ -396,9 +404,9 @@ module Google
396
404
  end
397
405
 
398
406
  ##
399
- # Waits for the specified long-running operation until it is done or reaches
400
- # at most a specified timeout, returning the latest state. If the operation
401
- # is already done, the latest state is immediately returned. If the timeout
407
+ # Waits until the specified long-running operation is done or reaches at most
408
+ # a specified timeout, returning the latest state. If the operation is
409
+ # already done, the latest state is immediately returned. If the timeout
402
410
  # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
403
411
  # timeout is used. If the server does not support this method, it returns
404
412
  # `google.rpc.Code.UNIMPLEMENTED`.
@@ -456,7 +464,9 @@ module Google
456
464
  options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
457
465
  metadata: metadata,
458
466
  retry_policy: @config.rpcs.wait_operation.retry_policy
459
- options.apply_defaults metadata: @config.metadata,
467
+
468
+ options.apply_defaults timeout: @config.timeout,
469
+ metadata: @config.metadata,
460
470
  retry_policy: @config.retry_policy
461
471
 
462
472
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
@@ -481,22 +491,21 @@ module Google
481
491
  # Configuration can be applied globally to all clients, or to a single client
482
492
  # on construction.
483
493
  #
484
- # # Examples
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
494
+ # @example
493
495
  #
494
- # To apply the above configuration only to a new client:
496
+ # # Modify the global config, setting the timeout for
497
+ # # list_operations to 20 seconds,
498
+ # # and all remaining timeouts to 10 seconds.
499
+ # ::Google::Longrunning::Operations::Client.configure do |config|
500
+ # config.timeout = 10.0
501
+ # config.rpcs.list_operations.timeout = 20.0
502
+ # end
495
503
  #
496
- # client = ::Google::Longrunning::Operations::Client.new do |config|
497
- # config.timeout = 10.0
498
- # config.rpcs.list_operations.timeout = 20.0
499
- # end
504
+ # # Apply the above configuration only to a new client.
505
+ # client = ::Google::Longrunning::Operations::Client.new do |config|
506
+ # config.timeout = 10.0
507
+ # config.rpcs.list_operations.timeout = 20.0
508
+ # end
500
509
  #
501
510
  # @!attribute [rw] endpoint
502
511
  # The hostname or hostname:port of the service endpoint.
@@ -560,7 +569,7 @@ module Google
560
569
  config_attr :scope, nil, ::String, ::Array, nil
561
570
  config_attr :lib_name, nil, ::String, nil
562
571
  config_attr :lib_version, nil, ::String, nil
563
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
572
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
564
573
  config_attr :interceptors, nil, ::Array, nil
565
574
  config_attr :timeout, nil, ::Numeric, nil
566
575
  config_attr :metadata, nil, ::Hash, nil
@@ -581,7 +590,7 @@ module Google
581
590
  def rpcs
582
591
  @rpcs ||= begin
583
592
  parent_rpcs = nil
584
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
593
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
585
594
  Rpcs.new parent_rpcs
586
595
  end
587
596
  end
@@ -632,15 +641,15 @@ module Google
632
641
 
633
642
  # @private
634
643
  def initialize parent_rpcs = nil
635
- list_operations_config = parent_rpcs&.list_operations if parent_rpcs&.respond_to? :list_operations
644
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
636
645
  @list_operations = ::Gapic::Config::Method.new list_operations_config
637
- get_operation_config = parent_rpcs&.get_operation if parent_rpcs&.respond_to? :get_operation
646
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
638
647
  @get_operation = ::Gapic::Config::Method.new get_operation_config
639
- delete_operation_config = parent_rpcs&.delete_operation if parent_rpcs&.respond_to? :delete_operation
648
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
640
649
  @delete_operation = ::Gapic::Config::Method.new delete_operation_config
641
- cancel_operation_config = parent_rpcs&.cancel_operation if parent_rpcs&.respond_to? :cancel_operation
650
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
642
651
  @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
643
- wait_operation_config = parent_rpcs&.wait_operation if parent_rpcs&.respond_to? :wait_operation
652
+ wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
644
653
  @wait_operation = ::Gapic::Config::Method.new wait_operation_config
645
654
 
646
655
  yield self if block_given?
@@ -54,13 +54,12 @@ module Google
54
54
  # See {::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client::Configuration}
55
55
  # for a description of the configuration fields.
56
56
  #
57
- # ## Example
57
+ # @example
58
58
  #
59
- # To modify the configuration for all ProductSearch clients:
60
- #
61
- # ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.configure do |config|
62
- # config.timeout = 10.0
63
- # end
59
+ # # Modify the configuration for all ProductSearch clients
60
+ # ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.configure do |config|
61
+ # config.timeout = 10.0
62
+ # end
64
63
  #
65
64
  # @yield [config] Configure the Client client.
66
65
  # @yieldparam config [Client::Configuration]
@@ -73,153 +72,99 @@ module Google
73
72
  parent_config = while namespace.any?
74
73
  parent_name = namespace.join "::"
75
74
  parent_const = const_get parent_name
76
- break parent_const.configure if parent_const&.respond_to? :configure
75
+ break parent_const.configure if parent_const.respond_to? :configure
77
76
  namespace.pop
78
77
  end
79
78
  default_config = Client::Configuration.new parent_config
80
79
 
81
80
  default_config.rpcs.create_product_set.timeout = 600.0
82
81
  default_config.rpcs.create_product_set.retry_policy = {
83
- initial_delay: 0.1,
84
- max_delay: 60.0,
85
- multiplier: 1.3,
86
- retry_codes: []
82
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
87
83
  }
88
84
 
89
85
  default_config.rpcs.list_product_sets.timeout = 600.0
90
86
  default_config.rpcs.list_product_sets.retry_policy = {
91
- initial_delay: 0.1,
92
- max_delay: 60.0,
93
- multiplier: 1.3,
94
- retry_codes: [14, 4]
87
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
95
88
  }
96
89
 
97
90
  default_config.rpcs.get_product_set.timeout = 600.0
98
91
  default_config.rpcs.get_product_set.retry_policy = {
99
- initial_delay: 0.1,
100
- max_delay: 60.0,
101
- multiplier: 1.3,
102
- retry_codes: [14, 4]
92
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
103
93
  }
104
94
 
105
95
  default_config.rpcs.update_product_set.timeout = 600.0
106
96
  default_config.rpcs.update_product_set.retry_policy = {
107
- initial_delay: 0.1,
108
- max_delay: 60.0,
109
- multiplier: 1.3,
110
- retry_codes: []
97
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
111
98
  }
112
99
 
113
100
  default_config.rpcs.delete_product_set.timeout = 600.0
114
101
  default_config.rpcs.delete_product_set.retry_policy = {
115
- initial_delay: 0.1,
116
- max_delay: 60.0,
117
- multiplier: 1.3,
118
- retry_codes: [14, 4]
102
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
119
103
  }
120
104
 
121
105
  default_config.rpcs.create_product.timeout = 600.0
122
106
  default_config.rpcs.create_product.retry_policy = {
123
- initial_delay: 0.1,
124
- max_delay: 60.0,
125
- multiplier: 1.3,
126
- retry_codes: []
107
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
127
108
  }
128
109
 
129
110
  default_config.rpcs.list_products.timeout = 600.0
130
111
  default_config.rpcs.list_products.retry_policy = {
131
- initial_delay: 0.1,
132
- max_delay: 60.0,
133
- multiplier: 1.3,
134
- retry_codes: [14, 4]
112
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
135
113
  }
136
114
 
137
115
  default_config.rpcs.get_product.timeout = 600.0
138
116
  default_config.rpcs.get_product.retry_policy = {
139
- initial_delay: 0.1,
140
- max_delay: 60.0,
141
- multiplier: 1.3,
142
- retry_codes: [14, 4]
117
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
143
118
  }
144
119
 
145
120
  default_config.rpcs.update_product.timeout = 600.0
146
121
  default_config.rpcs.update_product.retry_policy = {
147
- initial_delay: 0.1,
148
- max_delay: 60.0,
149
- multiplier: 1.3,
150
- retry_codes: []
122
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
151
123
  }
152
124
 
153
125
  default_config.rpcs.delete_product.timeout = 600.0
154
126
  default_config.rpcs.delete_product.retry_policy = {
155
- initial_delay: 0.1,
156
- max_delay: 60.0,
157
- multiplier: 1.3,
158
- retry_codes: [14, 4]
127
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
159
128
  }
160
129
 
161
130
  default_config.rpcs.create_reference_image.timeout = 600.0
162
131
  default_config.rpcs.create_reference_image.retry_policy = {
163
- initial_delay: 0.1,
164
- max_delay: 60.0,
165
- multiplier: 1.3,
166
- retry_codes: []
132
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
167
133
  }
168
134
 
169
135
  default_config.rpcs.delete_reference_image.timeout = 600.0
170
136
  default_config.rpcs.delete_reference_image.retry_policy = {
171
- initial_delay: 0.1,
172
- max_delay: 60.0,
173
- multiplier: 1.3,
174
- retry_codes: [14, 4]
137
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
175
138
  }
176
139
 
177
140
  default_config.rpcs.list_reference_images.timeout = 600.0
178
141
  default_config.rpcs.list_reference_images.retry_policy = {
179
- initial_delay: 0.1,
180
- max_delay: 60.0,
181
- multiplier: 1.3,
182
- retry_codes: [14, 4]
142
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
183
143
  }
184
144
 
185
145
  default_config.rpcs.get_reference_image.timeout = 600.0
186
146
  default_config.rpcs.get_reference_image.retry_policy = {
187
- initial_delay: 0.1,
188
- max_delay: 60.0,
189
- multiplier: 1.3,
190
- retry_codes: [14, 4]
147
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
191
148
  }
192
149
 
193
150
  default_config.rpcs.add_product_to_product_set.timeout = 600.0
194
151
  default_config.rpcs.add_product_to_product_set.retry_policy = {
195
- initial_delay: 0.1,
196
- max_delay: 60.0,
197
- multiplier: 1.3,
198
- retry_codes: []
152
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
199
153
  }
200
154
 
201
155
  default_config.rpcs.remove_product_from_product_set.timeout = 600.0
202
156
  default_config.rpcs.remove_product_from_product_set.retry_policy = {
203
- initial_delay: 0.1,
204
- max_delay: 60.0,
205
- multiplier: 1.3,
206
- retry_codes: []
157
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
207
158
  }
208
159
 
209
160
  default_config.rpcs.list_products_in_product_set.timeout = 600.0
210
161
  default_config.rpcs.list_products_in_product_set.retry_policy = {
211
- initial_delay: 0.1,
212
- max_delay: 60.0,
213
- multiplier: 1.3,
214
- retry_codes: [14, 4]
162
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
215
163
  }
216
164
 
217
165
  default_config.rpcs.import_product_sets.timeout = 600.0
218
166
  default_config.rpcs.import_product_sets.retry_policy = {
219
- initial_delay: 0.1,
220
- max_delay: 60.0,
221
- multiplier: 1.3,
222
- retry_codes: []
167
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
223
168
  }
224
169
 
225
170
  default_config
@@ -251,19 +196,15 @@ module Google
251
196
  ##
252
197
  # Create a new ProductSearch client object.
253
198
  #
254
- # ## Examples
255
- #
256
- # To create a new ProductSearch client with the default
257
- # configuration:
258
- #
259
- # client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
199
+ # @example
260
200
  #
261
- # To create a new ProductSearch client with a custom
262
- # configuration:
201
+ # # Create a client using the default configuration
202
+ # client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
263
203
  #
264
- # client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new do |config|
265
- # config.timeout = 10.0
266
- # end
204
+ # # Create a client using a custom configuration
205
+ # client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new do |config|
206
+ # config.timeout = 10.0
207
+ # end
267
208
  #
268
209
  # @yield [config] Configure the ProductSearch client.
269
210
  # @yieldparam config [Client::Configuration]
@@ -283,14 +224,13 @@ module Google
283
224
 
284
225
  # Create credentials
285
226
  credentials = @config.credentials
286
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
227
+ # Use self-signed JWT if the endpoint is unchanged from default,
287
228
  # but only if the default endpoint does not have a region prefix.
288
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
289
- @config.endpoint == Client.configure.endpoint &&
229
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
290
230
  !@config.endpoint.split(".").first.include?("-")
291
- credentials ||= Credentials.default scope: @config.scope,
231
+ credentials ||= Credentials.default scope: @config.scope,
292
232
  enable_self_signed_jwt: enable_self_signed_jwt
293
- if credentials.is_a?(String) || credentials.is_a?(Hash)
233
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
294
234
  credentials = Credentials.new credentials, scope: @config.scope
295
235
  end
296
236
  @quota_project_id = @config.quota_project
@@ -388,7 +328,9 @@ module Google
388
328
  options.apply_defaults timeout: @config.rpcs.create_product_set.timeout,
389
329
  metadata: metadata,
390
330
  retry_policy: @config.rpcs.create_product_set.retry_policy
391
- options.apply_defaults metadata: @config.metadata,
331
+
332
+ options.apply_defaults timeout: @config.timeout,
333
+ metadata: @config.metadata,
392
334
  retry_policy: @config.retry_policy
393
335
 
394
336
  @product_search_stub.call_rpc :create_product_set, request, options: options do |response, operation|
@@ -465,7 +407,9 @@ module Google
465
407
  options.apply_defaults timeout: @config.rpcs.list_product_sets.timeout,
466
408
  metadata: metadata,
467
409
  retry_policy: @config.rpcs.list_product_sets.retry_policy
468
- options.apply_defaults metadata: @config.metadata,
410
+
411
+ options.apply_defaults timeout: @config.timeout,
412
+ metadata: @config.metadata,
469
413
  retry_policy: @config.retry_policy
470
414
 
471
415
  @product_search_stub.call_rpc :list_product_sets, request, options: options do |response, operation|
@@ -539,7 +483,9 @@ module Google
539
483
  options.apply_defaults timeout: @config.rpcs.get_product_set.timeout,
540
484
  metadata: metadata,
541
485
  retry_policy: @config.rpcs.get_product_set.retry_policy
542
- options.apply_defaults metadata: @config.metadata,
486
+
487
+ options.apply_defaults timeout: @config.timeout,
488
+ metadata: @config.metadata,
543
489
  retry_policy: @config.retry_policy
544
490
 
545
491
  @product_search_stub.call_rpc :get_product_set, request, options: options do |response, operation|
@@ -617,7 +563,9 @@ module Google
617
563
  options.apply_defaults timeout: @config.rpcs.update_product_set.timeout,
618
564
  metadata: metadata,
619
565
  retry_policy: @config.rpcs.update_product_set.retry_policy
620
- options.apply_defaults metadata: @config.metadata,
566
+
567
+ options.apply_defaults timeout: @config.timeout,
568
+ metadata: @config.metadata,
621
569
  retry_policy: @config.retry_policy
622
570
 
623
571
  @product_search_stub.call_rpc :update_product_set, request, options: options do |response, operation|
@@ -693,7 +641,9 @@ module Google
693
641
  options.apply_defaults timeout: @config.rpcs.delete_product_set.timeout,
694
642
  metadata: metadata,
695
643
  retry_policy: @config.rpcs.delete_product_set.retry_policy
696
- options.apply_defaults metadata: @config.metadata,
644
+
645
+ options.apply_defaults timeout: @config.timeout,
646
+ metadata: @config.metadata,
697
647
  retry_policy: @config.retry_policy
698
648
 
699
649
  @product_search_stub.call_rpc :delete_product_set, request, options: options do |response, operation|
@@ -776,7 +726,9 @@ module Google
776
726
  options.apply_defaults timeout: @config.rpcs.create_product.timeout,
777
727
  metadata: metadata,
778
728
  retry_policy: @config.rpcs.create_product.retry_policy
779
- options.apply_defaults metadata: @config.metadata,
729
+
730
+ options.apply_defaults timeout: @config.timeout,
731
+ metadata: @config.metadata,
780
732
  retry_policy: @config.retry_policy
781
733
 
782
734
  @product_search_stub.call_rpc :create_product, request, options: options do |response, operation|
@@ -853,7 +805,9 @@ module Google
853
805
  options.apply_defaults timeout: @config.rpcs.list_products.timeout,
854
806
  metadata: metadata,
855
807
  retry_policy: @config.rpcs.list_products.retry_policy
856
- options.apply_defaults metadata: @config.metadata,
808
+
809
+ options.apply_defaults timeout: @config.timeout,
810
+ metadata: @config.metadata,
857
811
  retry_policy: @config.retry_policy
858
812
 
859
813
  @product_search_stub.call_rpc :list_products, request, options: options do |response, operation|
@@ -927,7 +881,9 @@ module Google
927
881
  options.apply_defaults timeout: @config.rpcs.get_product.timeout,
928
882
  metadata: metadata,
929
883
  retry_policy: @config.rpcs.get_product.retry_policy
930
- options.apply_defaults metadata: @config.metadata,
884
+
885
+ options.apply_defaults timeout: @config.timeout,
886
+ metadata: @config.metadata,
931
887
  retry_policy: @config.retry_policy
932
888
 
933
889
  @product_search_stub.call_rpc :get_product, request, options: options do |response, operation|
@@ -1013,7 +969,9 @@ module Google
1013
969
  options.apply_defaults timeout: @config.rpcs.update_product.timeout,
1014
970
  metadata: metadata,
1015
971
  retry_policy: @config.rpcs.update_product.retry_policy
1016
- options.apply_defaults metadata: @config.metadata,
972
+
973
+ options.apply_defaults timeout: @config.timeout,
974
+ metadata: @config.metadata,
1017
975
  retry_policy: @config.retry_policy
1018
976
 
1019
977
  @product_search_stub.call_rpc :update_product, request, options: options do |response, operation|
@@ -1090,7 +1048,9 @@ module Google
1090
1048
  options.apply_defaults timeout: @config.rpcs.delete_product.timeout,
1091
1049
  metadata: metadata,
1092
1050
  retry_policy: @config.rpcs.delete_product.retry_policy
1093
- options.apply_defaults metadata: @config.metadata,
1051
+
1052
+ options.apply_defaults timeout: @config.timeout,
1053
+ metadata: @config.metadata,
1094
1054
  retry_policy: @config.retry_policy
1095
1055
 
1096
1056
  @product_search_stub.call_rpc :delete_product, request, options: options do |response, operation|
@@ -1185,7 +1145,9 @@ module Google
1185
1145
  options.apply_defaults timeout: @config.rpcs.create_reference_image.timeout,
1186
1146
  metadata: metadata,
1187
1147
  retry_policy: @config.rpcs.create_reference_image.retry_policy
1188
- options.apply_defaults metadata: @config.metadata,
1148
+
1149
+ options.apply_defaults timeout: @config.timeout,
1150
+ metadata: @config.metadata,
1189
1151
  retry_policy: @config.retry_policy
1190
1152
 
1191
1153
  @product_search_stub.call_rpc :create_reference_image, request, options: options do |response, operation|
@@ -1265,7 +1227,9 @@ module Google
1265
1227
  options.apply_defaults timeout: @config.rpcs.delete_reference_image.timeout,
1266
1228
  metadata: metadata,
1267
1229
  retry_policy: @config.rpcs.delete_reference_image.retry_policy
1268
- options.apply_defaults metadata: @config.metadata,
1230
+
1231
+ options.apply_defaults timeout: @config.timeout,
1232
+ metadata: @config.metadata,
1269
1233
  retry_policy: @config.retry_policy
1270
1234
 
1271
1235
  @product_search_stub.call_rpc :delete_reference_image, request, options: options do |response, operation|
@@ -1347,7 +1311,9 @@ module Google
1347
1311
  options.apply_defaults timeout: @config.rpcs.list_reference_images.timeout,
1348
1312
  metadata: metadata,
1349
1313
  retry_policy: @config.rpcs.list_reference_images.retry_policy
1350
- options.apply_defaults metadata: @config.metadata,
1314
+
1315
+ options.apply_defaults timeout: @config.timeout,
1316
+ metadata: @config.metadata,
1351
1317
  retry_policy: @config.retry_policy
1352
1318
 
1353
1319
  @product_search_stub.call_rpc :list_reference_images, request, options: options do |response, operation|
@@ -1422,7 +1388,9 @@ module Google
1422
1388
  options.apply_defaults timeout: @config.rpcs.get_reference_image.timeout,
1423
1389
  metadata: metadata,
1424
1390
  retry_policy: @config.rpcs.get_reference_image.retry_policy
1425
- options.apply_defaults metadata: @config.metadata,
1391
+
1392
+ options.apply_defaults timeout: @config.timeout,
1393
+ metadata: @config.metadata,
1426
1394
  retry_policy: @config.retry_policy
1427
1395
 
1428
1396
  @product_search_stub.call_rpc :get_reference_image, request, options: options do |response, operation|
@@ -1503,7 +1471,9 @@ module Google
1503
1471
  options.apply_defaults timeout: @config.rpcs.add_product_to_product_set.timeout,
1504
1472
  metadata: metadata,
1505
1473
  retry_policy: @config.rpcs.add_product_to_product_set.retry_policy
1506
- options.apply_defaults metadata: @config.metadata,
1474
+
1475
+ options.apply_defaults timeout: @config.timeout,
1476
+ metadata: @config.metadata,
1507
1477
  retry_policy: @config.retry_policy
1508
1478
 
1509
1479
  @product_search_stub.call_rpc :add_product_to_product_set, request, options: options do |response, operation|
@@ -1581,7 +1551,9 @@ module Google
1581
1551
  options.apply_defaults timeout: @config.rpcs.remove_product_from_product_set.timeout,
1582
1552
  metadata: metadata,
1583
1553
  retry_policy: @config.rpcs.remove_product_from_product_set.retry_policy
1584
- options.apply_defaults metadata: @config.metadata,
1554
+
1555
+ options.apply_defaults timeout: @config.timeout,
1556
+ metadata: @config.metadata,
1585
1557
  retry_policy: @config.retry_policy
1586
1558
 
1587
1559
  @product_search_stub.call_rpc :remove_product_from_product_set, request, options: options do |response, operation|
@@ -1660,7 +1632,9 @@ module Google
1660
1632
  options.apply_defaults timeout: @config.rpcs.list_products_in_product_set.timeout,
1661
1633
  metadata: metadata,
1662
1634
  retry_policy: @config.rpcs.list_products_in_product_set.retry_policy
1663
- options.apply_defaults metadata: @config.metadata,
1635
+
1636
+ options.apply_defaults timeout: @config.timeout,
1637
+ metadata: @config.metadata,
1664
1638
  retry_policy: @config.retry_policy
1665
1639
 
1666
1640
  @product_search_stub.call_rpc :list_products_in_product_set, request, options: options do |response, operation|
@@ -1741,7 +1715,9 @@ module Google
1741
1715
  options.apply_defaults timeout: @config.rpcs.import_product_sets.timeout,
1742
1716
  metadata: metadata,
1743
1717
  retry_policy: @config.rpcs.import_product_sets.retry_policy
1744
- options.apply_defaults metadata: @config.metadata,
1718
+
1719
+ options.apply_defaults timeout: @config.timeout,
1720
+ metadata: @config.metadata,
1745
1721
  retry_policy: @config.retry_policy
1746
1722
 
1747
1723
  @product_search_stub.call_rpc :import_product_sets, request, options: options do |response, operation|
@@ -1766,22 +1742,21 @@ module Google
1766
1742
  # Configuration can be applied globally to all clients, or to a single client
1767
1743
  # on construction.
1768
1744
  #
1769
- # # Examples
1770
- #
1771
- # To modify the global config, setting the timeout for create_product_set
1772
- # to 20 seconds, and all remaining timeouts to 10 seconds:
1773
- #
1774
- # ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.configure do |config|
1775
- # config.timeout = 10.0
1776
- # config.rpcs.create_product_set.timeout = 20.0
1777
- # end
1745
+ # @example
1778
1746
  #
1779
- # To apply the above configuration only to a new client:
1747
+ # # Modify the global config, setting the timeout for
1748
+ # # create_product_set to 20 seconds,
1749
+ # # and all remaining timeouts to 10 seconds.
1750
+ # ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.configure do |config|
1751
+ # config.timeout = 10.0
1752
+ # config.rpcs.create_product_set.timeout = 20.0
1753
+ # end
1780
1754
  #
1781
- # client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new do |config|
1782
- # config.timeout = 10.0
1783
- # config.rpcs.create_product_set.timeout = 20.0
1784
- # end
1755
+ # # Apply the above configuration only to a new client.
1756
+ # client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new do |config|
1757
+ # config.timeout = 10.0
1758
+ # config.rpcs.create_product_set.timeout = 20.0
1759
+ # end
1785
1760
  #
1786
1761
  # @!attribute [rw] endpoint
1787
1762
  # The hostname or hostname:port of the service endpoint.
@@ -1845,7 +1820,7 @@ module Google
1845
1820
  config_attr :scope, nil, ::String, ::Array, nil
1846
1821
  config_attr :lib_name, nil, ::String, nil
1847
1822
  config_attr :lib_version, nil, ::String, nil
1848
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
1823
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1849
1824
  config_attr :interceptors, nil, ::Array, nil
1850
1825
  config_attr :timeout, nil, ::Numeric, nil
1851
1826
  config_attr :metadata, nil, ::Hash, nil
@@ -1866,7 +1841,7 @@ module Google
1866
1841
  def rpcs
1867
1842
  @rpcs ||= begin
1868
1843
  parent_rpcs = nil
1869
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
1844
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1870
1845
  Rpcs.new parent_rpcs
1871
1846
  end
1872
1847
  end
@@ -1982,41 +1957,41 @@ module Google
1982
1957
 
1983
1958
  # @private
1984
1959
  def initialize parent_rpcs = nil
1985
- create_product_set_config = parent_rpcs&.create_product_set if parent_rpcs&.respond_to? :create_product_set
1960
+ create_product_set_config = parent_rpcs.create_product_set if parent_rpcs.respond_to? :create_product_set
1986
1961
  @create_product_set = ::Gapic::Config::Method.new create_product_set_config
1987
- list_product_sets_config = parent_rpcs&.list_product_sets if parent_rpcs&.respond_to? :list_product_sets
1962
+ list_product_sets_config = parent_rpcs.list_product_sets if parent_rpcs.respond_to? :list_product_sets
1988
1963
  @list_product_sets = ::Gapic::Config::Method.new list_product_sets_config
1989
- get_product_set_config = parent_rpcs&.get_product_set if parent_rpcs&.respond_to? :get_product_set
1964
+ get_product_set_config = parent_rpcs.get_product_set if parent_rpcs.respond_to? :get_product_set
1990
1965
  @get_product_set = ::Gapic::Config::Method.new get_product_set_config
1991
- update_product_set_config = parent_rpcs&.update_product_set if parent_rpcs&.respond_to? :update_product_set
1966
+ update_product_set_config = parent_rpcs.update_product_set if parent_rpcs.respond_to? :update_product_set
1992
1967
  @update_product_set = ::Gapic::Config::Method.new update_product_set_config
1993
- delete_product_set_config = parent_rpcs&.delete_product_set if parent_rpcs&.respond_to? :delete_product_set
1968
+ delete_product_set_config = parent_rpcs.delete_product_set if parent_rpcs.respond_to? :delete_product_set
1994
1969
  @delete_product_set = ::Gapic::Config::Method.new delete_product_set_config
1995
- create_product_config = parent_rpcs&.create_product if parent_rpcs&.respond_to? :create_product
1970
+ create_product_config = parent_rpcs.create_product if parent_rpcs.respond_to? :create_product
1996
1971
  @create_product = ::Gapic::Config::Method.new create_product_config
1997
- list_products_config = parent_rpcs&.list_products if parent_rpcs&.respond_to? :list_products
1972
+ list_products_config = parent_rpcs.list_products if parent_rpcs.respond_to? :list_products
1998
1973
  @list_products = ::Gapic::Config::Method.new list_products_config
1999
- get_product_config = parent_rpcs&.get_product if parent_rpcs&.respond_to? :get_product
1974
+ get_product_config = parent_rpcs.get_product if parent_rpcs.respond_to? :get_product
2000
1975
  @get_product = ::Gapic::Config::Method.new get_product_config
2001
- update_product_config = parent_rpcs&.update_product if parent_rpcs&.respond_to? :update_product
1976
+ update_product_config = parent_rpcs.update_product if parent_rpcs.respond_to? :update_product
2002
1977
  @update_product = ::Gapic::Config::Method.new update_product_config
2003
- delete_product_config = parent_rpcs&.delete_product if parent_rpcs&.respond_to? :delete_product
1978
+ delete_product_config = parent_rpcs.delete_product if parent_rpcs.respond_to? :delete_product
2004
1979
  @delete_product = ::Gapic::Config::Method.new delete_product_config
2005
- create_reference_image_config = parent_rpcs&.create_reference_image if parent_rpcs&.respond_to? :create_reference_image
1980
+ create_reference_image_config = parent_rpcs.create_reference_image if parent_rpcs.respond_to? :create_reference_image
2006
1981
  @create_reference_image = ::Gapic::Config::Method.new create_reference_image_config
2007
- delete_reference_image_config = parent_rpcs&.delete_reference_image if parent_rpcs&.respond_to? :delete_reference_image
1982
+ delete_reference_image_config = parent_rpcs.delete_reference_image if parent_rpcs.respond_to? :delete_reference_image
2008
1983
  @delete_reference_image = ::Gapic::Config::Method.new delete_reference_image_config
2009
- list_reference_images_config = parent_rpcs&.list_reference_images if parent_rpcs&.respond_to? :list_reference_images
1984
+ list_reference_images_config = parent_rpcs.list_reference_images if parent_rpcs.respond_to? :list_reference_images
2010
1985
  @list_reference_images = ::Gapic::Config::Method.new list_reference_images_config
2011
- get_reference_image_config = parent_rpcs&.get_reference_image if parent_rpcs&.respond_to? :get_reference_image
1986
+ get_reference_image_config = parent_rpcs.get_reference_image if parent_rpcs.respond_to? :get_reference_image
2012
1987
  @get_reference_image = ::Gapic::Config::Method.new get_reference_image_config
2013
- add_product_to_product_set_config = parent_rpcs&.add_product_to_product_set if parent_rpcs&.respond_to? :add_product_to_product_set
1988
+ add_product_to_product_set_config = parent_rpcs.add_product_to_product_set if parent_rpcs.respond_to? :add_product_to_product_set
2014
1989
  @add_product_to_product_set = ::Gapic::Config::Method.new add_product_to_product_set_config
2015
- remove_product_from_product_set_config = parent_rpcs&.remove_product_from_product_set if parent_rpcs&.respond_to? :remove_product_from_product_set
1990
+ remove_product_from_product_set_config = parent_rpcs.remove_product_from_product_set if parent_rpcs.respond_to? :remove_product_from_product_set
2016
1991
  @remove_product_from_product_set = ::Gapic::Config::Method.new remove_product_from_product_set_config
2017
- list_products_in_product_set_config = parent_rpcs&.list_products_in_product_set if parent_rpcs&.respond_to? :list_products_in_product_set
1992
+ list_products_in_product_set_config = parent_rpcs.list_products_in_product_set if parent_rpcs.respond_to? :list_products_in_product_set
2018
1993
  @list_products_in_product_set = ::Gapic::Config::Method.new list_products_in_product_set_config
2019
- import_product_sets_config = parent_rpcs&.import_product_sets if parent_rpcs&.respond_to? :import_product_sets
1994
+ import_product_sets_config = parent_rpcs.import_product_sets if parent_rpcs.respond_to? :import_product_sets
2020
1995
  @import_product_sets = ::Gapic::Config::Method.new import_product_sets_config
2021
1996
 
2022
1997
  yield self if block_given?