Class: Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client
- Inherits:
-
Object
- Object
- Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client
- Includes:
- Paths
- Defined in:
- lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb
Overview
Client for the DocumentProcessorService service.
Service to call Document AI to process documents according to the processor's definition. Processors are built using state-of-the-art Google AI such as natural language, computer vision, and translation to extract structured information from unstructured or semi-structured documents.
Defined Under Namespace
Classes: Configuration
Instance Attribute Summary collapse
-
#location_client ⇒ Google::Cloud::Location::Locations::Client
readonly
Get the associated client for mix-in of the Locations.
-
#operations_client ⇒ ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Operations
readonly
Get the associated client for long-running operations.
Class Method Summary collapse
-
.configure {|config| ... } ⇒ Client::Configuration
Configure the DocumentProcessorService Client class.
Instance Method Summary collapse
-
#batch_process_documents(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
LRO endpoint to batch process many documents.
-
#configure {|config| ... } ⇒ Client::Configuration
Configure the DocumentProcessorService Client instance.
-
#create_processor(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::DocumentAI::V1beta3::Processor
Creates a processor from the ProcessorType provided.
-
#delete_processor(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Deletes the processor, unloads all deployed model artifacts if it was enabled and then deletes all artifacts associated with this processor.
-
#delete_processor_version(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Deletes the processor version, all artifacts under the processor version will be deleted.
-
#deploy_processor_version(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Deploys the processor version.
-
#disable_processor(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Disables a processor.
-
#enable_processor(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Enables a processor.
-
#evaluate_processor_version(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Evaluates a ProcessorVersion against annotated documents, producing an Evaluation.
-
#fetch_processor_types(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesResponse
Fetches processor types.
-
#get_evaluation(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::DocumentAI::V1beta3::Evaluation
Retrieves a specific evaluation.
-
#get_processor(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::DocumentAI::V1beta3::Processor
Gets a processor detail.
-
#get_processor_type(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::DocumentAI::V1beta3::ProcessorType
Gets a processor type detail.
-
#get_processor_version(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion
Gets a processor version detail.
-
#import_processor_version(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Imports a processor version from source processor version.
-
#initialize {|config| ... } ⇒ Client
constructor
Create a new DocumentProcessorService client object.
-
#list_evaluations(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Evaluation>
Retrieves a set of evaluations for a given processor version.
-
#list_processor_types(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorType>
Lists the processor types that exist.
-
#list_processor_versions(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion>
Lists all versions of a processor.
-
#list_processors(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Processor>
Lists all processors which belong to this project.
-
#process_document(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::DocumentAI::V1beta3::ProcessResponse
Processes a single document.
-
#review_document(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Send a document for Human Review.
-
#set_default_processor_version(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Set the default (active) version of a Processor that will be used in ProcessDocument and BatchProcessDocuments.
-
#train_processor_version(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Trains a new processor version.
-
#undeploy_processor_version(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::Operation
Undeploys the processor version.
Methods included from Paths
#evaluation_path, #human_review_config_path, #location_path, #processor_path, #processor_type_path, #processor_version_path
Constructor Details
#initialize {|config| ... } ⇒ Client
Create a new DocumentProcessorService client object.
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 128 def initialize # These require statements are intentionally placed here to initialize # the gRPC module only when it's required. # See https://github.com/googleapis/toolkit/issues/446 require "gapic/grpc" require "google/cloud/documentai/v1beta3/document_processor_service_services_pb" # Create the configuration object @config = Configuration.new Client.configure # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials # Use self-signed JWT if the endpoint is unchanged from default, # but only if the default endpoint does not have a region prefix. enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT && !@config.endpoint.split(".").first.include?("-") credentials ||= Credentials.default scope: @config.scope, enable_self_signed_jwt: enable_self_signed_jwt if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope end @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @operations_client = Operations.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint end @location_client = Google::Cloud::Location::Locations::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint end @document_processor_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Stub, credentials: credentials, endpoint: @config.endpoint, channel_args: @config.channel_args, interceptors: @config.interceptors ) end |
Instance Attribute Details
#location_client ⇒ Google::Cloud::Location::Locations::Client (readonly)
Get the associated client for mix-in of the Locations.
188 189 190 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 188 def location_client @location_client end |
#operations_client ⇒ ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Operations (readonly)
Get the associated client for long-running operations.
181 182 183 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 181 def operations_client @operations_client end |
Class Method Details
.configure {|config| ... } ⇒ Client::Configuration
Configure the DocumentProcessorService Client class.
See Configuration for a description of the configuration fields.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 60 def self.configure @configure ||= begin namespace = ["Google", "Cloud", "DocumentAI", "V1beta3"] parent_config = while namespace.any? parent_name = namespace.join "::" parent_const = const_get parent_name break parent_const.configure if parent_const.respond_to? :configure namespace.pop end default_config = Client::Configuration.new parent_config default_config.rpcs.process_document.timeout = 300.0 default_config.rpcs.process_document.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.batch_process_documents.timeout = 120.0 default_config.rpcs.batch_process_documents.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.review_document.timeout = 120.0 default_config.rpcs.review_document.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config end yield @configure if block_given? @configure end |
Instance Method Details
#batch_process_documents(request, options = nil) ⇒ ::Gapic::Operation #batch_process_documents(name: nil, input_configs: nil, output_config: nil, input_documents: nil, document_output_config: nil, skip_human_review: nil, process_options: nil) ⇒ ::Gapic::Operation
LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 381 def batch_process_documents request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::BatchProcessRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.batch_process_documents..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.batch_process_documents.timeout, metadata: , retry_policy: @config.rpcs.batch_process_documents.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :batch_process_documents, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#configure {|config| ... } ⇒ Client::Configuration
Configure the DocumentProcessorService Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on configure.
See Configuration for a description of the configuration fields.
107 108 109 110 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 107 def configure yield @config if block_given? @config end |
#create_processor(request, options = nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::Processor #create_processor(parent: nil, processor: nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::Processor
Creates a processor from the
ProcessorType provided.
The processor will be at ENABLED
state by default after its creation.
1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 1503 def create_processor request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::CreateProcessorRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.create_processor..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent header_params["parent"] = request.parent end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.create_processor.timeout, metadata: , retry_policy: @config.rpcs.create_processor.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :create_processor, request, options: do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#delete_processor(request, options = nil) ⇒ ::Gapic::Operation #delete_processor(name: nil) ⇒ ::Gapic::Operation
Deletes the processor, unloads all deployed model artifacts if it was enabled and then deletes all artifacts associated with this processor.
1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 1596 def delete_processor request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.delete_processor..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.delete_processor.timeout, metadata: , retry_policy: @config.rpcs.delete_processor.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :delete_processor, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#delete_processor_version(request, options = nil) ⇒ ::Gapic::Operation #delete_processor_version(name: nil) ⇒ ::Gapic::Operation
Deletes the processor version, all artifacts under the processor version will be deleted.
1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 1222 def delete_processor_version request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorVersionRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.delete_processor_version..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.delete_processor_version.timeout, metadata: , retry_policy: @config.rpcs.delete_processor_version.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :delete_processor_version, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#deploy_processor_version(request, options = nil) ⇒ ::Gapic::Operation #deploy_processor_version(name: nil) ⇒ ::Gapic::Operation
Deploys the processor version.
1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 1315 def deploy_processor_version request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::DeployProcessorVersionRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.deploy_processor_version..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.deploy_processor_version.timeout, metadata: , retry_policy: @config.rpcs.deploy_processor_version.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :deploy_processor_version, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#disable_processor(request, options = nil) ⇒ ::Gapic::Operation #disable_processor(name: nil) ⇒ ::Gapic::Operation
Disables a processor
1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 1782 def disable_processor request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.disable_processor..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.disable_processor.timeout, metadata: , retry_policy: @config.rpcs.disable_processor.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :disable_processor, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#enable_processor(request, options = nil) ⇒ ::Gapic::Operation #enable_processor(name: nil) ⇒ ::Gapic::Operation
Enables a processor
1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 1689 def enable_processor request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.enable_processor..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.enable_processor.timeout, metadata: , retry_policy: @config.rpcs.enable_processor.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :enable_processor, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#evaluate_processor_version(request, options = nil) ⇒ ::Gapic::Operation #evaluate_processor_version(processor_version: nil, evaluation_documents: nil) ⇒ ::Gapic::Operation
Evaluates a ProcessorVersion against annotated documents, producing an Evaluation.
2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 2092 def evaluate_processor_version request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::EvaluateProcessorVersionRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.evaluate_processor_version..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.processor_version header_params["processor_version"] = request.processor_version end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.evaluate_processor_version.timeout, metadata: , retry_policy: @config.rpcs.evaluate_processor_version.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :evaluate_processor_version, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#fetch_processor_types(request, options = nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesResponse #fetch_processor_types(parent: nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesResponse
Fetches processor types. Note that we don't use ListProcessorTypes here, because it isn't paginated.
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 470 def fetch_processor_types request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.fetch_processor_types..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent header_params["parent"] = request.parent end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.fetch_processor_types.timeout, metadata: , retry_policy: @config.rpcs.fetch_processor_types.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :fetch_processor_types, request, options: do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#get_evaluation(request, options = nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::Evaluation #get_evaluation(name: nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::Evaluation
Retrieves a specific evaluation.
2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 2180 def get_evaluation request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::GetEvaluationRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_evaluation..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.get_evaluation.timeout, metadata: , retry_policy: @config.rpcs.get_evaluation.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :get_evaluation, request, options: do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#get_processor(request, options = nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::Processor #get_processor(name: nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::Processor
Gets a processor detail.
835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 835 def get_processor request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::GetProcessorRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_processor..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.get_processor.timeout, metadata: , retry_policy: @config.rpcs.get_processor.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :get_processor, request, options: do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#get_processor_type(request, options = nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::ProcessorType #get_processor_type(name: nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::ProcessorType
Gets a processor type detail.
652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 652 def get_processor_type request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::GetProcessorTypeRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_processor_type..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.get_processor_type.timeout, metadata: , retry_policy: @config.rpcs.get_processor_type.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :get_processor_type, request, options: do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#get_processor_version(request, options = nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion #get_processor_version(name: nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion
Gets a processor version detail.
1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 1030 def get_processor_version request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::GetProcessorVersionRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_processor_version..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.get_processor_version.timeout, metadata: , retry_policy: @config.rpcs.get_processor_version.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :get_processor_version, request, options: do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#import_processor_version(request, options = nil) ⇒ ::Gapic::Operation #import_processor_version(processor_version_source: nil, parent: nil) ⇒ ::Gapic::Operation
Imports a processor version from source processor version.
2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 2377 def import_processor_version request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::ImportProcessorVersionRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.import_processor_version..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent header_params["parent"] = request.parent end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.import_processor_version.timeout, metadata: , retry_policy: @config.rpcs.import_processor_version.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :import_processor_version, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#list_evaluations(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Evaluation> #list_evaluations(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Evaluation>
Retrieves a set of evaluations for a given processor version.
2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 2279 def list_evaluations request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::ListEvaluationsRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_evaluations..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent header_params["parent"] = request.parent end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.list_evaluations.timeout, metadata: , retry_policy: @config.rpcs.list_evaluations.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :list_evaluations, request, options: do |response, operation| response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_evaluations, request, response, operation, yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#list_processor_types(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorType> #list_processor_types(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorType>
Lists the processor types that exist.
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 566 def list_processor_types request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::ListProcessorTypesRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_processor_types..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent header_params["parent"] = request.parent end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.list_processor_types.timeout, metadata: , retry_policy: @config.rpcs.list_processor_types.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :list_processor_types, request, options: do |response, operation| response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_processor_types, request, response, operation, yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#list_processor_versions(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion> #list_processor_versions(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion>
Lists all versions of a processor.
1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 1128 def list_processor_versions request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::ListProcessorVersionsRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_processor_versions..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent header_params["parent"] = request.parent end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.list_processor_versions.timeout, metadata: , retry_policy: @config.rpcs.list_processor_versions.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :list_processor_versions, request, options: do |response, operation| response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_processor_versions, request, response, operation, yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#list_processors(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Processor> #list_processors(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Processor>
Lists all processors which belong to this project.
749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 749 def list_processors request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::ListProcessorsRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_processors..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent header_params["parent"] = request.parent end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.list_processors.timeout, metadata: , retry_policy: @config.rpcs.list_processors.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :list_processors, request, options: do |response, operation| response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_processors, request, response, operation, yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#process_document(request, options = nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::ProcessResponse #process_document(inline_document: nil, raw_document: nil, gcs_document: nil, name: nil, document: nil, skip_human_review: nil, field_mask: nil, process_options: nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::ProcessResponse
Processes a single document.
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 266 def process_document request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::ProcessRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.process_document..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.process_document.timeout, metadata: , retry_policy: @config.rpcs.process_document.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :process_document, request, options: do |response, operation| yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#review_document(request, options = nil) ⇒ ::Gapic::Operation #review_document(inline_document: nil, human_review_config: nil, document: nil, enable_schema_validation: nil, priority: nil, document_schema: nil) ⇒ ::Gapic::Operation
Send a document for Human Review. The input document should be processed by the specified processor.
1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 1992 def review_document request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::ReviewDocumentRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.review_document..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.human_review_config header_params["human_review_config"] = request.human_review_config end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.review_document.timeout, metadata: , retry_policy: @config.rpcs.review_document.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :review_document, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#set_default_processor_version(request, options = nil) ⇒ ::Gapic::Operation #set_default_processor_version(processor: nil, default_processor_version: nil) ⇒ ::Gapic::Operation
Set the default (active) version of a Processor that will be used in ProcessDocument and BatchProcessDocuments.
1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 1886 def set_default_processor_version request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::SetDefaultProcessorVersionRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.set_default_processor_version..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.processor header_params["processor"] = request.processor end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.set_default_processor_version.timeout, metadata: , retry_policy: @config.rpcs.set_default_processor_version.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :set_default_processor_version, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#train_processor_version(request, options = nil) ⇒ ::Gapic::Operation #train_processor_version(custom_document_extraction_options: nil, parent: nil, processor_version: nil, document_schema: nil, input_data: nil, base_processor_version: nil) ⇒ ::Gapic::Operation
Trains a new processor version. Operation metadata is returned as TrainProcessorVersionMetadata.
944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 944 def train_processor_version request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::TrainProcessorVersionRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.train_processor_version..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent header_params["parent"] = request.parent end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.train_processor_version.timeout, metadata: , retry_policy: @config.rpcs.train_processor_version.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :train_processor_version, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#undeploy_processor_version(request, options = nil) ⇒ ::Gapic::Operation #undeploy_processor_version(name: nil) ⇒ ::Gapic::Operation
Undeploys the processor version.
1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 |
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb', line 1408 def undeploy_processor_version request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::UndeployProcessorVersionRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.undeploy_processor_version..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.undeploy_processor_version.timeout, metadata: , retry_policy: @config.rpcs.undeploy_processor_version.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @document_processor_service_stub.call_rpc :undeploy_processor_version, request, options: do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: yield response, operation if block_given? return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |