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.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -10
  3. data/cloudmersive-documentai-api-client.gemspec +3 -3
  4. data/docs/AdvancedExtractClassificationRequest.md +3 -0
  5. data/docs/AdvancedExtractFieldsRequest.md +3 -0
  6. data/docs/AnalyzeApi.md +58 -2
  7. data/docs/DocumentAdvancedClassificationResult.md +1 -0
  8. data/docs/DocumentPolicyRequest.md +1 -0
  9. data/docs/DocumentQuestionAnswerItem.md +11 -0
  10. data/docs/DocumentQuestionAnswersResult.md +10 -0
  11. data/docs/DocumentQuestionBoolean.md +9 -0
  12. data/docs/DocumentQuestionChoiceItem.md +9 -0
  13. data/docs/DocumentQuestionFreeResponse.md +9 -0
  14. data/docs/DocumentQuestionMultipleChoice.md +10 -0
  15. data/docs/DocumentQuestionsRequest.md +12 -0
  16. data/docs/ExtractApi.md +76 -14
  17. data/docs/ExtractFieldsAdvancedResponse.md +10 -0
  18. data/docs/FieldAdvancedValue.md +9 -0
  19. data/docs/FieldValue.md +2 -1
  20. data/docs/RunBatchJobApi.md +9 -9
  21. data/docs/SplitDocumentResponse.md +9 -0
  22. data/docs/SubDocument.md +11 -0
  23. data/lib/cloudmersive-documentai-api-client/api/analyze_api.rb +54 -4
  24. data/lib/cloudmersive-documentai-api-client/api/extract_api.rb +85 -25
  25. data/lib/cloudmersive-documentai-api-client/api/run_batch_job_api.rb +14 -14
  26. data/lib/cloudmersive-documentai-api-client/api_client.rb +2 -2
  27. data/lib/cloudmersive-documentai-api-client/api_error.rb +2 -2
  28. data/lib/cloudmersive-documentai-api-client/configuration.rb +3 -3
  29. data/lib/cloudmersive-documentai-api-client/models/advanced_extract_classification_request.rb +36 -6
  30. data/lib/cloudmersive-documentai-api-client/models/advanced_extract_fields_request.rb +36 -6
  31. data/lib/cloudmersive-documentai-api-client/models/document_advanced_classification_result.rb +16 -6
  32. data/lib/cloudmersive-documentai-api-client/models/document_categories.rb +2 -2
  33. data/lib/cloudmersive-documentai-api-client/models/document_classification_result.rb +2 -2
  34. data/lib/cloudmersive-documentai-api-client/models/document_policy_request.rb +16 -6
  35. data/lib/cloudmersive-documentai-api-client/models/document_policy_result.rb +2 -2
  36. data/lib/cloudmersive-documentai-api-client/models/document_question_answer_item.rb +216 -0
  37. data/lib/cloudmersive-documentai-api-client/models/document_question_answers_result.rb +207 -0
  38. data/lib/cloudmersive-documentai-api-client/models/document_question_boolean.rb +196 -0
  39. data/lib/cloudmersive-documentai-api-client/models/document_question_choice_item.rb +196 -0
  40. data/lib/cloudmersive-documentai-api-client/models/document_question_free_response.rb +196 -0
  41. data/lib/cloudmersive-documentai-api-client/models/document_question_multiple_choice.rb +208 -0
  42. data/lib/cloudmersive-documentai-api-client/models/document_questions_request.rb +246 -0
  43. data/lib/cloudmersive-documentai-api-client/models/extract_barcodes_ai_response.rb +2 -2
  44. data/lib/cloudmersive-documentai-api-client/models/extract_document_batch_job_result.rb +2 -2
  45. data/lib/cloudmersive-documentai-api-client/models/extract_document_job_status_result.rb +2 -2
  46. data/lib/cloudmersive-documentai-api-client/models/extract_fields_advanced_response.rb +208 -0
  47. data/lib/cloudmersive-documentai-api-client/models/extract_fields_and_tables_response.rb +2 -2
  48. data/lib/cloudmersive-documentai-api-client/models/extract_fields_response.rb +2 -2
  49. data/lib/cloudmersive-documentai-api-client/models/extract_tables_response.rb +2 -2
  50. data/lib/cloudmersive-documentai-api-client/models/extract_text_response.rb +2 -2
  51. data/lib/cloudmersive-documentai-api-client/models/extracted_barcode_item.rb +2 -2
  52. data/lib/cloudmersive-documentai-api-client/models/extracted_text_page.rb +2 -2
  53. data/lib/cloudmersive-documentai-api-client/models/field_advanced_value.rb +196 -0
  54. data/lib/cloudmersive-documentai-api-client/models/field_to_extract.rb +2 -2
  55. data/lib/cloudmersive-documentai-api-client/models/field_value.rb +19 -7
  56. data/lib/cloudmersive-documentai-api-client/models/policy_rule.rb +2 -2
  57. data/lib/cloudmersive-documentai-api-client/models/policy_rule_violation.rb +2 -2
  58. data/lib/cloudmersive-documentai-api-client/models/split_document_response.rb +198 -0
  59. data/lib/cloudmersive-documentai-api-client/models/sub_document.rb +231 -0
  60. data/lib/cloudmersive-documentai-api-client/models/summarize_document_response.rb +2 -2
  61. data/lib/cloudmersive-documentai-api-client/models/table_result.rb +2 -2
  62. data/lib/cloudmersive-documentai-api-client/models/table_result_cell.rb +2 -2
  63. data/lib/cloudmersive-documentai-api-client/models/table_result_row.rb +2 -2
  64. data/lib/cloudmersive-documentai-api-client/version.rb +3 -3
  65. data/lib/cloudmersive-documentai-api-client.rb +13 -2
  66. data/spec/api/analyze_api_spec.rb +15 -3
  67. data/spec/api/extract_api_spec.rb +28 -13
  68. data/spec/api/run_batch_job_api_spec.rb +8 -8
  69. data/spec/api_client_spec.rb +2 -2
  70. data/spec/configuration_spec.rb +5 -5
  71. data/spec/models/advanced_extract_classification_request_spec.rb +20 -2
  72. data/spec/models/advanced_extract_fields_request_spec.rb +20 -2
  73. data/spec/models/document_advanced_classification_result_spec.rb +8 -2
  74. data/spec/models/document_categories_spec.rb +2 -2
  75. data/spec/models/document_classification_result_spec.rb +2 -2
  76. data/spec/models/document_policy_request_spec.rb +8 -2
  77. data/spec/models/document_policy_result_spec.rb +2 -2
  78. data/spec/models/document_question_answer_item_spec.rb +59 -0
  79. data/spec/models/document_question_answers_result_spec.rb +53 -0
  80. data/spec/models/document_question_boolean_spec.rb +47 -0
  81. data/spec/models/document_question_choice_item_spec.rb +47 -0
  82. data/spec/models/document_question_free_response_spec.rb +47 -0
  83. data/spec/models/document_question_multiple_choice_spec.rb +53 -0
  84. data/spec/models/document_questions_request_spec.rb +65 -0
  85. data/spec/models/extract_barcodes_ai_response_spec.rb +2 -2
  86. data/spec/models/extract_document_batch_job_result_spec.rb +2 -2
  87. data/spec/models/extract_document_job_status_result_spec.rb +2 -2
  88. data/spec/models/extract_fields_advanced_response_spec.rb +53 -0
  89. data/spec/models/extract_fields_and_tables_response_spec.rb +2 -2
  90. data/spec/models/extract_fields_response_spec.rb +2 -2
  91. data/spec/models/extract_tables_response_spec.rb +2 -2
  92. data/spec/models/extract_text_response_spec.rb +2 -2
  93. data/spec/models/extracted_barcode_item_spec.rb +2 -2
  94. data/spec/models/extracted_text_page_spec.rb +2 -2
  95. data/spec/models/field_advanced_value_spec.rb +47 -0
  96. data/spec/models/field_to_extract_spec.rb +2 -2
  97. data/spec/models/field_value_spec.rb +8 -2
  98. data/spec/models/policy_rule_spec.rb +2 -2
  99. data/spec/models/policy_rule_violation_spec.rb +2 -2
  100. data/spec/models/split_document_response_spec.rb +47 -0
  101. data/spec/models/sub_document_spec.rb +59 -0
  102. data/spec/models/summarize_document_response_spec.rb +2 -2
  103. data/spec/models/table_result_cell_spec.rb +2 -2
  104. data/spec/models/table_result_row_spec.rb +2 -2
  105. data/spec/models/table_result_spec.rb +2 -2
  106. data/spec/spec_helper.rb +2 -2
  107. metadata +36 -3
@@ -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
+ # Free response question
17
+ class DocumentQuestionFreeResponse
18
+ # Unique ID of the question, e.g. 7 or 5A
19
+ attr_accessor :question_id
20
+
21
+ # Question in natural language to ask of the document where the answer resolves to a free response, e.g. 'Who is the counterparty in this agreement?'
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,208 @@
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
+ # Multiple choice question
17
+ class DocumentQuestionMultipleChoice
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 one of a fixed number of provided choices, e.g. 'What is the governing law of this agreement?'
22
+ attr_accessor :question_text
23
+
24
+ # Possible response choices for the multiple-choice question
25
+ attr_accessor :response_choices
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'question_id' => :'QuestionId',
31
+ :'question_text' => :'QuestionText',
32
+ :'response_choices' => :'ResponseChoices'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.swagger_types
38
+ {
39
+ :'question_id' => :'String',
40
+ :'question_text' => :'String',
41
+ :'response_choices' => :'Array<DocumentQuestionChoiceItem>'
42
+ }
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ return unless attributes.is_a?(Hash)
49
+
50
+ # convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
52
+
53
+ if attributes.has_key?(:'QuestionId')
54
+ self.question_id = attributes[:'QuestionId']
55
+ end
56
+
57
+ if attributes.has_key?(:'QuestionText')
58
+ self.question_text = attributes[:'QuestionText']
59
+ end
60
+
61
+ if attributes.has_key?(:'ResponseChoices')
62
+ if (value = attributes[:'ResponseChoices']).is_a?(Array)
63
+ self.response_choices = value
64
+ end
65
+ end
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ invalid_properties
73
+ end
74
+
75
+ # Check to see if the all the properties in the model are valid
76
+ # @return true if the model is valid
77
+ def valid?
78
+ true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ question_id == o.question_id &&
87
+ question_text == o.question_text &&
88
+ response_choices == o.response_choices
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Fixnum] Hash code
99
+ def hash
100
+ [question_id, question_text, response_choices].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ self.class.swagger_types.each_pair do |key, type|
109
+ if type =~ /\AArray<(.*)>/i
110
+ # check to ensure the input is an array given that the attribute
111
+ # is documented as an array but the input is not
112
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
113
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
114
+ end
115
+ elsif !attributes[self.class.attribute_map[key]].nil?
116
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
118
+ end
119
+
120
+ self
121
+ end
122
+
123
+ # Deserializes the data based on type
124
+ # @param string type Data type
125
+ # @param string value Value to be deserialized
126
+ # @return [Object] Deserialized data
127
+ def _deserialize(type, value)
128
+ case type.to_sym
129
+ when :DateTime
130
+ DateTime.parse(value)
131
+ when :Date
132
+ Date.parse(value)
133
+ when :String
134
+ value.to_s
135
+ when :Integer
136
+ value.to_i
137
+ when :Float
138
+ value.to_f
139
+ when :BOOLEAN
140
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
141
+ true
142
+ else
143
+ false
144
+ end
145
+ when :Object
146
+ # generic object (usually a Hash), return directly
147
+ value
148
+ when /\AArray<(?<inner_type>.+)>\z/
149
+ inner_type = Regexp.last_match[:inner_type]
150
+ value.map { |v| _deserialize(inner_type, v) }
151
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
152
+ k_type = Regexp.last_match[:k_type]
153
+ v_type = Regexp.last_match[:v_type]
154
+ {}.tap do |hash|
155
+ value.each do |k, v|
156
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
157
+ end
158
+ end
159
+ else # model
160
+ temp_model = CloudmersiveDocumentaiApiClient.const_get(type).new
161
+ temp_model.build_from_hash(value)
162
+ end
163
+ end
164
+
165
+ # Returns the string representation of the object
166
+ # @return [String] String presentation of the object
167
+ def to_s
168
+ to_hash.to_s
169
+ end
170
+
171
+ # to_body is an alias to to_hash (backward compatibility)
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_body
174
+ to_hash
175
+ end
176
+
177
+ # Returns the object in the form of hash
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_hash
180
+ hash = {}
181
+ self.class.attribute_map.each_pair do |attr, param|
182
+ value = self.send(attr)
183
+ next if value.nil?
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ # Outputs non-array value in the form of hash
190
+ # For object, use to_hash. Otherwise, just return the value
191
+ # @param [Object] value Any valid value
192
+ # @return [Hash] Returns the value in the form of hash
193
+ def _to_hash(value)
194
+ if value.is_a?(Array)
195
+ value.compact.map { |v| _to_hash(v) }
196
+ elsif value.is_a?(Hash)
197
+ {}.tap do |hash|
198
+ value.each { |k, v| hash[k] = _to_hash(v) }
199
+ end
200
+ elsif value.respond_to? :to_hash
201
+ value.to_hash
202
+ else
203
+ value
204
+ end
205
+ end
206
+
207
+ end
208
+ end
@@ -0,0 +1,246 @@
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
+ class DocumentQuestionsRequest
17
+ # Input file as a byte array
18
+ attr_accessor :input_file
19
+
20
+ # Optional: Yes or No boolean questions to answer about the document
21
+ attr_accessor :questions_yes_no
22
+
23
+ # Optional: Multiple choice questions to answer about the document
24
+ attr_accessor :questions_multiple_choice
25
+
26
+ # Optional: Free response questions to answer about the document
27
+ attr_accessor :questions_free_response
28
+
29
+ # Optional; Recognition mode - Normal (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
30
+ attr_accessor :recognition_mode
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'input_file' => :'InputFile',
36
+ :'questions_yes_no' => :'QuestionsYesNo',
37
+ :'questions_multiple_choice' => :'QuestionsMultipleChoice',
38
+ :'questions_free_response' => :'QuestionsFreeResponse',
39
+ :'recognition_mode' => :'RecognitionMode'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.swagger_types
45
+ {
46
+ :'input_file' => :'String',
47
+ :'questions_yes_no' => :'Array<DocumentQuestionBoolean>',
48
+ :'questions_multiple_choice' => :'Array<DocumentQuestionMultipleChoice>',
49
+ :'questions_free_response' => :'Array<DocumentQuestionFreeResponse>',
50
+ :'recognition_mode' => :'String'
51
+ }
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ return unless attributes.is_a?(Hash)
58
+
59
+ # convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
61
+
62
+ if attributes.has_key?(:'InputFile')
63
+ self.input_file = attributes[:'InputFile']
64
+ end
65
+
66
+ if attributes.has_key?(:'QuestionsYesNo')
67
+ if (value = attributes[:'QuestionsYesNo']).is_a?(Array)
68
+ self.questions_yes_no = value
69
+ end
70
+ end
71
+
72
+ if attributes.has_key?(:'QuestionsMultipleChoice')
73
+ if (value = attributes[:'QuestionsMultipleChoice']).is_a?(Array)
74
+ self.questions_multiple_choice = value
75
+ end
76
+ end
77
+
78
+ if attributes.has_key?(:'QuestionsFreeResponse')
79
+ if (value = attributes[:'QuestionsFreeResponse']).is_a?(Array)
80
+ self.questions_free_response = value
81
+ end
82
+ end
83
+
84
+ if attributes.has_key?(:'RecognitionMode')
85
+ self.recognition_mode = attributes[:'RecognitionMode']
86
+ end
87
+ end
88
+
89
+ # Show invalid properties with the reasons. Usually used together with valid?
90
+ # @return Array for valid properties with the reasons
91
+ def list_invalid_properties
92
+ invalid_properties = Array.new
93
+ if !@input_file.nil? && @input_file !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
94
+ invalid_properties.push('invalid value for "input_file", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.')
95
+ end
96
+
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ return false if !@input_file.nil? && @input_file !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
104
+ true
105
+ end
106
+
107
+ # Custom attribute writer method with validation
108
+ # @param [Object] input_file Value to be assigned
109
+ def input_file=(input_file)
110
+ if !input_file.nil? && input_file !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
111
+ fail ArgumentError, 'invalid value for "input_file", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.'
112
+ end
113
+
114
+ @input_file = input_file
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ input_file == o.input_file &&
123
+ questions_yes_no == o.questions_yes_no &&
124
+ questions_multiple_choice == o.questions_multiple_choice &&
125
+ questions_free_response == o.questions_free_response &&
126
+ recognition_mode == o.recognition_mode
127
+ end
128
+
129
+ # @see the `==` method
130
+ # @param [Object] Object to be compared
131
+ def eql?(o)
132
+ self == o
133
+ end
134
+
135
+ # Calculates hash code according to all attributes.
136
+ # @return [Fixnum] Hash code
137
+ def hash
138
+ [input_file, questions_yes_no, questions_multiple_choice, questions_free_response, recognition_mode].hash
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+ self.class.swagger_types.each_pair do |key, type|
147
+ if type =~ /\AArray<(.*)>/i
148
+ # check to ensure the input is an array given that the attribute
149
+ # is documented as an array but the input is not
150
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
151
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
152
+ end
153
+ elsif !attributes[self.class.attribute_map[key]].nil?
154
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
155
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
156
+ end
157
+
158
+ self
159
+ end
160
+
161
+ # Deserializes the data based on type
162
+ # @param string type Data type
163
+ # @param string value Value to be deserialized
164
+ # @return [Object] Deserialized data
165
+ def _deserialize(type, value)
166
+ case type.to_sym
167
+ when :DateTime
168
+ DateTime.parse(value)
169
+ when :Date
170
+ Date.parse(value)
171
+ when :String
172
+ value.to_s
173
+ when :Integer
174
+ value.to_i
175
+ when :Float
176
+ value.to_f
177
+ when :BOOLEAN
178
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
179
+ true
180
+ else
181
+ false
182
+ end
183
+ when :Object
184
+ # generic object (usually a Hash), return directly
185
+ value
186
+ when /\AArray<(?<inner_type>.+)>\z/
187
+ inner_type = Regexp.last_match[:inner_type]
188
+ value.map { |v| _deserialize(inner_type, v) }
189
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
190
+ k_type = Regexp.last_match[:k_type]
191
+ v_type = Regexp.last_match[:v_type]
192
+ {}.tap do |hash|
193
+ value.each do |k, v|
194
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
195
+ end
196
+ end
197
+ else # model
198
+ temp_model = CloudmersiveDocumentaiApiClient.const_get(type).new
199
+ temp_model.build_from_hash(value)
200
+ end
201
+ end
202
+
203
+ # Returns the string representation of the object
204
+ # @return [String] String presentation of the object
205
+ def to_s
206
+ to_hash.to_s
207
+ end
208
+
209
+ # to_body is an alias to to_hash (backward compatibility)
210
+ # @return [Hash] Returns the object in the form of hash
211
+ def to_body
212
+ to_hash
213
+ end
214
+
215
+ # Returns the object in the form of hash
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_hash
218
+ hash = {}
219
+ self.class.attribute_map.each_pair do |attr, param|
220
+ value = self.send(attr)
221
+ next if value.nil?
222
+ hash[param] = _to_hash(value)
223
+ end
224
+ hash
225
+ end
226
+
227
+ # Outputs non-array value in the form of hash
228
+ # For object, use to_hash. Otherwise, just return the value
229
+ # @param [Object] value Any valid value
230
+ # @return [Hash] Returns the value in the form of hash
231
+ def _to_hash(value)
232
+ if value.is_a?(Array)
233
+ value.compact.map { |v| _to_hash(v) }
234
+ elsif value.is_a?(Hash)
235
+ {}.tap do |hash|
236
+ value.each { |k, v| hash[k] = _to_hash(v) }
237
+ end
238
+ elsif value.respond_to? :to_hash
239
+ value.to_hash
240
+ else
241
+ value
242
+ end
243
+ end
244
+
245
+ end
246
+ end
@@ -1,10 +1,10 @@
1
1
  =begin
2
2
  #Document AI API
3
3
 
4
- #Use next-generation AI to extract data, fields, insights and text from documents. Instantly.
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
- #Use next-generation AI to extract data, fields, insights and text from documents. Instantly.
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
- #Use next-generation AI to extract data, fields, insights and text from documents. Instantly.
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