Class: Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb

Overview

REST 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

Class Method Summary collapse

Instance Method Summary collapse

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 REST client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the DocumentProcessorService client.

Yield Parameters:



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
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 142

def initialize
  # 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.nil? ||
                           (@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 = ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Operations.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @config.endpoint
    config.universe_domain = @config.universe_domain
  end

  @document_processor_service_stub = ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::ServiceStub.new(
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    credentials: credentials
  )

  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @document_processor_service_stub.endpoint
    config.universe_domain = @document_processor_service_stub.universe_domain
    config.bindings_override = @config.bindings_override
  end
end

Instance Attribute Details

#location_clientGoogle::Cloud::Location::Locations::Rest::Client (readonly)

Get the associated client for mix-in of the Locations.

Returns:

  • (Google::Cloud::Location::Locations::Rest::Client)


200
201
202
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 200

def location_client
  @location_client
end

#operations_client::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Operations (readonly)

Get the associated client for long-running operations.



193
194
195
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 193

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.

Examples:


# Modify the configuration for all DocumentProcessorService clients
::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



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
91
92
93
94
95
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 65

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, labels: nil) ⇒ ::Gapic::Operation

LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::BatchProcessRequest.new

# Call the batch_process_documents method.
result = client.batch_process_documents request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #batch_process_documents(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to batch_process_documents via a request object, either of type BatchProcessRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::BatchProcessRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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, labels: nil) ⇒ ::Gapic::Operation

    Pass arguments to batch_process_documents via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 399

def batch_process_documents request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.batch_process_documents.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.batch_process_documents.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.batch_process_documents request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



112
113
114
115
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 112

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.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::CreateProcessorRequest.new

# Call the create_processor method.
result = client.create_processor request

# The returned object is of type Google::Cloud::DocumentAI::V1beta3::Processor.
p result

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 1440

def create_processor request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.create_processor.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_processor.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.create_processor request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest.new

# Call the delete_processor method.
result = client.delete_processor request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #delete_processor(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_processor via a request object, either of type Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #delete_processor(name: nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_processor via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The processor resource name to be deleted.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 1526

def delete_processor request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.delete_processor.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_processor.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.delete_processor request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::DeleteProcessorVersionRequest.new

# Call the delete_processor_version method.
result = client.delete_processor_version request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #delete_processor_version(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_processor_version via a request object, either of type Google::Cloud::DocumentAI::V1beta3::DeleteProcessorVersionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorVersionRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #delete_processor_version(name: nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_processor_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The processor version resource name to be deleted.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 1179

def delete_processor_version request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.delete_processor_version.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_processor_version.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.delete_processor_version request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::DeployProcessorVersionRequest.new

# Call the deploy_processor_version method.
result = client.deploy_processor_version request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #deploy_processor_version(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to deploy_processor_version via a request object, either of type Google::Cloud::DocumentAI::V1beta3::DeployProcessorVersionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::DeployProcessorVersionRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #deploy_processor_version(name: nil) ⇒ ::Gapic::Operation

    Pass arguments to deploy_processor_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The processor version resource name to be deployed.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 1265

def deploy_processor_version request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.deploy_processor_version.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.deploy_processor_version.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.deploy_processor_version request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest.new

# Call the disable_processor method.
result = client.disable_processor request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #disable_processor(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to disable_processor via a request object, either of type Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #disable_processor(name: nil) ⇒ ::Gapic::Operation

    Pass arguments to disable_processor via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The processor resource name to be disabled.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



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
1730
1731
1732
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 1698

def disable_processor request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.disable_processor.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.disable_processor.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.disable_processor request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest.new

# Call the enable_processor method.
result = client.enable_processor request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #enable_processor(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to enable_processor via a request object, either of type EnableProcessorRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #enable_processor(name: nil) ⇒ ::Gapic::Operation

    Pass arguments to enable_processor via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The processor resource name to be enabled.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



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
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 1612

def enable_processor request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.enable_processor.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.enable_processor.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.enable_processor request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::EvaluateProcessorVersionRequest.new

# Call the evaluate_processor_version method.
result = client.evaluate_processor_version request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #evaluate_processor_version(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to evaluate_processor_version via a request object, either of type EvaluateProcessorVersionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::EvaluateProcessorVersionRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #evaluate_processor_version(processor_version: nil, evaluation_documents: nil) ⇒ ::Gapic::Operation

    Pass arguments to evaluate_processor_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • processor_version (::String) (defaults to: nil)

      Required. The resource name of the ProcessorVersion to evaluate. projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}

    • evaluation_documents (::Google::Cloud::DocumentAI::V1beta3::BatchDocumentsInputConfig, ::Hash) (defaults to: nil)

      Optional. The documents used in the evaluation. If unspecified, use the processor's dataset as evaluation input.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1987
1988
1989
1990
1991
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
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 1987

def evaluate_processor_version request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.evaluate_processor_version.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.evaluate_processor_version.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.evaluate_processor_version request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesRequest.new

# Call the fetch_processor_types method.
result = client.fetch_processor_types request

# The returned object is of type Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesResponse.
p result

Overloads:

  • #fetch_processor_types(request, options = nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesResponse

    Pass arguments to fetch_processor_types via a request object, either of type FetchProcessorTypesRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #fetch_processor_types(parent: nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesResponse

    Pass arguments to fetch_processor_types via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The location of processor types to list. Format: projects/{project}/locations/{location}.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



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
510
511
512
513
514
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 481

def fetch_processor_types request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.fetch_processor_types.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.fetch_processor_types.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.fetch_processor_types request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::GetEvaluationRequest.new

# Call the get_evaluation method.
result = client.get_evaluation request

# The returned object is of type Google::Cloud::DocumentAI::V1beta3::Evaluation.
p result

Overloads:

  • #get_evaluation(request, options = nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::Evaluation

    Pass arguments to get_evaluation via a request object, either of type GetEvaluationRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::GetEvaluationRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #get_evaluation(name: nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::Evaluation

    Pass arguments to get_evaluation via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The resource name of the Evaluation to get. projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 2068

def get_evaluation request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_evaluation.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_evaluation.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.get_evaluation request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::GetProcessorRequest.new

# Call the get_processor method.
result = client.get_processor request

# The returned object is of type Google::Cloud::DocumentAI::V1beta3::Processor.
p result

Overloads:

  • #get_processor(request, options = nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::Processor

    Pass arguments to get_processor via a request object, either of type GetProcessorRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::GetProcessorRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #get_processor(name: nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::Processor

    Pass arguments to get_processor via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The processor resource name.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 818

def get_processor request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_processor.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_processor.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.get_processor request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::GetProcessorTypeRequest.new

# Call the get_processor_type method.
result = client.get_processor_type request

# The returned object is of type Google::Cloud::DocumentAI::V1beta3::ProcessorType.
p result

Overloads:

  • #get_processor_type(request, options = nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::ProcessorType

    Pass arguments to get_processor_type via a request object, either of type GetProcessorTypeRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::GetProcessorTypeRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #get_processor_type(name: nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::ProcessorType

    Pass arguments to get_processor_type via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The processor type resource name.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



649
650
651
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
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 649

def get_processor_type request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_processor_type.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_processor_type.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.get_processor_type request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::GetProcessorVersionRequest.new

# Call the get_processor_version method.
result = client.get_processor_version request

# The returned object is of type Google::Cloud::DocumentAI::V1beta3::ProcessorVersion.
p result

Overloads:

  • #get_processor_version(request, options = nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion

    Pass arguments to get_processor_version via a request object, either of type GetProcessorVersionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::GetProcessorVersionRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #get_processor_version(name: nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion

    Pass arguments to get_processor_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The processor resource name.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 1001

def get_processor_version request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_processor_version.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_processor_version.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.get_processor_version request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#import_processor_version(request, options = nil) ⇒ ::Gapic::Operation #import_processor_version(processor_version_source: nil, external_processor_version_source: nil, parent: nil) ⇒ ::Gapic::Operation

Imports a processor version from source processor version.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::ImportProcessorVersionRequest.new

# Call the import_processor_version method.
result = client.import_processor_version request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #import_processor_version(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to import_processor_version via a request object, either of type ImportProcessorVersionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::ImportProcessorVersionRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #import_processor_version(processor_version_source: nil, external_processor_version_source: nil, parent: nil) ⇒ ::Gapic::Operation

    Pass arguments to import_processor_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • processor_version_source (::String) (defaults to: nil)

      The source processor version to import from. The source processor version and destination processor need to be in the same environment and region.

    • external_processor_version_source (::Google::Cloud::DocumentAI::V1beta3::ImportProcessorVersionRequest::ExternalProcessorVersionSource, ::Hash) (defaults to: nil)

      The source processor version to import from. It can be from a different environment and region than the destination processor.

    • parent (::String) (defaults to: nil)

      Required. The destination processor name to create the processor version in. Format: projects/{project}/locations/{location}/processors/{processor}

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 2254

def import_processor_version request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.import_processor_version.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.import_processor_version.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.import_processor_version request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_evaluations(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Evaluation> #list_evaluations(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Evaluation>

Retrieves a set of evaluations for a given processor version.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::ListEvaluationsRequest.new

# Call the list_evaluations method.
result = client.list_evaluations request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::DocumentAI::V1beta3::Evaluation.
  p item
end

Overloads:

  • #list_evaluations(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Evaluation>

    Pass arguments to list_evaluations via a request object, either of type ListEvaluationsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::ListEvaluationsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #list_evaluations(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Evaluation>

    Pass arguments to list_evaluations via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The resource name of the ProcessorVersion to list evaluations for. projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}

    • page_size (::Integer) (defaults to: nil)

      The standard list page size. If unspecified, at most 5 evaluations are returned. The maximum value is 100. Values above 100 are coerced to 100.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous ListEvaluations call. Provide this to retrieve the subsequent page.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 2160

def list_evaluations request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_evaluations.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_evaluations.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.list_evaluations request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @document_processor_service_stub, :list_evaluations, "evaluations", request, result, options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_processor_types(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorType> #list_processor_types(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorType>

Lists the processor types that exist.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::ListProcessorTypesRequest.new

# Call the list_processor_types method.
result = client.list_processor_types request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::DocumentAI::V1beta3::ProcessorType.
  p item
end

Overloads:

  • #list_processor_types(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorType>

    Pass arguments to list_processor_types via a request object, either of type ListProcessorTypesRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::ListProcessorTypesRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #list_processor_types(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorType>

    Pass arguments to list_processor_types via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The location of processor types to list. Format: projects/{project}/locations/{location}.

    • page_size (::Integer) (defaults to: nil)

      The maximum number of processor types to return. If unspecified, at most 100 processor types will be returned. The maximum value is 500. Values above 500 will be coerced to 500.

    • page_token (::String) (defaults to: nil)

      Used to retrieve the next page of results, empty if at the end of the list.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



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
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 570

def list_processor_types request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_processor_types.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_processor_types.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.list_processor_types request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @document_processor_service_stub, :list_processor_types, "processor_types", request, result, options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_processor_versions(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion> #list_processor_versions(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion>

Lists all versions of a processor.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::ListProcessorVersionsRequest.new

# Call the list_processor_versions method.
result = client.list_processor_versions request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion.
  p item
end

Overloads:

  • #list_processor_versions(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion>

    Pass arguments to list_processor_versions via a request object, either of type ListProcessorVersionsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::ListProcessorVersionsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #list_processor_versions(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion>

    Pass arguments to list_processor_versions via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The parent (project, location and processor) to list all versions. Format: projects/{project}/locations/{location}/processors/{processor}

    • page_size (::Integer) (defaults to: nil)

      The maximum number of processor versions to return. If unspecified, at most 10 processor versions will be returned. The maximum value is 20. Values above 20 will be coerced to 20.

    • page_token (::String) (defaults to: nil)

      We will return the processor versions sorted by creation time. The page token will point to the next processor version.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 1092

def list_processor_versions request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_processor_versions.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_processor_versions.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.list_processor_versions request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @document_processor_service_stub, :list_processor_versions, "processor_versions", request, result, options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_processors(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Processor> #list_processors(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Processor>

Lists all processors which belong to this project.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::ListProcessorsRequest.new

# Call the list_processors method.
result = client.list_processors request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::DocumentAI::V1beta3::Processor.
  p item
end

Overloads:

  • #list_processors(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Processor>

    Pass arguments to list_processors via a request object, either of type ListProcessorsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::ListProcessorsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #list_processors(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Processor>

    Pass arguments to list_processors via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The parent (project and location) which owns this collection of Processors. Format: projects/{project}/locations/{location}

    • page_size (::Integer) (defaults to: nil)

      The maximum number of processors to return. If unspecified, at most 50 processors will be returned. The maximum value is 100. Values above 100 will be coerced to 100.

    • page_token (::String) (defaults to: nil)

      We will return the processors sorted by creation time. The page token will point to the next processor.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



739
740
741
742
743
744
745
746
747
748
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
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 739

def list_processors request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_processors.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_processors.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.list_processors request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @document_processor_service_stub, :list_processors, "processors", request, result, options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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, labels: nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::ProcessResponse

Processes a single document.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::ProcessRequest.new

# Call the process_document method.
result = client.process_document request

# The returned object is of type Google::Cloud::DocumentAI::V1beta3::ProcessResponse.
p result

Overloads:

  • #process_document(request, options = nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::ProcessResponse

    Pass arguments to process_document via a request object, either of type ProcessRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::ProcessRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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, labels: nil) ⇒ ::Google::Cloud::DocumentAI::V1beta3::ProcessResponse

    Pass arguments to process_document via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • inline_document (::Google::Cloud::DocumentAI::V1beta3::Document, ::Hash) (defaults to: nil)

      An inline document proto.

    • raw_document (::Google::Cloud::DocumentAI::V1beta3::RawDocument, ::Hash) (defaults to: nil)

      A raw document content (bytes).

    • gcs_document (::Google::Cloud::DocumentAI::V1beta3::GcsDocument, ::Hash) (defaults to: nil)

      A raw document on Google Cloud Storage.

    • name (::String) (defaults to: nil)

      Required. The resource name of the Processor or ProcessorVersion to use for processing. If a Processor is specified, the server will use its [default version][google.cloud.documentai.v1beta3.Processor.default_processor_version]. Format: projects/{project}/locations/{location}/processors/{processor}, or projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}

    • document (::Google::Cloud::DocumentAI::V1beta3::Document, ::Hash) (defaults to: nil)

      The document payload, the content and mime_type fields must be set.

    • skip_human_review (::Boolean) (defaults to: nil)

      Whether human review should be skipped for this request. Default to false.

    • field_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      Specifies which fields to include in the ProcessResponse.document output. Only supports top-level document and pages field, so it must be in the form of {document_field_name} or pages.{page_field_name}.

    • process_options (::Google::Cloud::DocumentAI::V1beta3::ProcessOptions, ::Hash) (defaults to: nil)

      Inference-time options for the process API

    • labels (::Hash{::String => ::String}) (defaults to: nil)

      Optional. The labels with user-defined metadata for the request.

      Label keys and values can be no longer than 63 characters (Unicode codepoints) and can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 284

def process_document request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.process_document.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.process_document.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.process_document request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::ReviewDocumentRequest.new

# Call the review_document method.
result = client.review_document request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #review_document(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to review_document via a request object, either of type ReviewDocumentRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::ReviewDocumentRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #review_document(inline_document: nil, human_review_config: nil, document: nil, enable_schema_validation: nil, priority: nil, document_schema: nil) ⇒ ::Gapic::Operation

    Pass arguments to review_document via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



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
1927
1928
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 1894

def review_document request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.review_document.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.review_document.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.review_document request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::SetDefaultProcessorVersionRequest.new

# Call the set_default_processor_version method.
result = client.set_default_processor_version request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #set_default_processor_version(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to set_default_processor_version via a request object, either of type SetDefaultProcessorVersionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::SetDefaultProcessorVersionRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #set_default_processor_version(processor: nil, default_processor_version: nil) ⇒ ::Gapic::Operation

    Pass arguments to set_default_processor_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • processor (::String) (defaults to: nil)

      Required. The resource name of the Processor to change default version.

    • default_processor_version (::String) (defaults to: nil)

      Required. The resource name of child ProcessorVersion to use as default. Format: projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



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
1823
1824
1825
1826
1827
1828
1829
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 1795

def set_default_processor_version request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.set_default_processor_version.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.set_default_processor_version.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.set_default_processor_version request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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, foundation_model_tuning_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.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::TrainProcessorVersionRequest.new

# Call the train_processor_version method.
result = client.train_processor_version request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #train_processor_version(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to train_processor_version via a request object, either of type TrainProcessorVersionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::TrainProcessorVersionRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #train_processor_version(custom_document_extraction_options: nil, foundation_model_tuning_options: nil, parent: nil, processor_version: nil, document_schema: nil, input_data: nil, base_processor_version: nil) ⇒ ::Gapic::Operation

    Pass arguments to train_processor_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 922

def train_processor_version request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.train_processor_version.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.train_processor_version.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.train_processor_version request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => 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.

Examples:

Basic example

require "google/cloud/document_ai/v1beta3"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DocumentAI::V1beta3::UndeployProcessorVersionRequest.new

# Call the undeploy_processor_version method.
result = client.undeploy_processor_version request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #undeploy_processor_version(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to undeploy_processor_version via a request object, either of type UndeployProcessorVersionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DocumentAI::V1beta3::UndeployProcessorVersionRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #undeploy_processor_version(name: nil) ⇒ ::Gapic::Operation

    Pass arguments to undeploy_processor_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The processor version resource name to be undeployed.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 1351

def undeploy_processor_version request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.undeploy_processor_version.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.undeploy_processor_version.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @document_processor_service_stub.undeploy_processor_version request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#universe_domainString

The effective universe domain

Returns:

  • (String)


122
123
124
# File 'lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb', line 122

def universe_domain
  @document_processor_service_stub.universe_domain
end