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,207 @@
|
|
|
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 performing a document question answering operation
|
|
17
|
+
class DocumentQuestionAnswersResult
|
|
18
|
+
# True if the operation was completed successfully, or false otherwise
|
|
19
|
+
attr_accessor :successful
|
|
20
|
+
|
|
21
|
+
# Confidence score between 0.0 and 1.0 where values above 0.8 indicate high confidence
|
|
22
|
+
attr_accessor :confidence_score
|
|
23
|
+
|
|
24
|
+
attr_accessor :answer_results
|
|
25
|
+
|
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
27
|
+
def self.attribute_map
|
|
28
|
+
{
|
|
29
|
+
:'successful' => :'Successful',
|
|
30
|
+
:'confidence_score' => :'ConfidenceScore',
|
|
31
|
+
:'answer_results' => :'AnswerResults'
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Attribute type mapping.
|
|
36
|
+
def self.swagger_types
|
|
37
|
+
{
|
|
38
|
+
:'successful' => :'BOOLEAN',
|
|
39
|
+
:'confidence_score' => :'Float',
|
|
40
|
+
:'answer_results' => :'Array<DocumentQuestionAnswerItem>'
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Initializes the object
|
|
45
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
46
|
+
def initialize(attributes = {})
|
|
47
|
+
return unless attributes.is_a?(Hash)
|
|
48
|
+
|
|
49
|
+
# convert string to symbol for hash key
|
|
50
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
51
|
+
|
|
52
|
+
if attributes.has_key?(:'Successful')
|
|
53
|
+
self.successful = attributes[:'Successful']
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
if attributes.has_key?(:'ConfidenceScore')
|
|
57
|
+
self.confidence_score = attributes[:'ConfidenceScore']
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
if attributes.has_key?(:'AnswerResults')
|
|
61
|
+
if (value = attributes[:'AnswerResults']).is_a?(Array)
|
|
62
|
+
self.answer_results = value
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
68
|
+
# @return Array for valid properties with the reasons
|
|
69
|
+
def list_invalid_properties
|
|
70
|
+
invalid_properties = Array.new
|
|
71
|
+
invalid_properties
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Check to see if the all the properties in the model are valid
|
|
75
|
+
# @return true if the model is valid
|
|
76
|
+
def valid?
|
|
77
|
+
true
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Checks equality by comparing each attribute.
|
|
81
|
+
# @param [Object] Object to be compared
|
|
82
|
+
def ==(o)
|
|
83
|
+
return true if self.equal?(o)
|
|
84
|
+
self.class == o.class &&
|
|
85
|
+
successful == o.successful &&
|
|
86
|
+
confidence_score == o.confidence_score &&
|
|
87
|
+
answer_results == o.answer_results
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# @see the `==` method
|
|
91
|
+
# @param [Object] Object to be compared
|
|
92
|
+
def eql?(o)
|
|
93
|
+
self == o
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Calculates hash code according to all attributes.
|
|
97
|
+
# @return [Fixnum] Hash code
|
|
98
|
+
def hash
|
|
99
|
+
[successful, confidence_score, answer_results].hash
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Builds the object from hash
|
|
103
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
104
|
+
# @return [Object] Returns the model itself
|
|
105
|
+
def build_from_hash(attributes)
|
|
106
|
+
return nil unless attributes.is_a?(Hash)
|
|
107
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
108
|
+
if type =~ /\AArray<(.*)>/i
|
|
109
|
+
# check to ensure the input is an array given that the attribute
|
|
110
|
+
# is documented as an array but the input is not
|
|
111
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
112
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
113
|
+
end
|
|
114
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
115
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
116
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
self
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Deserializes the data based on type
|
|
123
|
+
# @param string type Data type
|
|
124
|
+
# @param string value Value to be deserialized
|
|
125
|
+
# @return [Object] Deserialized data
|
|
126
|
+
def _deserialize(type, value)
|
|
127
|
+
case type.to_sym
|
|
128
|
+
when :DateTime
|
|
129
|
+
DateTime.parse(value)
|
|
130
|
+
when :Date
|
|
131
|
+
Date.parse(value)
|
|
132
|
+
when :String
|
|
133
|
+
value.to_s
|
|
134
|
+
when :Integer
|
|
135
|
+
value.to_i
|
|
136
|
+
when :Float
|
|
137
|
+
value.to_f
|
|
138
|
+
when :BOOLEAN
|
|
139
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
140
|
+
true
|
|
141
|
+
else
|
|
142
|
+
false
|
|
143
|
+
end
|
|
144
|
+
when :Object
|
|
145
|
+
# generic object (usually a Hash), return directly
|
|
146
|
+
value
|
|
147
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
148
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
149
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
150
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
151
|
+
k_type = Regexp.last_match[:k_type]
|
|
152
|
+
v_type = Regexp.last_match[:v_type]
|
|
153
|
+
{}.tap do |hash|
|
|
154
|
+
value.each do |k, v|
|
|
155
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
else # model
|
|
159
|
+
temp_model = CloudmersiveDocumentaiApiClient.const_get(type).new
|
|
160
|
+
temp_model.build_from_hash(value)
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Returns the string representation of the object
|
|
165
|
+
# @return [String] String presentation of the object
|
|
166
|
+
def to_s
|
|
167
|
+
to_hash.to_s
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
171
|
+
# @return [Hash] Returns the object in the form of hash
|
|
172
|
+
def to_body
|
|
173
|
+
to_hash
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Returns the object in the form of hash
|
|
177
|
+
# @return [Hash] Returns the object in the form of hash
|
|
178
|
+
def to_hash
|
|
179
|
+
hash = {}
|
|
180
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
181
|
+
value = self.send(attr)
|
|
182
|
+
next if value.nil?
|
|
183
|
+
hash[param] = _to_hash(value)
|
|
184
|
+
end
|
|
185
|
+
hash
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Outputs non-array value in the form of hash
|
|
189
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
190
|
+
# @param [Object] value Any valid value
|
|
191
|
+
# @return [Hash] Returns the value in the form of hash
|
|
192
|
+
def _to_hash(value)
|
|
193
|
+
if value.is_a?(Array)
|
|
194
|
+
value.compact.map { |v| _to_hash(v) }
|
|
195
|
+
elsif value.is_a?(Hash)
|
|
196
|
+
{}.tap do |hash|
|
|
197
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
198
|
+
end
|
|
199
|
+
elsif value.respond_to? :to_hash
|
|
200
|
+
value.to_hash
|
|
201
|
+
else
|
|
202
|
+
value
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
end
|
|
207
|
+
end
|
|
@@ -0,0 +1,196 @@
|
|
|
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
|
+
# Boolean document question
|
|
17
|
+
class DocumentQuestionBoolean
|
|
18
|
+
# Unique ID of the question, e.g. 1 or 2A
|
|
19
|
+
attr_accessor :question_id
|
|
20
|
+
|
|
21
|
+
# Question in natural language to ask of the document where the answer resolves to YES or NO, e.g. 'Is this document signed and countersigned by both parties?'
|
|
22
|
+
attr_accessor :question_text
|
|
23
|
+
|
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
|
+
def self.attribute_map
|
|
26
|
+
{
|
|
27
|
+
:'question_id' => :'QuestionId',
|
|
28
|
+
:'question_text' => :'QuestionText'
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Attribute type mapping.
|
|
33
|
+
def self.swagger_types
|
|
34
|
+
{
|
|
35
|
+
:'question_id' => :'String',
|
|
36
|
+
:'question_text' => :'String'
|
|
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?(:'QuestionId')
|
|
49
|
+
self.question_id = attributes[:'QuestionId']
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
if attributes.has_key?(:'QuestionText')
|
|
53
|
+
self.question_text = attributes[:'QuestionText']
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
58
|
+
# @return Array for valid properties with the reasons
|
|
59
|
+
def list_invalid_properties
|
|
60
|
+
invalid_properties = Array.new
|
|
61
|
+
invalid_properties
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Check to see if the all the properties in the model are valid
|
|
65
|
+
# @return true if the model is valid
|
|
66
|
+
def valid?
|
|
67
|
+
true
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Checks equality by comparing each attribute.
|
|
71
|
+
# @param [Object] Object to be compared
|
|
72
|
+
def ==(o)
|
|
73
|
+
return true if self.equal?(o)
|
|
74
|
+
self.class == o.class &&
|
|
75
|
+
question_id == o.question_id &&
|
|
76
|
+
question_text == o.question_text
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# @see the `==` method
|
|
80
|
+
# @param [Object] Object to be compared
|
|
81
|
+
def eql?(o)
|
|
82
|
+
self == o
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Calculates hash code according to all attributes.
|
|
86
|
+
# @return [Fixnum] Hash code
|
|
87
|
+
def hash
|
|
88
|
+
[question_id, question_text].hash
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Builds the object from hash
|
|
92
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
93
|
+
# @return [Object] Returns the model itself
|
|
94
|
+
def build_from_hash(attributes)
|
|
95
|
+
return nil unless attributes.is_a?(Hash)
|
|
96
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
97
|
+
if type =~ /\AArray<(.*)>/i
|
|
98
|
+
# check to ensure the input is an array given that the attribute
|
|
99
|
+
# is documented as an array but the input is not
|
|
100
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
101
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
102
|
+
end
|
|
103
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
104
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
105
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
self
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Deserializes the data based on type
|
|
112
|
+
# @param string type Data type
|
|
113
|
+
# @param string value Value to be deserialized
|
|
114
|
+
# @return [Object] Deserialized data
|
|
115
|
+
def _deserialize(type, value)
|
|
116
|
+
case type.to_sym
|
|
117
|
+
when :DateTime
|
|
118
|
+
DateTime.parse(value)
|
|
119
|
+
when :Date
|
|
120
|
+
Date.parse(value)
|
|
121
|
+
when :String
|
|
122
|
+
value.to_s
|
|
123
|
+
when :Integer
|
|
124
|
+
value.to_i
|
|
125
|
+
when :Float
|
|
126
|
+
value.to_f
|
|
127
|
+
when :BOOLEAN
|
|
128
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
129
|
+
true
|
|
130
|
+
else
|
|
131
|
+
false
|
|
132
|
+
end
|
|
133
|
+
when :Object
|
|
134
|
+
# generic object (usually a Hash), return directly
|
|
135
|
+
value
|
|
136
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
137
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
138
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
139
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
140
|
+
k_type = Regexp.last_match[:k_type]
|
|
141
|
+
v_type = Regexp.last_match[:v_type]
|
|
142
|
+
{}.tap do |hash|
|
|
143
|
+
value.each do |k, v|
|
|
144
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
else # model
|
|
148
|
+
temp_model = CloudmersiveDocumentaiApiClient.const_get(type).new
|
|
149
|
+
temp_model.build_from_hash(value)
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Returns the string representation of the object
|
|
154
|
+
# @return [String] String presentation of the object
|
|
155
|
+
def to_s
|
|
156
|
+
to_hash.to_s
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
160
|
+
# @return [Hash] Returns the object in the form of hash
|
|
161
|
+
def to_body
|
|
162
|
+
to_hash
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Returns the object in the form of hash
|
|
166
|
+
# @return [Hash] Returns the object in the form of hash
|
|
167
|
+
def to_hash
|
|
168
|
+
hash = {}
|
|
169
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
170
|
+
value = self.send(attr)
|
|
171
|
+
next if value.nil?
|
|
172
|
+
hash[param] = _to_hash(value)
|
|
173
|
+
end
|
|
174
|
+
hash
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Outputs non-array value in the form of hash
|
|
178
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
179
|
+
# @param [Object] value Any valid value
|
|
180
|
+
# @return [Hash] Returns the value in the form of hash
|
|
181
|
+
def _to_hash(value)
|
|
182
|
+
if value.is_a?(Array)
|
|
183
|
+
value.compact.map { |v| _to_hash(v) }
|
|
184
|
+
elsif value.is_a?(Hash)
|
|
185
|
+
{}.tap do |hash|
|
|
186
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
187
|
+
end
|
|
188
|
+
elsif value.respond_to? :to_hash
|
|
189
|
+
value.to_hash
|
|
190
|
+
else
|
|
191
|
+
value
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
end
|
|
196
|
+
end
|
|
@@ -0,0 +1,196 @@
|
|
|
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
|
+
# Possible response choice for a multiple-choice question
|
|
17
|
+
class DocumentQuestionChoiceItem
|
|
18
|
+
# Unique ID of the response choice, e.g. 3C
|
|
19
|
+
attr_accessor :choice_id
|
|
20
|
+
|
|
21
|
+
# Description text of this choice, e.g. 'Delaware'
|
|
22
|
+
attr_accessor :choice_text
|
|
23
|
+
|
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
|
+
def self.attribute_map
|
|
26
|
+
{
|
|
27
|
+
:'choice_id' => :'ChoiceId',
|
|
28
|
+
:'choice_text' => :'ChoiceText'
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Attribute type mapping.
|
|
33
|
+
def self.swagger_types
|
|
34
|
+
{
|
|
35
|
+
:'choice_id' => :'String',
|
|
36
|
+
:'choice_text' => :'String'
|
|
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?(:'ChoiceId')
|
|
49
|
+
self.choice_id = attributes[:'ChoiceId']
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
if attributes.has_key?(:'ChoiceText')
|
|
53
|
+
self.choice_text = attributes[:'ChoiceText']
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
58
|
+
# @return Array for valid properties with the reasons
|
|
59
|
+
def list_invalid_properties
|
|
60
|
+
invalid_properties = Array.new
|
|
61
|
+
invalid_properties
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Check to see if the all the properties in the model are valid
|
|
65
|
+
# @return true if the model is valid
|
|
66
|
+
def valid?
|
|
67
|
+
true
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Checks equality by comparing each attribute.
|
|
71
|
+
# @param [Object] Object to be compared
|
|
72
|
+
def ==(o)
|
|
73
|
+
return true if self.equal?(o)
|
|
74
|
+
self.class == o.class &&
|
|
75
|
+
choice_id == o.choice_id &&
|
|
76
|
+
choice_text == o.choice_text
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# @see the `==` method
|
|
80
|
+
# @param [Object] Object to be compared
|
|
81
|
+
def eql?(o)
|
|
82
|
+
self == o
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Calculates hash code according to all attributes.
|
|
86
|
+
# @return [Fixnum] Hash code
|
|
87
|
+
def hash
|
|
88
|
+
[choice_id, choice_text].hash
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Builds the object from hash
|
|
92
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
93
|
+
# @return [Object] Returns the model itself
|
|
94
|
+
def build_from_hash(attributes)
|
|
95
|
+
return nil unless attributes.is_a?(Hash)
|
|
96
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
97
|
+
if type =~ /\AArray<(.*)>/i
|
|
98
|
+
# check to ensure the input is an array given that the attribute
|
|
99
|
+
# is documented as an array but the input is not
|
|
100
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
101
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
102
|
+
end
|
|
103
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
104
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
105
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
self
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Deserializes the data based on type
|
|
112
|
+
# @param string type Data type
|
|
113
|
+
# @param string value Value to be deserialized
|
|
114
|
+
# @return [Object] Deserialized data
|
|
115
|
+
def _deserialize(type, value)
|
|
116
|
+
case type.to_sym
|
|
117
|
+
when :DateTime
|
|
118
|
+
DateTime.parse(value)
|
|
119
|
+
when :Date
|
|
120
|
+
Date.parse(value)
|
|
121
|
+
when :String
|
|
122
|
+
value.to_s
|
|
123
|
+
when :Integer
|
|
124
|
+
value.to_i
|
|
125
|
+
when :Float
|
|
126
|
+
value.to_f
|
|
127
|
+
when :BOOLEAN
|
|
128
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
129
|
+
true
|
|
130
|
+
else
|
|
131
|
+
false
|
|
132
|
+
end
|
|
133
|
+
when :Object
|
|
134
|
+
# generic object (usually a Hash), return directly
|
|
135
|
+
value
|
|
136
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
137
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
138
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
139
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
140
|
+
k_type = Regexp.last_match[:k_type]
|
|
141
|
+
v_type = Regexp.last_match[:v_type]
|
|
142
|
+
{}.tap do |hash|
|
|
143
|
+
value.each do |k, v|
|
|
144
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
else # model
|
|
148
|
+
temp_model = CloudmersiveDocumentaiApiClient.const_get(type).new
|
|
149
|
+
temp_model.build_from_hash(value)
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Returns the string representation of the object
|
|
154
|
+
# @return [String] String presentation of the object
|
|
155
|
+
def to_s
|
|
156
|
+
to_hash.to_s
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
160
|
+
# @return [Hash] Returns the object in the form of hash
|
|
161
|
+
def to_body
|
|
162
|
+
to_hash
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Returns the object in the form of hash
|
|
166
|
+
# @return [Hash] Returns the object in the form of hash
|
|
167
|
+
def to_hash
|
|
168
|
+
hash = {}
|
|
169
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
170
|
+
value = self.send(attr)
|
|
171
|
+
next if value.nil?
|
|
172
|
+
hash[param] = _to_hash(value)
|
|
173
|
+
end
|
|
174
|
+
hash
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Outputs non-array value in the form of hash
|
|
178
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
179
|
+
# @param [Object] value Any valid value
|
|
180
|
+
# @return [Hash] Returns the value in the form of hash
|
|
181
|
+
def _to_hash(value)
|
|
182
|
+
if value.is_a?(Array)
|
|
183
|
+
value.compact.map { |v| _to_hash(v) }
|
|
184
|
+
elsif value.is_a?(Hash)
|
|
185
|
+
{}.tap do |hash|
|
|
186
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
187
|
+
end
|
|
188
|
+
elsif value.respond_to? :to_hash
|
|
189
|
+
value.to_hash
|
|
190
|
+
else
|
|
191
|
+
value
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
end
|
|
196
|
+
end
|