Class: Google::Apis::DocumentaiV1beta2::DocumentService

Inherits:
Core::BaseService
  • Object
show all
Defined in:
generated/google/apis/documentai_v1beta2/service.rb

Overview

Cloud Document AI API

Service to parse structured information from unstructured or semi-structured documents using state-of-the-art Google AI such as natural language, computer vision, translation, and AutoML.

Examples:

require 'google/apis/documentai_v1beta2'

Documentai = Google::Apis::DocumentaiV1beta2 # Alias the module
service = Documentai::DocumentService.new

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDocumentService

Returns a new instance of DocumentService.



47
48
49
50
# File 'generated/google/apis/documentai_v1beta2/service.rb', line 47

def initialize
  super('https://documentai.googleapis.com/', '')
  @batch_path = 'batch'
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.



40
41
42
# File 'generated/google/apis/documentai_v1beta2/service.rb', line 40

def key
  @key
end

#quota_userString

Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

Returns:

  • (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.



45
46
47
# File 'generated/google/apis/documentai_v1beta2/service.rb', line 45

def quota_user
  @quota_user
end

Instance Method Details

#batch_project_document_process(parent, google_cloud_documentai_v1beta2_batch_process_documents_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation

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

Parameters:

  • parent (String)

    Target project and location to make a call. Format: projects/project-id/ locations/location-id``. If no location is specified, a region will be chosen automatically.

  • google_cloud_documentai_v1beta2_batch_process_documents_request_object (Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2BatchProcessDocumentsRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



76
77
78
79
80
81
82
83
84
85
86
# File 'generated/google/apis/documentai_v1beta2/service.rb', line 76

def batch_project_document_process(parent, google_cloud_documentai_v1beta2_batch_process_documents_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1beta2/{+parent}/documents:batchProcess', options)
  command.request_representation = Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2BatchProcessDocumentsRequest::Representation
  command.request_object = google_cloud_documentai_v1beta2_batch_process_documents_request_object
  command.response_representation = Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation::Representation
  command.response_class = Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#batch_project_location_document_process(parent, google_cloud_documentai_v1beta2_batch_process_documents_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation

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

Parameters:

  • parent (String)

    Target project and location to make a call. Format: projects/project-id/ locations/location-id``. If no location is specified, a region will be chosen automatically.

  • google_cloud_documentai_v1beta2_batch_process_documents_request_object (Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2BatchProcessDocumentsRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



148
149
150
151
152
153
154
155
156
157
158
# File 'generated/google/apis/documentai_v1beta2/service.rb', line 148

def batch_project_location_document_process(parent, google_cloud_documentai_v1beta2_batch_process_documents_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1beta2/{+parent}/documents:batchProcess', options)
  command.request_representation = Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2BatchProcessDocumentsRequest::Representation
  command.request_object = google_cloud_documentai_v1beta2_batch_process_documents_request_object
  command.response_representation = Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation::Representation
  command.response_class = Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_project_location_operation(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters:

  • name (String)

    The name of the operation resource.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



217
218
219
220
221
222
223
224
225
# File 'generated/google/apis/documentai_v1beta2/service.rb', line 217

def get_project_location_operation(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1beta2/{+name}', options)
  command.response_representation = Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation::Representation
  command.response_class = Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_project_operation(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters:

  • name (String)

    The name of the operation resource.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



248
249
250
251
252
253
254
255
256
# File 'generated/google/apis/documentai_v1beta2/service.rb', line 248

def get_project_operation(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1beta2/{+name}', options)
  command.response_representation = Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation::Representation
  command.response_class = Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#process_project_document(parent, google_cloud_documentai_v1beta2_process_document_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2Document

Processes a single document.

Parameters:

  • parent (String)

    Target project and location to make a call. Format: projects/project-id/ locations/location-id``. If no location is specified, a region will be chosen automatically. This field is only populated when used in ProcessDocument method.

  • google_cloud_documentai_v1beta2_process_document_request_object (Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2ProcessDocumentRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



112
113
114
115
116
117
118
119
120
121
122
# File 'generated/google/apis/documentai_v1beta2/service.rb', line 112

def process_project_document(parent, google_cloud_documentai_v1beta2_process_document_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1beta2/{+parent}/documents:process', options)
  command.request_representation = Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2ProcessDocumentRequest::Representation
  command.request_object = google_cloud_documentai_v1beta2_process_document_request_object
  command.response_representation = Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2Document::Representation
  command.response_class = Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2Document
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#process_project_location_document(parent, google_cloud_documentai_v1beta2_process_document_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2Document

Processes a single document.

Parameters:

  • parent (String)

    Target project and location to make a call. Format: projects/project-id/ locations/location-id``. If no location is specified, a region will be chosen automatically. This field is only populated when used in ProcessDocument method.

  • google_cloud_documentai_v1beta2_process_document_request_object (Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2ProcessDocumentRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



184
185
186
187
188
189
190
191
192
193
194
# File 'generated/google/apis/documentai_v1beta2/service.rb', line 184

def process_project_location_document(parent, google_cloud_documentai_v1beta2_process_document_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1beta2/{+parent}/documents:process', options)
  command.request_representation = Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2ProcessDocumentRequest::Representation
  command.request_object = google_cloud_documentai_v1beta2_process_document_request_object
  command.response_representation = Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2Document::Representation
  command.response_class = Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2Document
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end