google-cloud-automl-v1beta1 0.4.0 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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?
@@ -44,13 +44,12 @@ module Google
44
44
  # See {::Google::Cloud::AutoML::V1beta1::PredictionService::Client::Configuration}
45
45
  # for a description of the configuration fields.
46
46
  #
47
- # ## Example
47
+ # @example
48
48
  #
49
- # To modify the configuration for all PredictionService clients:
50
- #
51
- # ::Google::Cloud::AutoML::V1beta1::PredictionService::Client.configure do |config|
52
- # config.timeout = 10.0
53
- # end
49
+ # # Modify the configuration for all PredictionService clients
50
+ # ::Google::Cloud::AutoML::V1beta1::PredictionService::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
54
53
  #
55
54
  # @yield [config] Configure the Client client.
56
55
  # @yieldparam config [Client::Configuration]
@@ -63,7 +62,7 @@ module Google
63
62
  parent_config = while namespace.any?
64
63
  parent_name = namespace.join "::"
65
64
  parent_const = const_get parent_name
66
- break parent_const.configure if parent_const&.respond_to? :configure
65
+ break parent_const.configure if parent_const.respond_to? :configure
67
66
  namespace.pop
68
67
  end
69
68
  default_config = Client::Configuration.new parent_config
@@ -101,19 +100,15 @@ module Google
101
100
  ##
102
101
  # Create a new PredictionService client object.
103
102
  #
104
- # ## Examples
105
- #
106
- # To create a new PredictionService client with the default
107
- # configuration:
103
+ # @example
108
104
  #
109
- # client = ::Google::Cloud::AutoML::V1beta1::PredictionService::Client.new
105
+ # # Create a client using the default configuration
106
+ # client = ::Google::Cloud::AutoML::V1beta1::PredictionService::Client.new
110
107
  #
111
- # To create a new PredictionService client with a custom
112
- # configuration:
113
- #
114
- # client = ::Google::Cloud::AutoML::V1beta1::PredictionService::Client.new do |config|
115
- # config.timeout = 10.0
116
- # end
108
+ # # Create a client using a custom configuration
109
+ # client = ::Google::Cloud::AutoML::V1beta1::PredictionService::Client.new do |config|
110
+ # config.timeout = 10.0
111
+ # end
117
112
  #
118
113
  # @yield [config] Configure the PredictionService client.
119
114
  # @yieldparam config [Client::Configuration]
@@ -133,14 +128,13 @@ module Google
133
128
 
134
129
  # Create credentials
135
130
  credentials = @config.credentials
136
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
131
+ # Use self-signed JWT if the endpoint is unchanged from default,
137
132
  # but only if the default endpoint does not have a region prefix.
138
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
139
- @config.endpoint == Client.configure.endpoint &&
133
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
140
134
  !@config.endpoint.split(".").first.include?("-")
141
- credentials ||= Credentials.default scope: @config.scope,
135
+ credentials ||= Credentials.default scope: @config.scope,
142
136
  enable_self_signed_jwt: enable_self_signed_jwt
143
- if credentials.is_a?(String) || credentials.is_a?(Hash)
137
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
144
138
  credentials = Credentials.new credentials, scope: @config.scope
145
139
  end
146
140
  @quota_project_id = @config.quota_project
@@ -266,7 +260,9 @@ module Google
266
260
  options.apply_defaults timeout: @config.rpcs.predict.timeout,
267
261
  metadata: metadata,
268
262
  retry_policy: @config.rpcs.predict.retry_policy
269
- options.apply_defaults metadata: @config.metadata,
263
+
264
+ options.apply_defaults timeout: @config.timeout,
265
+ metadata: @config.metadata,
270
266
  retry_policy: @config.retry_policy
271
267
 
272
268
  @prediction_service_stub.call_rpc :predict, request, options: options do |response, operation|
@@ -419,7 +415,9 @@ module Google
419
415
  options.apply_defaults timeout: @config.rpcs.batch_predict.timeout,
420
416
  metadata: metadata,
421
417
  retry_policy: @config.rpcs.batch_predict.retry_policy
422
- options.apply_defaults metadata: @config.metadata,
418
+
419
+ options.apply_defaults timeout: @config.timeout,
420
+ metadata: @config.metadata,
423
421
  retry_policy: @config.retry_policy
424
422
 
425
423
  @prediction_service_stub.call_rpc :batch_predict, request, options: options do |response, operation|
@@ -444,22 +442,21 @@ module Google
444
442
  # Configuration can be applied globally to all clients, or to a single client
445
443
  # on construction.
446
444
  #
447
- # # Examples
448
- #
449
- # To modify the global config, setting the timeout for predict
450
- # to 20 seconds, and all remaining timeouts to 10 seconds:
451
- #
452
- # ::Google::Cloud::AutoML::V1beta1::PredictionService::Client.configure do |config|
453
- # config.timeout = 10.0
454
- # config.rpcs.predict.timeout = 20.0
455
- # end
445
+ # @example
456
446
  #
457
- # To apply the above configuration only to a new client:
447
+ # # Modify the global config, setting the timeout for
448
+ # # predict to 20 seconds,
449
+ # # and all remaining timeouts to 10 seconds.
450
+ # ::Google::Cloud::AutoML::V1beta1::PredictionService::Client.configure do |config|
451
+ # config.timeout = 10.0
452
+ # config.rpcs.predict.timeout = 20.0
453
+ # end
458
454
  #
459
- # client = ::Google::Cloud::AutoML::V1beta1::PredictionService::Client.new do |config|
460
- # config.timeout = 10.0
461
- # config.rpcs.predict.timeout = 20.0
462
- # end
455
+ # # Apply the above configuration only to a new client.
456
+ # client = ::Google::Cloud::AutoML::V1beta1::PredictionService::Client.new do |config|
457
+ # config.timeout = 10.0
458
+ # config.rpcs.predict.timeout = 20.0
459
+ # end
463
460
  #
464
461
  # @!attribute [rw] endpoint
465
462
  # The hostname or hostname:port of the service endpoint.
@@ -523,7 +520,7 @@ module Google
523
520
  config_attr :scope, nil, ::String, ::Array, nil
524
521
  config_attr :lib_name, nil, ::String, nil
525
522
  config_attr :lib_version, nil, ::String, nil
526
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
523
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
527
524
  config_attr :interceptors, nil, ::Array, nil
528
525
  config_attr :timeout, nil, ::Numeric, nil
529
526
  config_attr :metadata, nil, ::Hash, nil
@@ -544,7 +541,7 @@ module Google
544
541
  def rpcs
545
542
  @rpcs ||= begin
546
543
  parent_rpcs = nil
547
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
544
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
548
545
  Rpcs.new parent_rpcs
549
546
  end
550
547
  end
@@ -580,9 +577,9 @@ module Google
580
577
 
581
578
  # @private
582
579
  def initialize parent_rpcs = nil
583
- predict_config = parent_rpcs&.predict if parent_rpcs&.respond_to? :predict
580
+ predict_config = parent_rpcs.predict if parent_rpcs.respond_to? :predict
584
581
  @predict = ::Gapic::Config::Method.new predict_config
585
- batch_predict_config = parent_rpcs&.batch_predict if parent_rpcs&.respond_to? :batch_predict
582
+ batch_predict_config = parent_rpcs.batch_predict if parent_rpcs.respond_to? :batch_predict
586
583
  @batch_predict = ::Gapic::Config::Method.new batch_predict_config
587
584
 
588
585
  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?