cloudmersive-documentai-api-client 2.2.0 → 2.2.1
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 +4 -4
- data/README.md +24 -10
- data/cloudmersive-documentai-api-client.gemspec +3 -3
- data/docs/AdvancedExtractClassificationRequest.md +3 -0
- data/docs/AdvancedExtractFieldsRequest.md +3 -0
- data/docs/AnalyzeApi.md +58 -2
- data/docs/DocumentAdvancedClassificationResult.md +1 -0
- data/docs/DocumentPolicyRequest.md +1 -0
- data/docs/DocumentQuestionAnswerItem.md +11 -0
- data/docs/DocumentQuestionAnswersResult.md +10 -0
- data/docs/DocumentQuestionBoolean.md +9 -0
- data/docs/DocumentQuestionChoiceItem.md +9 -0
- data/docs/DocumentQuestionFreeResponse.md +9 -0
- data/docs/DocumentQuestionMultipleChoice.md +10 -0
- data/docs/DocumentQuestionsRequest.md +12 -0
- data/docs/ExtractApi.md +76 -14
- data/docs/ExtractFieldsAdvancedResponse.md +10 -0
- data/docs/FieldAdvancedValue.md +9 -0
- data/docs/FieldValue.md +2 -1
- data/docs/RunBatchJobApi.md +9 -9
- data/docs/SplitDocumentResponse.md +9 -0
- data/docs/SubDocument.md +11 -0
- data/lib/cloudmersive-documentai-api-client/api/analyze_api.rb +54 -4
- data/lib/cloudmersive-documentai-api-client/api/extract_api.rb +85 -25
- data/lib/cloudmersive-documentai-api-client/api/run_batch_job_api.rb +14 -14
- data/lib/cloudmersive-documentai-api-client/api_client.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/api_error.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/configuration.rb +3 -3
- data/lib/cloudmersive-documentai-api-client/models/advanced_extract_classification_request.rb +36 -6
- data/lib/cloudmersive-documentai-api-client/models/advanced_extract_fields_request.rb +36 -6
- data/lib/cloudmersive-documentai-api-client/models/document_advanced_classification_result.rb +16 -6
- data/lib/cloudmersive-documentai-api-client/models/document_categories.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/document_classification_result.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/document_policy_request.rb +16 -6
- data/lib/cloudmersive-documentai-api-client/models/document_policy_result.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/document_question_answer_item.rb +216 -0
- data/lib/cloudmersive-documentai-api-client/models/document_question_answers_result.rb +207 -0
- data/lib/cloudmersive-documentai-api-client/models/document_question_boolean.rb +196 -0
- data/lib/cloudmersive-documentai-api-client/models/document_question_choice_item.rb +196 -0
- data/lib/cloudmersive-documentai-api-client/models/document_question_free_response.rb +196 -0
- data/lib/cloudmersive-documentai-api-client/models/document_question_multiple_choice.rb +208 -0
- data/lib/cloudmersive-documentai-api-client/models/document_questions_request.rb +246 -0
- data/lib/cloudmersive-documentai-api-client/models/extract_barcodes_ai_response.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/extract_document_batch_job_result.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/extract_document_job_status_result.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/extract_fields_advanced_response.rb +208 -0
- data/lib/cloudmersive-documentai-api-client/models/extract_fields_and_tables_response.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/extract_fields_response.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/extract_tables_response.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/extract_text_response.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/extracted_barcode_item.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/extracted_text_page.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/field_advanced_value.rb +196 -0
- data/lib/cloudmersive-documentai-api-client/models/field_to_extract.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/field_value.rb +19 -7
- data/lib/cloudmersive-documentai-api-client/models/policy_rule.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/policy_rule_violation.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/split_document_response.rb +198 -0
- data/lib/cloudmersive-documentai-api-client/models/sub_document.rb +231 -0
- data/lib/cloudmersive-documentai-api-client/models/summarize_document_response.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/table_result.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/table_result_cell.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/models/table_result_row.rb +2 -2
- data/lib/cloudmersive-documentai-api-client/version.rb +3 -3
- data/lib/cloudmersive-documentai-api-client.rb +13 -2
- data/spec/api/analyze_api_spec.rb +15 -3
- data/spec/api/extract_api_spec.rb +28 -13
- data/spec/api/run_batch_job_api_spec.rb +8 -8
- data/spec/api_client_spec.rb +2 -2
- data/spec/configuration_spec.rb +5 -5
- data/spec/models/advanced_extract_classification_request_spec.rb +20 -2
- data/spec/models/advanced_extract_fields_request_spec.rb +20 -2
- data/spec/models/document_advanced_classification_result_spec.rb +8 -2
- data/spec/models/document_categories_spec.rb +2 -2
- data/spec/models/document_classification_result_spec.rb +2 -2
- data/spec/models/document_policy_request_spec.rb +8 -2
- data/spec/models/document_policy_result_spec.rb +2 -2
- data/spec/models/document_question_answer_item_spec.rb +59 -0
- data/spec/models/document_question_answers_result_spec.rb +53 -0
- data/spec/models/document_question_boolean_spec.rb +47 -0
- data/spec/models/document_question_choice_item_spec.rb +47 -0
- data/spec/models/document_question_free_response_spec.rb +47 -0
- data/spec/models/document_question_multiple_choice_spec.rb +53 -0
- data/spec/models/document_questions_request_spec.rb +65 -0
- data/spec/models/extract_barcodes_ai_response_spec.rb +2 -2
- data/spec/models/extract_document_batch_job_result_spec.rb +2 -2
- data/spec/models/extract_document_job_status_result_spec.rb +2 -2
- data/spec/models/extract_fields_advanced_response_spec.rb +53 -0
- data/spec/models/extract_fields_and_tables_response_spec.rb +2 -2
- data/spec/models/extract_fields_response_spec.rb +2 -2
- data/spec/models/extract_tables_response_spec.rb +2 -2
- data/spec/models/extract_text_response_spec.rb +2 -2
- data/spec/models/extracted_barcode_item_spec.rb +2 -2
- data/spec/models/extracted_text_page_spec.rb +2 -2
- data/spec/models/field_advanced_value_spec.rb +47 -0
- data/spec/models/field_to_extract_spec.rb +2 -2
- data/spec/models/field_value_spec.rb +8 -2
- data/spec/models/policy_rule_spec.rb +2 -2
- data/spec/models/policy_rule_violation_spec.rb +2 -2
- data/spec/models/split_document_response_spec.rb +47 -0
- data/spec/models/sub_document_spec.rb +59 -0
- data/spec/models/summarize_document_response_spec.rb +2 -2
- data/spec/models/table_result_cell_spec.rb +2 -2
- data/spec/models/table_result_row_spec.rb +2 -2
- data/spec/models/table_result_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- metadata +36 -3
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Document AI API
|
|
3
|
+
|
|
4
|
+
#Extract structured data including named fields, tables, barcodes, classifications, and summaries from common document formats, scanned documents, and photos of documents using AI. Also supports handwriting and low quality photos and scans, as well as digital document input. Supports a wide range of languages, and is able to analyze and infer semantic structure from the visual layout for documents.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: v1
|
|
7
|
+
Contact: support@cloudmersive.com
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
Swagger Codegen version: 2.4.14
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
|
|
15
|
+
module CloudmersiveDocumentaiApiClient
|
|
16
|
+
# Result of splitting a document into sub-documents
|
|
17
|
+
class SplitDocumentResponse
|
|
18
|
+
# True if successful, false otherwise
|
|
19
|
+
attr_accessor :successful
|
|
20
|
+
|
|
21
|
+
# The sub-documents that were identified and extracted from the input document
|
|
22
|
+
attr_accessor :sub_documents
|
|
23
|
+
|
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
|
+
def self.attribute_map
|
|
26
|
+
{
|
|
27
|
+
:'successful' => :'Successful',
|
|
28
|
+
:'sub_documents' => :'SubDocuments'
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Attribute type mapping.
|
|
33
|
+
def self.swagger_types
|
|
34
|
+
{
|
|
35
|
+
:'successful' => :'BOOLEAN',
|
|
36
|
+
:'sub_documents' => :'Array<SubDocument>'
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Initializes the object
|
|
41
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
42
|
+
def initialize(attributes = {})
|
|
43
|
+
return unless attributes.is_a?(Hash)
|
|
44
|
+
|
|
45
|
+
# convert string to symbol for hash key
|
|
46
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
47
|
+
|
|
48
|
+
if attributes.has_key?(:'Successful')
|
|
49
|
+
self.successful = attributes[:'Successful']
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
if attributes.has_key?(:'SubDocuments')
|
|
53
|
+
if (value = attributes[:'SubDocuments']).is_a?(Array)
|
|
54
|
+
self.sub_documents = value
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
60
|
+
# @return Array for valid properties with the reasons
|
|
61
|
+
def list_invalid_properties
|
|
62
|
+
invalid_properties = Array.new
|
|
63
|
+
invalid_properties
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Check to see if the all the properties in the model are valid
|
|
67
|
+
# @return true if the model is valid
|
|
68
|
+
def valid?
|
|
69
|
+
true
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Checks equality by comparing each attribute.
|
|
73
|
+
# @param [Object] Object to be compared
|
|
74
|
+
def ==(o)
|
|
75
|
+
return true if self.equal?(o)
|
|
76
|
+
self.class == o.class &&
|
|
77
|
+
successful == o.successful &&
|
|
78
|
+
sub_documents == o.sub_documents
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# @see the `==` method
|
|
82
|
+
# @param [Object] Object to be compared
|
|
83
|
+
def eql?(o)
|
|
84
|
+
self == o
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Calculates hash code according to all attributes.
|
|
88
|
+
# @return [Fixnum] Hash code
|
|
89
|
+
def hash
|
|
90
|
+
[successful, sub_documents].hash
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Builds the object from hash
|
|
94
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
95
|
+
# @return [Object] Returns the model itself
|
|
96
|
+
def build_from_hash(attributes)
|
|
97
|
+
return nil unless attributes.is_a?(Hash)
|
|
98
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
99
|
+
if type =~ /\AArray<(.*)>/i
|
|
100
|
+
# check to ensure the input is an array given that the attribute
|
|
101
|
+
# is documented as an array but the input is not
|
|
102
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
103
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
104
|
+
end
|
|
105
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
106
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
107
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
self
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Deserializes the data based on type
|
|
114
|
+
# @param string type Data type
|
|
115
|
+
# @param string value Value to be deserialized
|
|
116
|
+
# @return [Object] Deserialized data
|
|
117
|
+
def _deserialize(type, value)
|
|
118
|
+
case type.to_sym
|
|
119
|
+
when :DateTime
|
|
120
|
+
DateTime.parse(value)
|
|
121
|
+
when :Date
|
|
122
|
+
Date.parse(value)
|
|
123
|
+
when :String
|
|
124
|
+
value.to_s
|
|
125
|
+
when :Integer
|
|
126
|
+
value.to_i
|
|
127
|
+
when :Float
|
|
128
|
+
value.to_f
|
|
129
|
+
when :BOOLEAN
|
|
130
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
131
|
+
true
|
|
132
|
+
else
|
|
133
|
+
false
|
|
134
|
+
end
|
|
135
|
+
when :Object
|
|
136
|
+
# generic object (usually a Hash), return directly
|
|
137
|
+
value
|
|
138
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
139
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
140
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
141
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
142
|
+
k_type = Regexp.last_match[:k_type]
|
|
143
|
+
v_type = Regexp.last_match[:v_type]
|
|
144
|
+
{}.tap do |hash|
|
|
145
|
+
value.each do |k, v|
|
|
146
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
else # model
|
|
150
|
+
temp_model = CloudmersiveDocumentaiApiClient.const_get(type).new
|
|
151
|
+
temp_model.build_from_hash(value)
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Returns the string representation of the object
|
|
156
|
+
# @return [String] String presentation of the object
|
|
157
|
+
def to_s
|
|
158
|
+
to_hash.to_s
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
162
|
+
# @return [Hash] Returns the object in the form of hash
|
|
163
|
+
def to_body
|
|
164
|
+
to_hash
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Returns the object in the form of hash
|
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
|
169
|
+
def to_hash
|
|
170
|
+
hash = {}
|
|
171
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
172
|
+
value = self.send(attr)
|
|
173
|
+
next if value.nil?
|
|
174
|
+
hash[param] = _to_hash(value)
|
|
175
|
+
end
|
|
176
|
+
hash
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# Outputs non-array value in the form of hash
|
|
180
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
181
|
+
# @param [Object] value Any valid value
|
|
182
|
+
# @return [Hash] Returns the value in the form of hash
|
|
183
|
+
def _to_hash(value)
|
|
184
|
+
if value.is_a?(Array)
|
|
185
|
+
value.compact.map { |v| _to_hash(v) }
|
|
186
|
+
elsif value.is_a?(Hash)
|
|
187
|
+
{}.tap do |hash|
|
|
188
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
189
|
+
end
|
|
190
|
+
elsif value.respond_to? :to_hash
|
|
191
|
+
value.to_hash
|
|
192
|
+
else
|
|
193
|
+
value
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
end
|
|
198
|
+
end
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Document AI API
|
|
3
|
+
|
|
4
|
+
#Extract structured data including named fields, tables, barcodes, classifications, and summaries from common document formats, scanned documents, and photos of documents using AI. Also supports handwriting and low quality photos and scans, as well as digital document input. Supports a wide range of languages, and is able to analyze and infer semantic structure from the visual layout for documents.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: v1
|
|
7
|
+
Contact: support@cloudmersive.com
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
Swagger Codegen version: 2.4.14
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
|
|
15
|
+
module CloudmersiveDocumentaiApiClient
|
|
16
|
+
# A sub-document extracted from a combined document
|
|
17
|
+
class SubDocument
|
|
18
|
+
# Starting page number (1-indexed) of this sub-document in the original document
|
|
19
|
+
attr_accessor :start_page
|
|
20
|
+
|
|
21
|
+
# Ending page number (1-indexed) of this sub-document in the original document
|
|
22
|
+
attr_accessor :end_page
|
|
23
|
+
|
|
24
|
+
# Description of the sub-document including document type and any identifying information such as person name
|
|
25
|
+
attr_accessor :document_description
|
|
26
|
+
|
|
27
|
+
# The extracted sub-document as PDF file bytes
|
|
28
|
+
attr_accessor :file_bytes
|
|
29
|
+
|
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
31
|
+
def self.attribute_map
|
|
32
|
+
{
|
|
33
|
+
:'start_page' => :'StartPage',
|
|
34
|
+
:'end_page' => :'EndPage',
|
|
35
|
+
:'document_description' => :'DocumentDescription',
|
|
36
|
+
:'file_bytes' => :'FileBytes'
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Attribute type mapping.
|
|
41
|
+
def self.swagger_types
|
|
42
|
+
{
|
|
43
|
+
:'start_page' => :'Integer',
|
|
44
|
+
:'end_page' => :'Integer',
|
|
45
|
+
:'document_description' => :'String',
|
|
46
|
+
:'file_bytes' => :'String'
|
|
47
|
+
}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Initializes the object
|
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
52
|
+
def initialize(attributes = {})
|
|
53
|
+
return unless attributes.is_a?(Hash)
|
|
54
|
+
|
|
55
|
+
# convert string to symbol for hash key
|
|
56
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
57
|
+
|
|
58
|
+
if attributes.has_key?(:'StartPage')
|
|
59
|
+
self.start_page = attributes[:'StartPage']
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
if attributes.has_key?(:'EndPage')
|
|
63
|
+
self.end_page = attributes[:'EndPage']
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
if attributes.has_key?(:'DocumentDescription')
|
|
67
|
+
self.document_description = attributes[:'DocumentDescription']
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
if attributes.has_key?(:'FileBytes')
|
|
71
|
+
self.file_bytes = attributes[:'FileBytes']
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
76
|
+
# @return Array for valid properties with the reasons
|
|
77
|
+
def list_invalid_properties
|
|
78
|
+
invalid_properties = Array.new
|
|
79
|
+
if !@file_bytes.nil? && @file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
|
80
|
+
invalid_properties.push('invalid value for "file_bytes", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.')
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
invalid_properties
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Check to see if the all the properties in the model are valid
|
|
87
|
+
# @return true if the model is valid
|
|
88
|
+
def valid?
|
|
89
|
+
return false if !@file_bytes.nil? && @file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
|
90
|
+
true
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Custom attribute writer method with validation
|
|
94
|
+
# @param [Object] file_bytes Value to be assigned
|
|
95
|
+
def file_bytes=(file_bytes)
|
|
96
|
+
if !file_bytes.nil? && file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
|
97
|
+
fail ArgumentError, 'invalid value for "file_bytes", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.'
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
@file_bytes = file_bytes
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Checks equality by comparing each attribute.
|
|
104
|
+
# @param [Object] Object to be compared
|
|
105
|
+
def ==(o)
|
|
106
|
+
return true if self.equal?(o)
|
|
107
|
+
self.class == o.class &&
|
|
108
|
+
start_page == o.start_page &&
|
|
109
|
+
end_page == o.end_page &&
|
|
110
|
+
document_description == o.document_description &&
|
|
111
|
+
file_bytes == o.file_bytes
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# @see the `==` method
|
|
115
|
+
# @param [Object] Object to be compared
|
|
116
|
+
def eql?(o)
|
|
117
|
+
self == o
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Calculates hash code according to all attributes.
|
|
121
|
+
# @return [Fixnum] Hash code
|
|
122
|
+
def hash
|
|
123
|
+
[start_page, end_page, document_description, file_bytes].hash
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Builds the object from hash
|
|
127
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
128
|
+
# @return [Object] Returns the model itself
|
|
129
|
+
def build_from_hash(attributes)
|
|
130
|
+
return nil unless attributes.is_a?(Hash)
|
|
131
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
132
|
+
if type =~ /\AArray<(.*)>/i
|
|
133
|
+
# check to ensure the input is an array given that the attribute
|
|
134
|
+
# is documented as an array but the input is not
|
|
135
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
136
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
137
|
+
end
|
|
138
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
139
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
140
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
self
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Deserializes the data based on type
|
|
147
|
+
# @param string type Data type
|
|
148
|
+
# @param string value Value to be deserialized
|
|
149
|
+
# @return [Object] Deserialized data
|
|
150
|
+
def _deserialize(type, value)
|
|
151
|
+
case type.to_sym
|
|
152
|
+
when :DateTime
|
|
153
|
+
DateTime.parse(value)
|
|
154
|
+
when :Date
|
|
155
|
+
Date.parse(value)
|
|
156
|
+
when :String
|
|
157
|
+
value.to_s
|
|
158
|
+
when :Integer
|
|
159
|
+
value.to_i
|
|
160
|
+
when :Float
|
|
161
|
+
value.to_f
|
|
162
|
+
when :BOOLEAN
|
|
163
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
164
|
+
true
|
|
165
|
+
else
|
|
166
|
+
false
|
|
167
|
+
end
|
|
168
|
+
when :Object
|
|
169
|
+
# generic object (usually a Hash), return directly
|
|
170
|
+
value
|
|
171
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
172
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
173
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
174
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
175
|
+
k_type = Regexp.last_match[:k_type]
|
|
176
|
+
v_type = Regexp.last_match[:v_type]
|
|
177
|
+
{}.tap do |hash|
|
|
178
|
+
value.each do |k, v|
|
|
179
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
else # model
|
|
183
|
+
temp_model = CloudmersiveDocumentaiApiClient.const_get(type).new
|
|
184
|
+
temp_model.build_from_hash(value)
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Returns the string representation of the object
|
|
189
|
+
# @return [String] String presentation of the object
|
|
190
|
+
def to_s
|
|
191
|
+
to_hash.to_s
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
195
|
+
# @return [Hash] Returns the object in the form of hash
|
|
196
|
+
def to_body
|
|
197
|
+
to_hash
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Returns the object in the form of hash
|
|
201
|
+
# @return [Hash] Returns the object in the form of hash
|
|
202
|
+
def to_hash
|
|
203
|
+
hash = {}
|
|
204
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
205
|
+
value = self.send(attr)
|
|
206
|
+
next if value.nil?
|
|
207
|
+
hash[param] = _to_hash(value)
|
|
208
|
+
end
|
|
209
|
+
hash
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Outputs non-array value in the form of hash
|
|
213
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
214
|
+
# @param [Object] value Any valid value
|
|
215
|
+
# @return [Hash] Returns the value in the form of hash
|
|
216
|
+
def _to_hash(value)
|
|
217
|
+
if value.is_a?(Array)
|
|
218
|
+
value.compact.map { |v| _to_hash(v) }
|
|
219
|
+
elsif value.is_a?(Hash)
|
|
220
|
+
{}.tap do |hash|
|
|
221
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
222
|
+
end
|
|
223
|
+
elsif value.respond_to? :to_hash
|
|
224
|
+
value.to_hash
|
|
225
|
+
else
|
|
226
|
+
value
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
end
|
|
231
|
+
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#Document AI API
|
|
3
3
|
|
|
4
|
-
#
|
|
4
|
+
#Extract structured data including named fields, tables, barcodes, classifications, and summaries from common document formats, scanned documents, and photos of documents using AI. Also supports handwriting and low quality photos and scans, as well as digital document input. Supports a wide range of languages, and is able to analyze and infer semantic structure from the visual layout for documents.
|
|
5
5
|
|
|
6
6
|
OpenAPI spec version: v1
|
|
7
|
-
|
|
7
|
+
Contact: support@cloudmersive.com
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
9
|
Swagger Codegen version: 2.4.14
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#Document AI API
|
|
3
3
|
|
|
4
|
-
#
|
|
4
|
+
#Extract structured data including named fields, tables, barcodes, classifications, and summaries from common document formats, scanned documents, and photos of documents using AI. Also supports handwriting and low quality photos and scans, as well as digital document input. Supports a wide range of languages, and is able to analyze and infer semantic structure from the visual layout for documents.
|
|
5
5
|
|
|
6
6
|
OpenAPI spec version: v1
|
|
7
|
-
|
|
7
|
+
Contact: support@cloudmersive.com
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
9
|
Swagger Codegen version: 2.4.14
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#Document AI API
|
|
3
3
|
|
|
4
|
-
#
|
|
4
|
+
#Extract structured data including named fields, tables, barcodes, classifications, and summaries from common document formats, scanned documents, and photos of documents using AI. Also supports handwriting and low quality photos and scans, as well as digital document input. Supports a wide range of languages, and is able to analyze and infer semantic structure from the visual layout for documents.
|
|
5
5
|
|
|
6
6
|
OpenAPI spec version: v1
|
|
7
|
-
|
|
7
|
+
Contact: support@cloudmersive.com
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
9
|
Swagger Codegen version: 2.4.14
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#Document AI API
|
|
3
3
|
|
|
4
|
-
#
|
|
4
|
+
#Extract structured data including named fields, tables, barcodes, classifications, and summaries from common document formats, scanned documents, and photos of documents using AI. Also supports handwriting and low quality photos and scans, as well as digital document input. Supports a wide range of languages, and is able to analyze and infer semantic structure from the visual layout for documents.
|
|
5
5
|
|
|
6
6
|
OpenAPI spec version: v1
|
|
7
|
-
|
|
7
|
+
Contact: support@cloudmersive.com
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
9
|
Swagger Codegen version: 2.4.14
|
|
10
10
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#Document AI API
|
|
3
3
|
|
|
4
|
-
#
|
|
4
|
+
#Extract structured data including named fields, tables, barcodes, classifications, and summaries from common document formats, scanned documents, and photos of documents using AI. Also supports handwriting and low quality photos and scans, as well as digital document input. Supports a wide range of languages, and is able to analyze and infer semantic structure from the visual layout for documents.
|
|
5
5
|
|
|
6
6
|
OpenAPI spec version: v1
|
|
7
|
-
|
|
7
|
+
Contact: support@cloudmersive.com
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
9
|
Swagger Codegen version: 2.4.14
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
13
13
|
module CloudmersiveDocumentaiApiClient
|
|
14
|
-
VERSION = '2.2.
|
|
14
|
+
VERSION = '2.2.1'
|
|
15
15
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#Document AI API
|
|
3
3
|
|
|
4
|
-
#
|
|
4
|
+
#Extract structured data including named fields, tables, barcodes, classifications, and summaries from common document formats, scanned documents, and photos of documents using AI. Also supports handwriting and low quality photos and scans, as well as digital document input. Supports a wide range of languages, and is able to analyze and infer semantic structure from the visual layout for documents.
|
|
5
5
|
|
|
6
6
|
OpenAPI spec version: v1
|
|
7
|
-
|
|
7
|
+
Contact: support@cloudmersive.com
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
9
|
Swagger Codegen version: 2.4.14
|
|
10
10
|
|
|
@@ -24,19 +24,30 @@ require 'cloudmersive-documentai-api-client/models/document_categories'
|
|
|
24
24
|
require 'cloudmersive-documentai-api-client/models/document_classification_result'
|
|
25
25
|
require 'cloudmersive-documentai-api-client/models/document_policy_request'
|
|
26
26
|
require 'cloudmersive-documentai-api-client/models/document_policy_result'
|
|
27
|
+
require 'cloudmersive-documentai-api-client/models/document_question_answer_item'
|
|
28
|
+
require 'cloudmersive-documentai-api-client/models/document_question_answers_result'
|
|
29
|
+
require 'cloudmersive-documentai-api-client/models/document_question_boolean'
|
|
30
|
+
require 'cloudmersive-documentai-api-client/models/document_question_choice_item'
|
|
31
|
+
require 'cloudmersive-documentai-api-client/models/document_question_free_response'
|
|
32
|
+
require 'cloudmersive-documentai-api-client/models/document_question_multiple_choice'
|
|
33
|
+
require 'cloudmersive-documentai-api-client/models/document_questions_request'
|
|
27
34
|
require 'cloudmersive-documentai-api-client/models/extract_barcodes_ai_response'
|
|
28
35
|
require 'cloudmersive-documentai-api-client/models/extract_document_batch_job_result'
|
|
29
36
|
require 'cloudmersive-documentai-api-client/models/extract_document_job_status_result'
|
|
37
|
+
require 'cloudmersive-documentai-api-client/models/extract_fields_advanced_response'
|
|
30
38
|
require 'cloudmersive-documentai-api-client/models/extract_fields_and_tables_response'
|
|
31
39
|
require 'cloudmersive-documentai-api-client/models/extract_fields_response'
|
|
32
40
|
require 'cloudmersive-documentai-api-client/models/extract_tables_response'
|
|
33
41
|
require 'cloudmersive-documentai-api-client/models/extract_text_response'
|
|
34
42
|
require 'cloudmersive-documentai-api-client/models/extracted_barcode_item'
|
|
35
43
|
require 'cloudmersive-documentai-api-client/models/extracted_text_page'
|
|
44
|
+
require 'cloudmersive-documentai-api-client/models/field_advanced_value'
|
|
36
45
|
require 'cloudmersive-documentai-api-client/models/field_to_extract'
|
|
37
46
|
require 'cloudmersive-documentai-api-client/models/field_value'
|
|
38
47
|
require 'cloudmersive-documentai-api-client/models/policy_rule'
|
|
39
48
|
require 'cloudmersive-documentai-api-client/models/policy_rule_violation'
|
|
49
|
+
require 'cloudmersive-documentai-api-client/models/split_document_response'
|
|
50
|
+
require 'cloudmersive-documentai-api-client/models/sub_document'
|
|
40
51
|
require 'cloudmersive-documentai-api-client/models/summarize_document_response'
|
|
41
52
|
require 'cloudmersive-documentai-api-client/models/table_result'
|
|
42
53
|
require 'cloudmersive-documentai-api-client/models/table_result_cell'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#Document AI API
|
|
3
3
|
|
|
4
|
-
#
|
|
4
|
+
#Extract structured data including named fields, tables, barcodes, classifications, and summaries from common document formats, scanned documents, and photos of documents using AI. Also supports handwriting and low quality photos and scans, as well as digital document input. Supports a wide range of languages, and is able to analyze and infer semantic structure from the visual layout for documents.
|
|
5
5
|
|
|
6
6
|
OpenAPI spec version: v1
|
|
7
|
-
|
|
7
|
+
Contact: support@cloudmersive.com
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
9
|
Swagger Codegen version: 2.4.14
|
|
10
10
|
|
|
@@ -32,9 +32,21 @@ describe 'AnalyzeApi' do
|
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
+
# unit tests for answer_questions
|
|
36
|
+
# Answer Questions about a Document in a structured way using Advanced AI
|
|
37
|
+
# Answer boolean (yes/no), multiple-choice and free-response questions about the contents of a document using Advanced AI. Input document formats supported include DOCX, PDF, PNG and JPG. Consumes 100 API calls per page.
|
|
38
|
+
# @param [Hash] opts the optional parameters
|
|
39
|
+
# @option opts [DocumentQuestionsRequest] :body Input request, including document and questions
|
|
40
|
+
# @return [DocumentQuestionAnswersResult]
|
|
41
|
+
describe 'answer_questions test' do
|
|
42
|
+
it 'should work' do
|
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
35
47
|
# unit tests for apply_rules
|
|
36
48
|
# Enforce Policies to a Document to allow or block it using Advanced AI
|
|
37
|
-
# Enforce Policies to a Document to allow or block it using Advanced AI. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
49
|
+
# Enforce Policies to a Document to allow or block it using Advanced AI. Input document formats supported include DOCX, PDF, PNG and JPG. Consumes 100 API calls per page.
|
|
38
50
|
# @param [Hash] opts the optional parameters
|
|
39
51
|
# @option opts [DocumentPolicyRequest] :body Input request, including document and policy rules
|
|
40
52
|
# @return [DocumentPolicyResult]
|