google-cloud-document_ai-v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +139 -0
  6. data/lib/google-cloud-document_ai-v1.rb +21 -0
  7. data/lib/google/cloud/document_ai/v1.rb +38 -0
  8. data/lib/google/cloud/document_ai/v1/document_processor_service.rb +53 -0
  9. data/lib/google/cloud/document_ai/v1/document_processor_service/client.rb +581 -0
  10. data/lib/google/cloud/document_ai/v1/document_processor_service/credentials.rb +51 -0
  11. data/lib/google/cloud/document_ai/v1/document_processor_service/operations.rb +655 -0
  12. data/lib/google/cloud/document_ai/v1/document_processor_service/paths.rb +71 -0
  13. data/lib/google/cloud/document_ai/v1/version.rb +28 -0
  14. data/lib/google/cloud/documentai/v1/document_io_pb.rb +54 -0
  15. data/lib/google/cloud/documentai/v1/document_pb.rb +298 -0
  16. data/lib/google/cloud/documentai/v1/document_processor_service_pb.rb +107 -0
  17. data/lib/google/cloud/documentai/v1/document_processor_service_services_pb.rb +54 -0
  18. data/lib/google/cloud/documentai/v1/geometry_pb.rb +34 -0
  19. data/lib/google/cloud/documentai/v1/operation_metadata_pb.rb +36 -0
  20. data/proto_docs/README.md +4 -0
  21. data/proto_docs/google/api/field_behavior.rb +65 -0
  22. data/proto_docs/google/api/resource.rb +283 -0
  23. data/proto_docs/google/cloud/documentai/v1/document.rb +791 -0
  24. data/proto_docs/google/cloud/documentai/v1/document_io.rb +100 -0
  25. data/proto_docs/google/cloud/documentai/v1/document_processor_service.rb +221 -0
  26. data/proto_docs/google/cloud/documentai/v1/geometry.rb +65 -0
  27. data/proto_docs/google/cloud/documentai/v1/operation_metadata.rb +65 -0
  28. data/proto_docs/google/longrunning/operations.rb +164 -0
  29. data/proto_docs/google/protobuf/any.rb +141 -0
  30. data/proto_docs/google/protobuf/duration.rb +98 -0
  31. data/proto_docs/google/protobuf/empty.rb +36 -0
  32. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  33. data/proto_docs/google/protobuf/timestamp.rb +129 -0
  34. data/proto_docs/google/protobuf/wrappers.rb +121 -0
  35. data/proto_docs/google/rpc/status.rb +46 -0
  36. data/proto_docs/google/type/color.rb +173 -0
  37. data/proto_docs/google/type/date.rb +53 -0
  38. data/proto_docs/google/type/datetime.rb +99 -0
  39. data/proto_docs/google/type/money.rb +43 -0
  40. data/proto_docs/google/type/postal_address.rb +135 -0
  41. metadata +231 -0
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module DocumentAI
23
+ module V1
24
+ # Payload message of raw document content (bytes).
25
+ # @!attribute [rw] content
26
+ # @return [::String]
27
+ # Inline document content.
28
+ # @!attribute [rw] mime_type
29
+ # @return [::String]
30
+ # An IANA MIME type (RFC6838) indicating the nature and format of the
31
+ # [content].
32
+ class RawDocument
33
+ include ::Google::Protobuf::MessageExts
34
+ extend ::Google::Protobuf::MessageExts::ClassMethods
35
+ end
36
+
37
+ # Specifies a document stored on Cloud Storage.
38
+ # @!attribute [rw] gcs_uri
39
+ # @return [::String]
40
+ # The Cloud Storage object uri.
41
+ # @!attribute [rw] mime_type
42
+ # @return [::String]
43
+ # An IANA MIME type (RFC6838) of the content.
44
+ class GcsDocument
45
+ include ::Google::Protobuf::MessageExts
46
+ extend ::Google::Protobuf::MessageExts::ClassMethods
47
+ end
48
+
49
+ # Specifies a set of documents on Cloud Storage.
50
+ # @!attribute [rw] documents
51
+ # @return [::Array<::Google::Cloud::DocumentAI::V1::GcsDocument>]
52
+ # The list of documents.
53
+ class GcsDocuments
54
+ include ::Google::Protobuf::MessageExts
55
+ extend ::Google::Protobuf::MessageExts::ClassMethods
56
+ end
57
+
58
+ # Specifies all documents on Cloud Storage with a common prefix.
59
+ # @!attribute [rw] gcs_uri_prefix
60
+ # @return [::String]
61
+ # The URI prefix.
62
+ class GcsPrefix
63
+ include ::Google::Protobuf::MessageExts
64
+ extend ::Google::Protobuf::MessageExts::ClassMethods
65
+ end
66
+
67
+ # The common config to specify a set of documents used as input.
68
+ # @!attribute [rw] gcs_prefix
69
+ # @return [::Google::Cloud::DocumentAI::V1::GcsPrefix]
70
+ # The set of documents that match the specified Cloud Storage [gcs_prefix].
71
+ # @!attribute [rw] gcs_documents
72
+ # @return [::Google::Cloud::DocumentAI::V1::GcsDocuments]
73
+ # The set of documents individually specified on Cloud Storage.
74
+ class BatchDocumentsInputConfig
75
+ include ::Google::Protobuf::MessageExts
76
+ extend ::Google::Protobuf::MessageExts::ClassMethods
77
+ end
78
+
79
+ # Config that controls the output of documents. All documents will be written
80
+ # as a JSON file.
81
+ # @!attribute [rw] gcs_output_config
82
+ # @return [::Google::Cloud::DocumentAI::V1::DocumentOutputConfig::GcsOutputConfig]
83
+ # Output config to write the results to Cloud Storage.
84
+ class DocumentOutputConfig
85
+ include ::Google::Protobuf::MessageExts
86
+ extend ::Google::Protobuf::MessageExts::ClassMethods
87
+
88
+ # The configuration used when outputting documents.
89
+ # @!attribute [rw] gcs_uri
90
+ # @return [::String]
91
+ # The Cloud Storage uri (a directory) of the output.
92
+ class GcsOutputConfig
93
+ include ::Google::Protobuf::MessageExts
94
+ extend ::Google::Protobuf::MessageExts::ClassMethods
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,221 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module DocumentAI
23
+ module V1
24
+ # Request message for the process document method.
25
+ # @!attribute [rw] inline_document
26
+ # @return [::Google::Cloud::DocumentAI::V1::Document]
27
+ # An inline document proto.
28
+ # @!attribute [rw] raw_document
29
+ # @return [::Google::Cloud::DocumentAI::V1::RawDocument]
30
+ # A raw document content (bytes).
31
+ # @!attribute [rw] name
32
+ # @return [::String]
33
+ # Required. The processor resource name.
34
+ # @!attribute [rw] skip_human_review
35
+ # @return [::Boolean]
36
+ # Whether Human Review feature should be skipped for this request. Default to
37
+ # false.
38
+ class ProcessRequest
39
+ include ::Google::Protobuf::MessageExts
40
+ extend ::Google::Protobuf::MessageExts::ClassMethods
41
+ end
42
+
43
+ # The status of human review on a processed document.
44
+ # @!attribute [rw] state
45
+ # @return [::Google::Cloud::DocumentAI::V1::HumanReviewStatus::State]
46
+ # The state of human review on the processing request.
47
+ # @!attribute [rw] state_message
48
+ # @return [::String]
49
+ # A message providing more details about the human review state.
50
+ # @!attribute [rw] human_review_operation
51
+ # @return [::String]
52
+ # The name of the operation triggered by the processed document. This field
53
+ # is populated only when the [state] is [HUMAN_REVIEW_IN_PROGRESS]. It has
54
+ # the same response type and metadata as the long running operation returned
55
+ # by [ReviewDocument] method.
56
+ class HumanReviewStatus
57
+ include ::Google::Protobuf::MessageExts
58
+ extend ::Google::Protobuf::MessageExts::ClassMethods
59
+
60
+ # The final state of human review on a processed document.
61
+ module State
62
+ # Human review state is unspecified. Most likely due to an internal error.
63
+ STATE_UNSPECIFIED = 0
64
+
65
+ # Human review is skipped for the document. This can happen because human
66
+ # review is not enabled on the processor or the processing request has
67
+ # been set to skip this document.
68
+ SKIPPED = 1
69
+
70
+ # Human review validation is triggered and passed, so no review is needed.
71
+ VALIDATION_PASSED = 2
72
+
73
+ # Human review validation is triggered and the document is under review.
74
+ IN_PROGRESS = 3
75
+
76
+ # Some error happened during triggering human review, see the
77
+ # [state_message] for details.
78
+ ERROR = 4
79
+ end
80
+ end
81
+
82
+ # Response message for the process document method.
83
+ # @!attribute [rw] document
84
+ # @return [::Google::Cloud::DocumentAI::V1::Document]
85
+ # The document payload, will populate fields based on the processor's
86
+ # behavior.
87
+ # @!attribute [rw] human_review_status
88
+ # @return [::Google::Cloud::DocumentAI::V1::HumanReviewStatus]
89
+ # The status of human review on the processed document.
90
+ class ProcessResponse
91
+ include ::Google::Protobuf::MessageExts
92
+ extend ::Google::Protobuf::MessageExts::ClassMethods
93
+ end
94
+
95
+ # Request message for batch process document method.
96
+ # @!attribute [rw] name
97
+ # @return [::String]
98
+ # Required. The processor resource name.
99
+ # @!attribute [rw] input_documents
100
+ # @return [::Google::Cloud::DocumentAI::V1::BatchDocumentsInputConfig]
101
+ # The input documents for batch process.
102
+ # @!attribute [rw] document_output_config
103
+ # @return [::Google::Cloud::DocumentAI::V1::DocumentOutputConfig]
104
+ # The overall output config for batch process.
105
+ # @!attribute [rw] skip_human_review
106
+ # @return [::Boolean]
107
+ # Whether Human Review feature should be skipped for this request. Default to
108
+ # false.
109
+ class BatchProcessRequest
110
+ include ::Google::Protobuf::MessageExts
111
+ extend ::Google::Protobuf::MessageExts::ClassMethods
112
+ end
113
+
114
+ # Response message for batch process document method.
115
+ class BatchProcessResponse
116
+ include ::Google::Protobuf::MessageExts
117
+ extend ::Google::Protobuf::MessageExts::ClassMethods
118
+ end
119
+
120
+ # The long running operation metadata for batch process method.
121
+ # @!attribute [rw] state
122
+ # @return [::Google::Cloud::DocumentAI::V1::BatchProcessMetadata::State]
123
+ # The state of the current batch processing.
124
+ # @!attribute [rw] state_message
125
+ # @return [::String]
126
+ # A message providing more details about the current state of processing.
127
+ # For example, the error message if the operation is failed.
128
+ # @!attribute [rw] create_time
129
+ # @return [::Google::Protobuf::Timestamp]
130
+ # The creation time of the operation.
131
+ # @!attribute [rw] update_time
132
+ # @return [::Google::Protobuf::Timestamp]
133
+ # The last update time of the operation.
134
+ # @!attribute [rw] individual_process_statuses
135
+ # @return [::Array<::Google::Cloud::DocumentAI::V1::BatchProcessMetadata::IndividualProcessStatus>]
136
+ # The list of response details of each document.
137
+ class BatchProcessMetadata
138
+ include ::Google::Protobuf::MessageExts
139
+ extend ::Google::Protobuf::MessageExts::ClassMethods
140
+
141
+ # The status of a each individual document in the batch process.
142
+ # @!attribute [rw] input_gcs_source
143
+ # @return [::String]
144
+ # The source of the document, same as the [input_gcs_source] field in the
145
+ # request when the batch process started. The batch process is started by
146
+ # take snapshot of that document, since a user can move or change that
147
+ # document during the process.
148
+ # @!attribute [rw] status
149
+ # @return [::Google::Rpc::Status]
150
+ # The status of the processing of the document.
151
+ # @!attribute [rw] output_gcs_destination
152
+ # @return [::String]
153
+ # The output_gcs_destination (in the request as 'output_gcs_destination')
154
+ # of the processed document if it was successful, otherwise empty.
155
+ # @!attribute [rw] human_review_status
156
+ # @return [::Google::Cloud::DocumentAI::V1::HumanReviewStatus]
157
+ # The status of human review on the processed document.
158
+ class IndividualProcessStatus
159
+ include ::Google::Protobuf::MessageExts
160
+ extend ::Google::Protobuf::MessageExts::ClassMethods
161
+ end
162
+
163
+ # Possible states of the batch processing operation.
164
+ module State
165
+ # The default value. This value is used if the state is omitted.
166
+ STATE_UNSPECIFIED = 0
167
+
168
+ # Request operation is waiting for scheduling.
169
+ WAITING = 1
170
+
171
+ # Request is being processed.
172
+ RUNNING = 2
173
+
174
+ # The batch processing completed successfully.
175
+ SUCCEEDED = 3
176
+
177
+ # The batch processing was being cancelled.
178
+ CANCELLING = 4
179
+
180
+ # The batch processing was cancelled.
181
+ CANCELLED = 5
182
+
183
+ # The batch processing has failed.
184
+ FAILED = 6
185
+ end
186
+ end
187
+
188
+ # Request message for review document method.
189
+ # @!attribute [rw] inline_document
190
+ # @return [::Google::Cloud::DocumentAI::V1::Document]
191
+ # An inline document proto.
192
+ # @!attribute [rw] human_review_config
193
+ # @return [::String]
194
+ # Required. The resource name of the HumanReviewConfig that the document will be
195
+ # reviewed with.
196
+ class ReviewDocumentRequest
197
+ include ::Google::Protobuf::MessageExts
198
+ extend ::Google::Protobuf::MessageExts::ClassMethods
199
+ end
200
+
201
+ # Response message for review document method.
202
+ # @!attribute [rw] gcs_destination
203
+ # @return [::String]
204
+ # The Cloud Storage uri for the human reviewed document.
205
+ class ReviewDocumentResponse
206
+ include ::Google::Protobuf::MessageExts
207
+ extend ::Google::Protobuf::MessageExts::ClassMethods
208
+ end
209
+
210
+ # The long running operation metadata for review document method.
211
+ # @!attribute [rw] common_metadata
212
+ # @return [::Google::Cloud::DocumentAI::V1::CommonOperationMetadata]
213
+ # The basic metadata of the long running operation.
214
+ class ReviewDocumentOperationMetadata
215
+ include ::Google::Protobuf::MessageExts
216
+ extend ::Google::Protobuf::MessageExts::ClassMethods
217
+ end
218
+ end
219
+ end
220
+ end
221
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module DocumentAI
23
+ module V1
24
+ # A vertex represents a 2D point in the image.
25
+ # NOTE: the vertex coordinates are in the same scale as the original image.
26
+ # @!attribute [rw] x
27
+ # @return [::Integer]
28
+ # X coordinate.
29
+ # @!attribute [rw] y
30
+ # @return [::Integer]
31
+ # Y coordinate (starts from the top of the image).
32
+ class Vertex
33
+ include ::Google::Protobuf::MessageExts
34
+ extend ::Google::Protobuf::MessageExts::ClassMethods
35
+ end
36
+
37
+ # A vertex represents a 2D point in the image.
38
+ # NOTE: the normalized vertex coordinates are relative to the original image
39
+ # and range from 0 to 1.
40
+ # @!attribute [rw] x
41
+ # @return [::Float]
42
+ # X coordinate.
43
+ # @!attribute [rw] y
44
+ # @return [::Float]
45
+ # Y coordinate (starts from the top of the image).
46
+ class NormalizedVertex
47
+ include ::Google::Protobuf::MessageExts
48
+ extend ::Google::Protobuf::MessageExts::ClassMethods
49
+ end
50
+
51
+ # A bounding polygon for the detected image annotation.
52
+ # @!attribute [rw] vertices
53
+ # @return [::Array<::Google::Cloud::DocumentAI::V1::Vertex>]
54
+ # The bounding polygon vertices.
55
+ # @!attribute [rw] normalized_vertices
56
+ # @return [::Array<::Google::Cloud::DocumentAI::V1::NormalizedVertex>]
57
+ # The bounding polygon normalized vertices.
58
+ class BoundingPoly
59
+ include ::Google::Protobuf::MessageExts
60
+ extend ::Google::Protobuf::MessageExts::ClassMethods
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module DocumentAI
23
+ module V1
24
+ # The common metadata for long running operations.
25
+ # @!attribute [rw] state
26
+ # @return [::Google::Cloud::DocumentAI::V1::CommonOperationMetadata::State]
27
+ # The state of the operation.
28
+ # @!attribute [rw] state_message
29
+ # @return [::String]
30
+ # A message providing more details about the current state of processing.
31
+ # @!attribute [rw] create_time
32
+ # @return [::Google::Protobuf::Timestamp]
33
+ # The creation time of the operation.
34
+ # @!attribute [rw] update_time
35
+ # @return [::Google::Protobuf::Timestamp]
36
+ # The last update time of the operation.
37
+ class CommonOperationMetadata
38
+ include ::Google::Protobuf::MessageExts
39
+ extend ::Google::Protobuf::MessageExts::ClassMethods
40
+
41
+ # State of the longrunning operation.
42
+ module State
43
+ # Unspecified state.
44
+ STATE_UNSPECIFIED = 0
45
+
46
+ # Operation is still running.
47
+ RUNNING = 1
48
+
49
+ # Operation is being cancelled.
50
+ CANCELLING = 2
51
+
52
+ # Operation succeeded.
53
+ SUCCEEDED = 3
54
+
55
+ # Operation failed.
56
+ FAILED = 4
57
+
58
+ # Operation is cancelled.
59
+ CANCELLED = 5
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end