google-apis-documentai_v1beta2 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +13 -0
- data/CHANGELOG.md +7 -0
- data/LICENSE.md +202 -0
- data/OVERVIEW.md +96 -0
- data/lib/google-apis-documentai_v1beta2.rb +15 -0
- data/lib/google/apis/documentai_v1beta2.rb +38 -0
- data/lib/google/apis/documentai_v1beta2/classes.rb +5129 -0
- data/lib/google/apis/documentai_v1beta2/gem_version.rb +28 -0
- data/lib/google/apis/documentai_v1beta2/representations.rb +2303 -0
- data/lib/google/apis/documentai_v1beta2/service.rb +269 -0
- metadata +76 -0
@@ -0,0 +1,269 @@
|
|
1
|
+
# Copyright 2020 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'google/apis/core/base_service'
|
16
|
+
require 'google/apis/core/json_representation'
|
17
|
+
require 'google/apis/core/hashable'
|
18
|
+
require 'google/apis/errors'
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Apis
|
22
|
+
module DocumentaiV1beta2
|
23
|
+
# Cloud Document AI API
|
24
|
+
#
|
25
|
+
# Service to parse structured information from unstructured or semi-structured
|
26
|
+
# documents using state-of-the-art Google AI such as natural language, computer
|
27
|
+
# vision, translation, and AutoML.
|
28
|
+
#
|
29
|
+
# @example
|
30
|
+
# require 'google/apis/documentai_v1beta2'
|
31
|
+
#
|
32
|
+
# Documentai = Google::Apis::DocumentaiV1beta2 # Alias the module
|
33
|
+
# service = Documentai::DocumentService.new
|
34
|
+
#
|
35
|
+
# @see https://cloud.google.com/document-ai/docs/
|
36
|
+
class DocumentService < Google::Apis::Core::BaseService
|
37
|
+
# @return [String]
|
38
|
+
# API key. Your API key identifies your project and provides you with API access,
|
39
|
+
# quota, and reports. Required unless you provide an OAuth 2.0 token.
|
40
|
+
attr_accessor :key
|
41
|
+
|
42
|
+
# @return [String]
|
43
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
44
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
45
|
+
attr_accessor :quota_user
|
46
|
+
|
47
|
+
def initialize
|
48
|
+
super('https://documentai.googleapis.com/', '',
|
49
|
+
client_name: 'google-apis-documentai_v1beta2',
|
50
|
+
client_version: Google::Apis::DocumentaiV1beta2::GEM_VERSION)
|
51
|
+
@batch_path = 'batch'
|
52
|
+
end
|
53
|
+
|
54
|
+
# LRO endpoint to batch process many documents. The output is written to Cloud
|
55
|
+
# Storage as JSON in the [Document] format.
|
56
|
+
# @param [String] parent
|
57
|
+
# Target project and location to make a call. Format: `projects/`project-id`/
|
58
|
+
# locations/`location-id``. If no location is specified, a region will be chosen
|
59
|
+
# automatically.
|
60
|
+
# @param [Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2BatchProcessDocumentsRequest] google_cloud_documentai_v1beta2_batch_process_documents_request_object
|
61
|
+
# @param [String] fields
|
62
|
+
# Selector specifying which fields to include in a partial response.
|
63
|
+
# @param [String] quota_user
|
64
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
65
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
66
|
+
# @param [Google::Apis::RequestOptions] options
|
67
|
+
# Request-specific options
|
68
|
+
#
|
69
|
+
# @yield [result, err] Result & error if block supplied
|
70
|
+
# @yieldparam result [Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation] parsed result object
|
71
|
+
# @yieldparam err [StandardError] error object if request failed
|
72
|
+
#
|
73
|
+
# @return [Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation]
|
74
|
+
#
|
75
|
+
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
76
|
+
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
77
|
+
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
78
|
+
def batch_project_document_process(parent, google_cloud_documentai_v1beta2_batch_process_documents_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
|
79
|
+
command = make_simple_command(:post, 'v1beta2/{+parent}/documents:batchProcess', options)
|
80
|
+
command.request_representation = Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2BatchProcessDocumentsRequest::Representation
|
81
|
+
command.request_object = google_cloud_documentai_v1beta2_batch_process_documents_request_object
|
82
|
+
command.response_representation = Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation::Representation
|
83
|
+
command.response_class = Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation
|
84
|
+
command.params['parent'] = parent unless parent.nil?
|
85
|
+
command.query['fields'] = fields unless fields.nil?
|
86
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
87
|
+
execute_or_queue_command(command, &block)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Processes a single document.
|
91
|
+
# @param [String] parent
|
92
|
+
# Target project and location to make a call. Format: `projects/`project-id`/
|
93
|
+
# locations/`location-id``. If no location is specified, a region will be chosen
|
94
|
+
# automatically. This field is only populated when used in ProcessDocument
|
95
|
+
# method.
|
96
|
+
# @param [Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2ProcessDocumentRequest] google_cloud_documentai_v1beta2_process_document_request_object
|
97
|
+
# @param [String] fields
|
98
|
+
# Selector specifying which fields to include in a partial response.
|
99
|
+
# @param [String] quota_user
|
100
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
101
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
102
|
+
# @param [Google::Apis::RequestOptions] options
|
103
|
+
# Request-specific options
|
104
|
+
#
|
105
|
+
# @yield [result, err] Result & error if block supplied
|
106
|
+
# @yieldparam result [Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2Document] parsed result object
|
107
|
+
# @yieldparam err [StandardError] error object if request failed
|
108
|
+
#
|
109
|
+
# @return [Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2Document]
|
110
|
+
#
|
111
|
+
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
112
|
+
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
113
|
+
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
114
|
+
def process_project_document(parent, google_cloud_documentai_v1beta2_process_document_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
|
115
|
+
command = make_simple_command(:post, 'v1beta2/{+parent}/documents:process', options)
|
116
|
+
command.request_representation = Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2ProcessDocumentRequest::Representation
|
117
|
+
command.request_object = google_cloud_documentai_v1beta2_process_document_request_object
|
118
|
+
command.response_representation = Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2Document::Representation
|
119
|
+
command.response_class = Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2Document
|
120
|
+
command.params['parent'] = parent unless parent.nil?
|
121
|
+
command.query['fields'] = fields unless fields.nil?
|
122
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
123
|
+
execute_or_queue_command(command, &block)
|
124
|
+
end
|
125
|
+
|
126
|
+
# LRO endpoint to batch process many documents. The output is written to Cloud
|
127
|
+
# Storage as JSON in the [Document] format.
|
128
|
+
# @param [String] parent
|
129
|
+
# Target project and location to make a call. Format: `projects/`project-id`/
|
130
|
+
# locations/`location-id``. If no location is specified, a region will be chosen
|
131
|
+
# automatically.
|
132
|
+
# @param [Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2BatchProcessDocumentsRequest] google_cloud_documentai_v1beta2_batch_process_documents_request_object
|
133
|
+
# @param [String] fields
|
134
|
+
# Selector specifying which fields to include in a partial response.
|
135
|
+
# @param [String] quota_user
|
136
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
137
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
138
|
+
# @param [Google::Apis::RequestOptions] options
|
139
|
+
# Request-specific options
|
140
|
+
#
|
141
|
+
# @yield [result, err] Result & error if block supplied
|
142
|
+
# @yieldparam result [Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation] parsed result object
|
143
|
+
# @yieldparam err [StandardError] error object if request failed
|
144
|
+
#
|
145
|
+
# @return [Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation]
|
146
|
+
#
|
147
|
+
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
148
|
+
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
149
|
+
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
150
|
+
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)
|
151
|
+
command = make_simple_command(:post, 'v1beta2/{+parent}/documents:batchProcess', options)
|
152
|
+
command.request_representation = Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2BatchProcessDocumentsRequest::Representation
|
153
|
+
command.request_object = google_cloud_documentai_v1beta2_batch_process_documents_request_object
|
154
|
+
command.response_representation = Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation::Representation
|
155
|
+
command.response_class = Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation
|
156
|
+
command.params['parent'] = parent unless parent.nil?
|
157
|
+
command.query['fields'] = fields unless fields.nil?
|
158
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
159
|
+
execute_or_queue_command(command, &block)
|
160
|
+
end
|
161
|
+
|
162
|
+
# Processes a single document.
|
163
|
+
# @param [String] parent
|
164
|
+
# Target project and location to make a call. Format: `projects/`project-id`/
|
165
|
+
# locations/`location-id``. If no location is specified, a region will be chosen
|
166
|
+
# automatically. This field is only populated when used in ProcessDocument
|
167
|
+
# method.
|
168
|
+
# @param [Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2ProcessDocumentRequest] google_cloud_documentai_v1beta2_process_document_request_object
|
169
|
+
# @param [String] fields
|
170
|
+
# Selector specifying which fields to include in a partial response.
|
171
|
+
# @param [String] quota_user
|
172
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
173
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
174
|
+
# @param [Google::Apis::RequestOptions] options
|
175
|
+
# Request-specific options
|
176
|
+
#
|
177
|
+
# @yield [result, err] Result & error if block supplied
|
178
|
+
# @yieldparam result [Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2Document] parsed result object
|
179
|
+
# @yieldparam err [StandardError] error object if request failed
|
180
|
+
#
|
181
|
+
# @return [Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2Document]
|
182
|
+
#
|
183
|
+
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
184
|
+
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
185
|
+
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
186
|
+
def process_project_location_document(parent, google_cloud_documentai_v1beta2_process_document_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
|
187
|
+
command = make_simple_command(:post, 'v1beta2/{+parent}/documents:process', options)
|
188
|
+
command.request_representation = Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2ProcessDocumentRequest::Representation
|
189
|
+
command.request_object = google_cloud_documentai_v1beta2_process_document_request_object
|
190
|
+
command.response_representation = Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2Document::Representation
|
191
|
+
command.response_class = Google::Apis::DocumentaiV1beta2::GoogleCloudDocumentaiV1beta2Document
|
192
|
+
command.params['parent'] = parent unless parent.nil?
|
193
|
+
command.query['fields'] = fields unless fields.nil?
|
194
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
195
|
+
execute_or_queue_command(command, &block)
|
196
|
+
end
|
197
|
+
|
198
|
+
# Gets the latest state of a long-running operation. Clients can use this method
|
199
|
+
# to poll the operation result at intervals as recommended by the API service.
|
200
|
+
# @param [String] name
|
201
|
+
# The name of the operation resource.
|
202
|
+
# @param [String] fields
|
203
|
+
# Selector specifying which fields to include in a partial response.
|
204
|
+
# @param [String] quota_user
|
205
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
206
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
207
|
+
# @param [Google::Apis::RequestOptions] options
|
208
|
+
# Request-specific options
|
209
|
+
#
|
210
|
+
# @yield [result, err] Result & error if block supplied
|
211
|
+
# @yieldparam result [Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation] parsed result object
|
212
|
+
# @yieldparam err [StandardError] error object if request failed
|
213
|
+
#
|
214
|
+
# @return [Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation]
|
215
|
+
#
|
216
|
+
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
217
|
+
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
218
|
+
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
219
|
+
def get_project_location_operation(name, fields: nil, quota_user: nil, options: nil, &block)
|
220
|
+
command = make_simple_command(:get, 'v1beta2/{+name}', options)
|
221
|
+
command.response_representation = Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation::Representation
|
222
|
+
command.response_class = Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation
|
223
|
+
command.params['name'] = name unless name.nil?
|
224
|
+
command.query['fields'] = fields unless fields.nil?
|
225
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
226
|
+
execute_or_queue_command(command, &block)
|
227
|
+
end
|
228
|
+
|
229
|
+
# Gets the latest state of a long-running operation. Clients can use this method
|
230
|
+
# to poll the operation result at intervals as recommended by the API service.
|
231
|
+
# @param [String] name
|
232
|
+
# The name of the operation resource.
|
233
|
+
# @param [String] fields
|
234
|
+
# Selector specifying which fields to include in a partial response.
|
235
|
+
# @param [String] quota_user
|
236
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
237
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
238
|
+
# @param [Google::Apis::RequestOptions] options
|
239
|
+
# Request-specific options
|
240
|
+
#
|
241
|
+
# @yield [result, err] Result & error if block supplied
|
242
|
+
# @yieldparam result [Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation] parsed result object
|
243
|
+
# @yieldparam err [StandardError] error object if request failed
|
244
|
+
#
|
245
|
+
# @return [Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation]
|
246
|
+
#
|
247
|
+
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
248
|
+
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
249
|
+
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
250
|
+
def get_project_operation(name, fields: nil, quota_user: nil, options: nil, &block)
|
251
|
+
command = make_simple_command(:get, 'v1beta2/{+name}', options)
|
252
|
+
command.response_representation = Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation::Representation
|
253
|
+
command.response_class = Google::Apis::DocumentaiV1beta2::GoogleLongrunningOperation
|
254
|
+
command.params['name'] = name unless name.nil?
|
255
|
+
command.query['fields'] = fields unless fields.nil?
|
256
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
257
|
+
execute_or_queue_command(command, &block)
|
258
|
+
end
|
259
|
+
|
260
|
+
protected
|
261
|
+
|
262
|
+
def apply_command_defaults(command)
|
263
|
+
command.query['key'] = key unless key.nil?
|
264
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: google-apis-documentai_v1beta2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Google LLC
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-01-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: google-apis-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.1'
|
27
|
+
description: This is the simple REST client for Cloud Document AI API V1beta2. Simple
|
28
|
+
REST clients are Ruby client libraries that provide access to Google services via
|
29
|
+
their HTTP REST API endpoints. These libraries are generated and updated automatically
|
30
|
+
based on the discovery documents published by the service, and they handle most
|
31
|
+
concerns such as authentication, pagination, retry, timeouts, and logging. You can
|
32
|
+
use this client to access the Cloud Document AI API, but note that some services
|
33
|
+
may provide a separate modern client that is easier to use.
|
34
|
+
email: googleapis-packages@google.com
|
35
|
+
executables: []
|
36
|
+
extensions: []
|
37
|
+
extra_rdoc_files: []
|
38
|
+
files:
|
39
|
+
- ".yardopts"
|
40
|
+
- CHANGELOG.md
|
41
|
+
- LICENSE.md
|
42
|
+
- OVERVIEW.md
|
43
|
+
- lib/google-apis-documentai_v1beta2.rb
|
44
|
+
- lib/google/apis/documentai_v1beta2.rb
|
45
|
+
- lib/google/apis/documentai_v1beta2/classes.rb
|
46
|
+
- lib/google/apis/documentai_v1beta2/gem_version.rb
|
47
|
+
- lib/google/apis/documentai_v1beta2/representations.rb
|
48
|
+
- lib/google/apis/documentai_v1beta2/service.rb
|
49
|
+
homepage: https://github.com/google/google-api-ruby-client
|
50
|
+
licenses:
|
51
|
+
- Apache-2.0
|
52
|
+
metadata:
|
53
|
+
bug_tracker_uri: https://github.com/googleapis/google-api-ruby-client/issues
|
54
|
+
changelog_uri: https://github.com/googleapis/google-api-ruby-client/tree/master/generated/google-apis-documentai_v1beta2/CHANGELOG.md
|
55
|
+
documentation_uri: https://googleapis.dev/ruby/google-apis-documentai_v1beta2/v0.1.0
|
56
|
+
source_code_uri: https://github.com/googleapis/google-api-ruby-client/tree/master/generated/google-apis-documentai_v1beta2
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '2.4'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubygems_version: 3.1.4
|
73
|
+
signing_key:
|
74
|
+
specification_version: 4
|
75
|
+
summary: Simple REST client for Cloud Document AI API V1beta2
|
76
|
+
test_files: []
|