google-cloud-document_ai-v1beta3 0.4.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb +480 -19
- data/lib/google/cloud/document_ai/v1beta3/document_processor_service/operations.rb +9 -9
- data/lib/google/cloud/document_ai/v1beta3/document_processor_service/paths.rb +17 -0
- data/lib/google/cloud/document_ai/v1beta3/version.rb +1 -1
- data/lib/google/cloud/documentai/v1beta3/document_pb.rb +5 -8
- data/lib/google/cloud/documentai/v1beta3/document_processor_service_pb.rb +64 -16
- data/lib/google/cloud/documentai/v1beta3/document_processor_service_services_pb.rb +15 -1
- data/lib/google/cloud/documentai/v1beta3/operation_metadata_pb.rb +36 -0
- data/lib/google/cloud/documentai/v1beta3/processor_pb.rb +45 -0
- data/lib/google/cloud/documentai/v1beta3/processor_type_pb.rb +32 -0
- data/proto_docs/google/cloud/documentai/v1beta3/document.rb +30 -48
- data/proto_docs/google/cloud/documentai/v1beta3/document_processor_service.rb +149 -39
- data/proto_docs/google/cloud/documentai/v1beta3/geometry.rb +2 -2
- data/proto_docs/google/cloud/documentai/v1beta3/operation_metadata.rb +65 -0
- data/proto_docs/google/cloud/documentai/v1beta3/processor.rb +86 -0
- data/proto_docs/google/cloud/documentai/v1beta3/processor_type.rb +59 -0
- metadata +22 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07102af6b6ce3804dfd8dc6332df8e45508d3776cfc88f769311743e578c91f3
|
4
|
+
data.tar.gz: ebf708508d799ff99a11682e594336a7ebde063afefe2be28e0506b185607380
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c0c6f0653b021bf85a017e7d3ebe86fff4bd608f2e4fc1ea492ebacf483d754eeae5b72648438052785a6da631df202dadcb2d57559b27f6eebfd014d343350
|
7
|
+
data.tar.gz: 90f66794899f36c611ba1a6b79c9ede5ae2dcf85bb962b10b9d8174be10f930d7889c0b64923b08b3f3fb2e1131697cc1b175b3f5b1cc0a9c3efddf603f5b2fd
|
data/README.md
CHANGED
@@ -71,11 +71,11 @@ end
|
|
71
71
|
|
72
72
|
## Supported Ruby Versions
|
73
73
|
|
74
|
-
This library is supported on Ruby 2.
|
74
|
+
This library is supported on Ruby 2.5+.
|
75
75
|
|
76
76
|
Google provides official support for Ruby versions that are actively supported
|
77
77
|
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
78
|
-
in security maintenance, and not end of life. Currently, this means Ruby 2.
|
78
|
+
in security maintenance, and not end of life. Currently, this means Ruby 2.5
|
79
79
|
and later. Older versions of Ruby _may_ still work, but are unsupported and not
|
80
80
|
recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
|
81
81
|
about the Ruby support schedule.
|
@@ -63,7 +63,7 @@ module Google
|
|
63
63
|
parent_config = while namespace.any?
|
64
64
|
parent_name = namespace.join "::"
|
65
65
|
parent_const = const_get parent_name
|
66
|
-
break parent_const.configure if parent_const
|
66
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
67
67
|
namespace.pop
|
68
68
|
end
|
69
69
|
default_config = Client::Configuration.new parent_config
|
@@ -71,25 +71,25 @@ module Google
|
|
71
71
|
default_config.rpcs.process_document.timeout = 120.0
|
72
72
|
default_config.rpcs.process_document.retry_policy = {
|
73
73
|
initial_delay: 0.1,
|
74
|
-
|
75
|
-
|
76
|
-
|
74
|
+
max_delay: 60.0,
|
75
|
+
multiplier: 1.3,
|
76
|
+
retry_codes: [4, 14]
|
77
77
|
}
|
78
78
|
|
79
79
|
default_config.rpcs.batch_process_documents.timeout = 120.0
|
80
80
|
default_config.rpcs.batch_process_documents.retry_policy = {
|
81
81
|
initial_delay: 0.1,
|
82
|
-
|
83
|
-
|
84
|
-
|
82
|
+
max_delay: 60.0,
|
83
|
+
multiplier: 1.3,
|
84
|
+
retry_codes: [4, 14]
|
85
85
|
}
|
86
86
|
|
87
87
|
default_config.rpcs.review_document.timeout = 120.0
|
88
88
|
default_config.rpcs.review_document.retry_policy = {
|
89
89
|
initial_delay: 0.1,
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
max_delay: 60.0,
|
91
|
+
multiplier: 1.3,
|
92
|
+
retry_codes: [4, 14]
|
93
93
|
}
|
94
94
|
|
95
95
|
default_config
|
@@ -158,7 +158,7 @@ module Google
|
|
158
158
|
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
159
159
|
@config.endpoint == Client.configure.endpoint &&
|
160
160
|
!@config.endpoint.split(".").first.include?("-")
|
161
|
-
credentials ||= Credentials.default scope:
|
161
|
+
credentials ||= Credentials.default scope: @config.scope,
|
162
162
|
enable_self_signed_jwt: enable_self_signed_jwt
|
163
163
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
164
164
|
credentials = Credentials.new credentials, scope: @config.scope
|
@@ -343,6 +343,421 @@ module Google
|
|
343
343
|
raise ::Google::Cloud::Error.from_error(e)
|
344
344
|
end
|
345
345
|
|
346
|
+
##
|
347
|
+
# Fetches processor types.
|
348
|
+
#
|
349
|
+
# @overload fetch_processor_types(request, options = nil)
|
350
|
+
# Pass arguments to `fetch_processor_types` via a request object, either of type
|
351
|
+
# {::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesRequest} or an equivalent Hash.
|
352
|
+
#
|
353
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesRequest, ::Hash]
|
354
|
+
# A request object representing the call parameters. Required. To specify no
|
355
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
356
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
357
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
358
|
+
#
|
359
|
+
# @overload fetch_processor_types(parent: nil)
|
360
|
+
# Pass arguments to `fetch_processor_types` via keyword arguments. Note that at
|
361
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
362
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
363
|
+
#
|
364
|
+
# @param parent [::String]
|
365
|
+
# Required. The project of processor type to list.
|
366
|
+
# Format: projects/\\{project}/locations/\\{location}
|
367
|
+
#
|
368
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
369
|
+
# @yieldparam response [::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesResponse]
|
370
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
371
|
+
#
|
372
|
+
# @return [::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesResponse]
|
373
|
+
#
|
374
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
375
|
+
#
|
376
|
+
def fetch_processor_types request, options = nil
|
377
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
378
|
+
|
379
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesRequest
|
380
|
+
|
381
|
+
# Converts hash and nil to an options object
|
382
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
383
|
+
|
384
|
+
# Customize the options with defaults
|
385
|
+
metadata = @config.rpcs.fetch_processor_types.metadata.to_h
|
386
|
+
|
387
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
388
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
389
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
390
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
391
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
392
|
+
|
393
|
+
header_params = {
|
394
|
+
"parent" => request.parent
|
395
|
+
}
|
396
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
397
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
398
|
+
|
399
|
+
options.apply_defaults timeout: @config.rpcs.fetch_processor_types.timeout,
|
400
|
+
metadata: metadata,
|
401
|
+
retry_policy: @config.rpcs.fetch_processor_types.retry_policy
|
402
|
+
options.apply_defaults metadata: @config.metadata,
|
403
|
+
retry_policy: @config.retry_policy
|
404
|
+
|
405
|
+
@document_processor_service_stub.call_rpc :fetch_processor_types, request, options: options do |response, operation|
|
406
|
+
yield response, operation if block_given?
|
407
|
+
return response
|
408
|
+
end
|
409
|
+
rescue ::GRPC::BadStatus => e
|
410
|
+
raise ::Google::Cloud::Error.from_error(e)
|
411
|
+
end
|
412
|
+
|
413
|
+
##
|
414
|
+
# Lists all processors which belong to this project.
|
415
|
+
#
|
416
|
+
# @overload list_processors(request, options = nil)
|
417
|
+
# Pass arguments to `list_processors` via a request object, either of type
|
418
|
+
# {::Google::Cloud::DocumentAI::V1beta3::ListProcessorsRequest} or an equivalent Hash.
|
419
|
+
#
|
420
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::ListProcessorsRequest, ::Hash]
|
421
|
+
# A request object representing the call parameters. Required. To specify no
|
422
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
423
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
424
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
425
|
+
#
|
426
|
+
# @overload list_processors(parent: nil, page_size: nil, page_token: nil)
|
427
|
+
# Pass arguments to `list_processors` via keyword arguments. Note that at
|
428
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
429
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
430
|
+
#
|
431
|
+
# @param parent [::String]
|
432
|
+
# Required. The parent (project and location) which owns this collection of Processors.
|
433
|
+
# Format: projects/\\{project}/locations/\\{location}
|
434
|
+
# @param page_size [::Integer]
|
435
|
+
# The maximum number of processors to return.
|
436
|
+
# If unspecified, at most 50 processors will be returned.
|
437
|
+
# The maximum value is 100; values above 100 will be coerced to 100.
|
438
|
+
# @param page_token [::String]
|
439
|
+
# We will return the processors sorted by creation time. The page token
|
440
|
+
# will point to the next processor.
|
441
|
+
#
|
442
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
443
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Processor>]
|
444
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
445
|
+
#
|
446
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Processor>]
|
447
|
+
#
|
448
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
449
|
+
#
|
450
|
+
def list_processors request, options = nil
|
451
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
452
|
+
|
453
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::ListProcessorsRequest
|
454
|
+
|
455
|
+
# Converts hash and nil to an options object
|
456
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
457
|
+
|
458
|
+
# Customize the options with defaults
|
459
|
+
metadata = @config.rpcs.list_processors.metadata.to_h
|
460
|
+
|
461
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
462
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
463
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
464
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
465
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
466
|
+
|
467
|
+
header_params = {
|
468
|
+
"parent" => request.parent
|
469
|
+
}
|
470
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
471
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
472
|
+
|
473
|
+
options.apply_defaults timeout: @config.rpcs.list_processors.timeout,
|
474
|
+
metadata: metadata,
|
475
|
+
retry_policy: @config.rpcs.list_processors.retry_policy
|
476
|
+
options.apply_defaults metadata: @config.metadata,
|
477
|
+
retry_policy: @config.retry_policy
|
478
|
+
|
479
|
+
@document_processor_service_stub.call_rpc :list_processors, request, options: options do |response, operation|
|
480
|
+
response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_processors, request, response, operation, options
|
481
|
+
yield response, operation if block_given?
|
482
|
+
return response
|
483
|
+
end
|
484
|
+
rescue ::GRPC::BadStatus => e
|
485
|
+
raise ::Google::Cloud::Error.from_error(e)
|
486
|
+
end
|
487
|
+
|
488
|
+
##
|
489
|
+
# Creates a processor from the type processor that the user chose.
|
490
|
+
# The processor will be at "ENABLED" state by default after its creation.
|
491
|
+
#
|
492
|
+
# @overload create_processor(request, options = nil)
|
493
|
+
# Pass arguments to `create_processor` via a request object, either of type
|
494
|
+
# {::Google::Cloud::DocumentAI::V1beta3::CreateProcessorRequest} or an equivalent Hash.
|
495
|
+
#
|
496
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::CreateProcessorRequest, ::Hash]
|
497
|
+
# A request object representing the call parameters. Required. To specify no
|
498
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
499
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
500
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
501
|
+
#
|
502
|
+
# @overload create_processor(parent: nil, processor: nil)
|
503
|
+
# Pass arguments to `create_processor` via keyword arguments. Note that at
|
504
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
505
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
506
|
+
#
|
507
|
+
# @param parent [::String]
|
508
|
+
# Required. The parent (project and location) under which to create the processor.
|
509
|
+
# Format: projects/\\{project}/locations/\\{location}
|
510
|
+
# @param processor [::Google::Cloud::DocumentAI::V1beta3::Processor, ::Hash]
|
511
|
+
# Required. The processor to be created, requires [processor_type] and [display_name]
|
512
|
+
# to be set. Also, the processor is under CMEK if CMEK fields are set.
|
513
|
+
#
|
514
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
515
|
+
# @yieldparam response [::Google::Cloud::DocumentAI::V1beta3::Processor]
|
516
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
517
|
+
#
|
518
|
+
# @return [::Google::Cloud::DocumentAI::V1beta3::Processor]
|
519
|
+
#
|
520
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
521
|
+
#
|
522
|
+
def create_processor request, options = nil
|
523
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
524
|
+
|
525
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::CreateProcessorRequest
|
526
|
+
|
527
|
+
# Converts hash and nil to an options object
|
528
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
529
|
+
|
530
|
+
# Customize the options with defaults
|
531
|
+
metadata = @config.rpcs.create_processor.metadata.to_h
|
532
|
+
|
533
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
534
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
535
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
536
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
537
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
538
|
+
|
539
|
+
header_params = {
|
540
|
+
"parent" => request.parent
|
541
|
+
}
|
542
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
543
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
544
|
+
|
545
|
+
options.apply_defaults timeout: @config.rpcs.create_processor.timeout,
|
546
|
+
metadata: metadata,
|
547
|
+
retry_policy: @config.rpcs.create_processor.retry_policy
|
548
|
+
options.apply_defaults metadata: @config.metadata,
|
549
|
+
retry_policy: @config.retry_policy
|
550
|
+
|
551
|
+
@document_processor_service_stub.call_rpc :create_processor, request, options: options do |response, operation|
|
552
|
+
yield response, operation if block_given?
|
553
|
+
return response
|
554
|
+
end
|
555
|
+
rescue ::GRPC::BadStatus => e
|
556
|
+
raise ::Google::Cloud::Error.from_error(e)
|
557
|
+
end
|
558
|
+
|
559
|
+
##
|
560
|
+
# Deletes the processor, unloads all deployed model artifacts if it was
|
561
|
+
# enabled and then deletes all artifacts associated with this processor.
|
562
|
+
#
|
563
|
+
# @overload delete_processor(request, options = nil)
|
564
|
+
# Pass arguments to `delete_processor` via a request object, either of type
|
565
|
+
# {::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest} or an equivalent Hash.
|
566
|
+
#
|
567
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest, ::Hash]
|
568
|
+
# A request object representing the call parameters. Required. To specify no
|
569
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
570
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
571
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
572
|
+
#
|
573
|
+
# @overload delete_processor(name: nil)
|
574
|
+
# Pass arguments to `delete_processor` via keyword arguments. Note that at
|
575
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
576
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
577
|
+
#
|
578
|
+
# @param name [::String]
|
579
|
+
# Required. The processor resource name to be deleted.
|
580
|
+
#
|
581
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
582
|
+
# @yieldparam response [::Gapic::Operation]
|
583
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
584
|
+
#
|
585
|
+
# @return [::Gapic::Operation]
|
586
|
+
#
|
587
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
588
|
+
#
|
589
|
+
def delete_processor request, options = nil
|
590
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
591
|
+
|
592
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest
|
593
|
+
|
594
|
+
# Converts hash and nil to an options object
|
595
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
596
|
+
|
597
|
+
# Customize the options with defaults
|
598
|
+
metadata = @config.rpcs.delete_processor.metadata.to_h
|
599
|
+
|
600
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
601
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
602
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
603
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
604
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
605
|
+
|
606
|
+
header_params = {
|
607
|
+
"name" => request.name
|
608
|
+
}
|
609
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
610
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
611
|
+
|
612
|
+
options.apply_defaults timeout: @config.rpcs.delete_processor.timeout,
|
613
|
+
metadata: metadata,
|
614
|
+
retry_policy: @config.rpcs.delete_processor.retry_policy
|
615
|
+
options.apply_defaults metadata: @config.metadata,
|
616
|
+
retry_policy: @config.retry_policy
|
617
|
+
|
618
|
+
@document_processor_service_stub.call_rpc :delete_processor, request, options: options do |response, operation|
|
619
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
620
|
+
yield response, operation if block_given?
|
621
|
+
return response
|
622
|
+
end
|
623
|
+
rescue ::GRPC::BadStatus => e
|
624
|
+
raise ::Google::Cloud::Error.from_error(e)
|
625
|
+
end
|
626
|
+
|
627
|
+
##
|
628
|
+
# Enables a processor
|
629
|
+
#
|
630
|
+
# @overload enable_processor(request, options = nil)
|
631
|
+
# Pass arguments to `enable_processor` via a request object, either of type
|
632
|
+
# {::Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest} or an equivalent Hash.
|
633
|
+
#
|
634
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest, ::Hash]
|
635
|
+
# A request object representing the call parameters. Required. To specify no
|
636
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
637
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
638
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
639
|
+
#
|
640
|
+
# @overload enable_processor(name: nil)
|
641
|
+
# Pass arguments to `enable_processor` via keyword arguments. Note that at
|
642
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
643
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
644
|
+
#
|
645
|
+
# @param name [::String]
|
646
|
+
# Required. The processor resource name to be enabled.
|
647
|
+
#
|
648
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
649
|
+
# @yieldparam response [::Gapic::Operation]
|
650
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
651
|
+
#
|
652
|
+
# @return [::Gapic::Operation]
|
653
|
+
#
|
654
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
655
|
+
#
|
656
|
+
def enable_processor request, options = nil
|
657
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
658
|
+
|
659
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest
|
660
|
+
|
661
|
+
# Converts hash and nil to an options object
|
662
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
663
|
+
|
664
|
+
# Customize the options with defaults
|
665
|
+
metadata = @config.rpcs.enable_processor.metadata.to_h
|
666
|
+
|
667
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
668
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
669
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
670
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
671
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
672
|
+
|
673
|
+
header_params = {
|
674
|
+
"name" => request.name
|
675
|
+
}
|
676
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
677
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
678
|
+
|
679
|
+
options.apply_defaults timeout: @config.rpcs.enable_processor.timeout,
|
680
|
+
metadata: metadata,
|
681
|
+
retry_policy: @config.rpcs.enable_processor.retry_policy
|
682
|
+
options.apply_defaults metadata: @config.metadata,
|
683
|
+
retry_policy: @config.retry_policy
|
684
|
+
|
685
|
+
@document_processor_service_stub.call_rpc :enable_processor, request, options: options do |response, operation|
|
686
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
687
|
+
yield response, operation if block_given?
|
688
|
+
return response
|
689
|
+
end
|
690
|
+
rescue ::GRPC::BadStatus => e
|
691
|
+
raise ::Google::Cloud::Error.from_error(e)
|
692
|
+
end
|
693
|
+
|
694
|
+
##
|
695
|
+
# Disables a processor
|
696
|
+
#
|
697
|
+
# @overload disable_processor(request, options = nil)
|
698
|
+
# Pass arguments to `disable_processor` via a request object, either of type
|
699
|
+
# {::Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest} or an equivalent Hash.
|
700
|
+
#
|
701
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest, ::Hash]
|
702
|
+
# A request object representing the call parameters. Required. To specify no
|
703
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
704
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
705
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
706
|
+
#
|
707
|
+
# @overload disable_processor(name: nil)
|
708
|
+
# Pass arguments to `disable_processor` via keyword arguments. Note that at
|
709
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
710
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
711
|
+
#
|
712
|
+
# @param name [::String]
|
713
|
+
# Required. The processor resource name to be disabled.
|
714
|
+
#
|
715
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
716
|
+
# @yieldparam response [::Gapic::Operation]
|
717
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
718
|
+
#
|
719
|
+
# @return [::Gapic::Operation]
|
720
|
+
#
|
721
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
722
|
+
#
|
723
|
+
def disable_processor request, options = nil
|
724
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
725
|
+
|
726
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest
|
727
|
+
|
728
|
+
# Converts hash and nil to an options object
|
729
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
730
|
+
|
731
|
+
# Customize the options with defaults
|
732
|
+
metadata = @config.rpcs.disable_processor.metadata.to_h
|
733
|
+
|
734
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
735
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
736
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
737
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
738
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
739
|
+
|
740
|
+
header_params = {
|
741
|
+
"name" => request.name
|
742
|
+
}
|
743
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
744
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
745
|
+
|
746
|
+
options.apply_defaults timeout: @config.rpcs.disable_processor.timeout,
|
747
|
+
metadata: metadata,
|
748
|
+
retry_policy: @config.rpcs.disable_processor.retry_policy
|
749
|
+
options.apply_defaults metadata: @config.metadata,
|
750
|
+
retry_policy: @config.retry_policy
|
751
|
+
|
752
|
+
@document_processor_service_stub.call_rpc :disable_processor, request, options: options do |response, operation|
|
753
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
754
|
+
yield response, operation if block_given?
|
755
|
+
return response
|
756
|
+
end
|
757
|
+
rescue ::GRPC::BadStatus => e
|
758
|
+
raise ::Google::Cloud::Error.from_error(e)
|
759
|
+
end
|
760
|
+
|
346
761
|
##
|
347
762
|
# Send a document for Human Review. The input document should be processed by
|
348
763
|
# the specified processor.
|
@@ -357,7 +772,7 @@ module Google
|
|
357
772
|
# @param options [::Gapic::CallOptions, ::Hash]
|
358
773
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
359
774
|
#
|
360
|
-
# @overload review_document(inline_document: nil, human_review_config: nil, document: nil)
|
775
|
+
# @overload review_document(inline_document: nil, human_review_config: nil, document: nil, enable_schema_validation: nil, priority: nil)
|
361
776
|
# Pass arguments to `review_document` via keyword arguments. Note that at
|
362
777
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
363
778
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -369,6 +784,10 @@ module Google
|
|
369
784
|
# reviewed with.
|
370
785
|
# @param document [::Google::Cloud::DocumentAI::V1beta3::Document, ::Hash]
|
371
786
|
# The document that needs human review.
|
787
|
+
# @param enable_schema_validation [::Boolean]
|
788
|
+
# Whether the validation should be performed on the ad-hoc review request.
|
789
|
+
# @param priority [::Google::Cloud::DocumentAI::V1beta3::ReviewDocumentRequest::Priority]
|
790
|
+
# The priority of the human review task.
|
372
791
|
#
|
373
792
|
# @yield [response, operation] Access the result along with the RPC operation
|
374
793
|
# @yieldparam response [::Gapic::Operation]
|
@@ -448,7 +867,7 @@ module Google
|
|
448
867
|
#
|
449
868
|
# @!attribute [rw] endpoint
|
450
869
|
# The hostname or hostname:port of the service endpoint.
|
451
|
-
# Defaults to `"
|
870
|
+
# Defaults to `"documentai.googleapis.com"`.
|
452
871
|
# @return [::String]
|
453
872
|
# @!attribute [rw] credentials
|
454
873
|
# Credentials to send with calls. You may provide any of the following types:
|
@@ -499,7 +918,7 @@ module Google
|
|
499
918
|
class Configuration
|
500
919
|
extend ::Gapic::Config
|
501
920
|
|
502
|
-
config_attr :endpoint, "
|
921
|
+
config_attr :endpoint, "documentai.googleapis.com", ::String
|
503
922
|
config_attr :credentials, nil do |value|
|
504
923
|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
505
924
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
@@ -508,7 +927,7 @@ module Google
|
|
508
927
|
config_attr :scope, nil, ::String, ::Array, nil
|
509
928
|
config_attr :lib_name, nil, ::String, nil
|
510
929
|
config_attr :lib_version, nil, ::String, nil
|
511
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
930
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
512
931
|
config_attr :interceptors, nil, ::Array, nil
|
513
932
|
config_attr :timeout, nil, ::Numeric, nil
|
514
933
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -529,7 +948,7 @@ module Google
|
|
529
948
|
def rpcs
|
530
949
|
@rpcs ||= begin
|
531
950
|
parent_rpcs = nil
|
532
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
951
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
533
952
|
Rpcs.new parent_rpcs
|
534
953
|
end
|
535
954
|
end
|
@@ -563,6 +982,36 @@ module Google
|
|
563
982
|
#
|
564
983
|
attr_reader :batch_process_documents
|
565
984
|
##
|
985
|
+
# RPC-specific configuration for `fetch_processor_types`
|
986
|
+
# @return [::Gapic::Config::Method]
|
987
|
+
#
|
988
|
+
attr_reader :fetch_processor_types
|
989
|
+
##
|
990
|
+
# RPC-specific configuration for `list_processors`
|
991
|
+
# @return [::Gapic::Config::Method]
|
992
|
+
#
|
993
|
+
attr_reader :list_processors
|
994
|
+
##
|
995
|
+
# RPC-specific configuration for `create_processor`
|
996
|
+
# @return [::Gapic::Config::Method]
|
997
|
+
#
|
998
|
+
attr_reader :create_processor
|
999
|
+
##
|
1000
|
+
# RPC-specific configuration for `delete_processor`
|
1001
|
+
# @return [::Gapic::Config::Method]
|
1002
|
+
#
|
1003
|
+
attr_reader :delete_processor
|
1004
|
+
##
|
1005
|
+
# RPC-specific configuration for `enable_processor`
|
1006
|
+
# @return [::Gapic::Config::Method]
|
1007
|
+
#
|
1008
|
+
attr_reader :enable_processor
|
1009
|
+
##
|
1010
|
+
# RPC-specific configuration for `disable_processor`
|
1011
|
+
# @return [::Gapic::Config::Method]
|
1012
|
+
#
|
1013
|
+
attr_reader :disable_processor
|
1014
|
+
##
|
566
1015
|
# RPC-specific configuration for `review_document`
|
567
1016
|
# @return [::Gapic::Config::Method]
|
568
1017
|
#
|
@@ -570,11 +1019,23 @@ module Google
|
|
570
1019
|
|
571
1020
|
# @private
|
572
1021
|
def initialize parent_rpcs = nil
|
573
|
-
process_document_config = parent_rpcs
|
1022
|
+
process_document_config = parent_rpcs.process_document if parent_rpcs.respond_to? :process_document
|
574
1023
|
@process_document = ::Gapic::Config::Method.new process_document_config
|
575
|
-
batch_process_documents_config = parent_rpcs
|
1024
|
+
batch_process_documents_config = parent_rpcs.batch_process_documents if parent_rpcs.respond_to? :batch_process_documents
|
576
1025
|
@batch_process_documents = ::Gapic::Config::Method.new batch_process_documents_config
|
577
|
-
|
1026
|
+
fetch_processor_types_config = parent_rpcs.fetch_processor_types if parent_rpcs.respond_to? :fetch_processor_types
|
1027
|
+
@fetch_processor_types = ::Gapic::Config::Method.new fetch_processor_types_config
|
1028
|
+
list_processors_config = parent_rpcs.list_processors if parent_rpcs.respond_to? :list_processors
|
1029
|
+
@list_processors = ::Gapic::Config::Method.new list_processors_config
|
1030
|
+
create_processor_config = parent_rpcs.create_processor if parent_rpcs.respond_to? :create_processor
|
1031
|
+
@create_processor = ::Gapic::Config::Method.new create_processor_config
|
1032
|
+
delete_processor_config = parent_rpcs.delete_processor if parent_rpcs.respond_to? :delete_processor
|
1033
|
+
@delete_processor = ::Gapic::Config::Method.new delete_processor_config
|
1034
|
+
enable_processor_config = parent_rpcs.enable_processor if parent_rpcs.respond_to? :enable_processor
|
1035
|
+
@enable_processor = ::Gapic::Config::Method.new enable_processor_config
|
1036
|
+
disable_processor_config = parent_rpcs.disable_processor if parent_rpcs.respond_to? :disable_processor
|
1037
|
+
@disable_processor = ::Gapic::Config::Method.new disable_processor_config
|
1038
|
+
review_document_config = parent_rpcs.review_document if parent_rpcs.respond_to? :review_document
|
578
1039
|
@review_document = ::Gapic::Config::Method.new review_document_config
|
579
1040
|
|
580
1041
|
yield self if block_given?
|