cloudmersive-ocr-api-client 2.0.1 → 2.0.2
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/Gemfile +7 -0
- data/README.md +150 -0
- data/Rakefile +8 -0
- data/cloudmersive-ocr-api-client.gemspec +45 -0
- data/docs/BusinessCardRecognitionResult.md +15 -0
- data/docs/FieldResult.md +9 -0
- data/docs/FormDefinitionTemplate.md +9 -0
- data/docs/FormFieldDefinition.md +25 -0
- data/docs/FormRecognitionResult.md +12 -0
- data/docs/FormTableColumnDefinition.md +13 -0
- data/docs/FormTableDefinition.md +11 -0
- data/docs/GetPageAngleResult.md +9 -0
- data/docs/ImageOcrApi.md +571 -0
- data/docs/ImageToLinesWithLocationResult.md +9 -0
- data/docs/ImageToTextResponse.md +9 -0
- data/docs/ImageToWordsWithLocationResult.md +9 -0
- data/docs/OcrLineElement.md +9 -0
- data/docs/OcrPageResult.md +10 -0
- data/docs/OcrPageResultWithLinesWithLocation.md +10 -0
- data/docs/OcrPageResultWithWordsWithLocation.md +10 -0
- data/docs/OcrPhotoTextElement.md +14 -0
- data/docs/OcrWordElement.md +18 -0
- data/docs/PdfOcrApi.md +191 -0
- data/docs/PdfToLinesWithLocationResult.md +9 -0
- data/docs/PdfToTextResponse.md +9 -0
- data/docs/PdfToWordsWithLocationResult.md +9 -0
- data/docs/PhotoToWordsWithLocationResult.md +10 -0
- data/docs/Point.md +9 -0
- data/docs/PreprocessingApi.md +338 -0
- data/docs/ReceiptLineItem.md +9 -0
- data/docs/ReceiptRecognitionResult.md +16 -0
- data/docs/ReceiptsApi.md +63 -0
- data/docs/TableCellResult.md +9 -0
- data/docs/TableResult.md +9 -0
- data/docs/TableRowResult.md +8 -0
- data/git_push.sh +55 -0
- data/lib/cloudmersive-ocr-api-client.rb +70 -0
- data/lib/cloudmersive-ocr-api-client/api/image_ocr_api.rb +596 -0
- data/lib/cloudmersive-ocr-api-client/api/pdf_ocr_api.rb +207 -0
- data/lib/cloudmersive-ocr-api-client/api/preprocessing_api.rb +353 -0
- data/lib/cloudmersive-ocr-api-client/api/receipts_api.rb +78 -0
- data/lib/cloudmersive-ocr-api-client/api_client.rb +391 -0
- data/lib/cloudmersive-ocr-api-client/api_error.rb +38 -0
- data/lib/cloudmersive-ocr-api-client/configuration.rb +209 -0
- data/lib/cloudmersive-ocr-api-client/models/business_card_recognition_result.rb +256 -0
- data/lib/cloudmersive-ocr-api-client/models/field_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/form_definition_template.rb +200 -0
- data/lib/cloudmersive-ocr-api-client/models/form_field_definition.rb +358 -0
- data/lib/cloudmersive-ocr-api-client/models/form_recognition_result.rb +232 -0
- data/lib/cloudmersive-ocr-api-client/models/form_table_column_definition.rb +236 -0
- data/lib/cloudmersive-ocr-api-client/models/form_table_definition.rb +218 -0
- data/lib/cloudmersive-ocr-api-client/models/get_page_angle_result.rb +196 -0
- data/lib/cloudmersive-ocr-api-client/models/image_to_lines_with_location_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/image_to_text_response.rb +196 -0
- data/lib/cloudmersive-ocr-api-client/models/image_to_words_with_location_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_line_element.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result.rb +205 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_lines_with_location.rb +208 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_words_with_location.rb +208 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_photo_text_element.rb +248 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_word_element.rb +286 -0
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_lines_with_location_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_text_response.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_words_with_location_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/photo_to_words_with_location_result.rb +223 -0
- data/lib/cloudmersive-ocr-api-client/models/point.rb +196 -0
- data/lib/cloudmersive-ocr-api-client/models/receipt_line_item.rb +196 -0
- data/lib/cloudmersive-ocr-api-client/models/receipt_recognition_result.rb +268 -0
- data/lib/cloudmersive-ocr-api-client/models/table_cell_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/table_result.rb +198 -0
- data/lib/cloudmersive-ocr-api-client/models/table_row_result.rb +188 -0
- data/lib/cloudmersive-ocr-api-client/version.rb +15 -0
- data/spec/api/image_ocr_api_spec.rb +169 -0
- data/spec/api/pdf_ocr_api_spec.rb +77 -0
- data/spec/api/preprocessing_api_spec.rb +107 -0
- data/spec/api/receipts_api_spec.rb +47 -0
- data/spec/api_client_spec.rb +243 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/business_card_recognition_result_spec.rb +83 -0
- data/spec/models/field_result_spec.rb +47 -0
- data/spec/models/form_definition_template_spec.rb +47 -0
- data/spec/models/form_field_definition_spec.rb +143 -0
- data/spec/models/form_recognition_result_spec.rb +65 -0
- data/spec/models/form_table_column_definition_spec.rb +71 -0
- data/spec/models/form_table_definition_spec.rb +59 -0
- data/spec/models/get_page_angle_result_spec.rb +47 -0
- data/spec/models/image_to_lines_with_location_result_spec.rb +47 -0
- data/spec/models/image_to_text_response_spec.rb +47 -0
- data/spec/models/image_to_words_with_location_result_spec.rb +47 -0
- data/spec/models/ocr_line_element_spec.rb +47 -0
- data/spec/models/ocr_page_result_spec.rb +53 -0
- data/spec/models/ocr_page_result_with_lines_with_location_spec.rb +53 -0
- data/spec/models/ocr_page_result_with_words_with_location_spec.rb +53 -0
- data/spec/models/ocr_photo_text_element_spec.rb +77 -0
- data/spec/models/ocr_word_element_spec.rb +101 -0
- data/spec/models/pdf_to_lines_with_location_result_spec.rb +47 -0
- data/spec/models/pdf_to_text_response_spec.rb +47 -0
- data/spec/models/pdf_to_words_with_location_result_spec.rb +47 -0
- data/spec/models/photo_to_words_with_location_result_spec.rb +53 -0
- data/spec/models/point_spec.rb +47 -0
- data/spec/models/receipt_line_item_spec.rb +47 -0
- data/spec/models/receipt_recognition_result_spec.rb +89 -0
- data/spec/models/table_cell_result_spec.rb +47 -0
- data/spec/models/table_result_spec.rb +47 -0
- data/spec/models/table_row_result_spec.rb +41 -0
- data/spec/spec_helper.rb +111 -0
- metadata +109 -3
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#ocrapi
|
|
3
|
+
|
|
4
|
+
#The powerful Optical Character Recognition (OCR) APIs let you convert scanned images of pages into recognized text.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: v1
|
|
7
|
+
|
|
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 CloudmersiveOcrApiClient
|
|
16
|
+
# The result of extracting form field values
|
|
17
|
+
class FormRecognitionResult
|
|
18
|
+
# True if the operation was successful, false otherwise
|
|
19
|
+
attr_accessor :successful
|
|
20
|
+
|
|
21
|
+
# Result of form field OCR data extraction
|
|
22
|
+
attr_accessor :field_value_extraction_result
|
|
23
|
+
|
|
24
|
+
# Result of form table OCR data extraction
|
|
25
|
+
attr_accessor :table_value_extraction_results
|
|
26
|
+
|
|
27
|
+
# Diagnostic images - default is null, enable diagnostics=true to populate this parameter with one image per field
|
|
28
|
+
attr_accessor :diagnostics
|
|
29
|
+
|
|
30
|
+
# Optional; populated when using photo/recognize/form/advanced with the Setting Name of the best-matching highest-relevance form
|
|
31
|
+
attr_accessor :best_match_form_setting_name
|
|
32
|
+
|
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
34
|
+
def self.attribute_map
|
|
35
|
+
{
|
|
36
|
+
:'successful' => :'Successful',
|
|
37
|
+
:'field_value_extraction_result' => :'FieldValueExtractionResult',
|
|
38
|
+
:'table_value_extraction_results' => :'TableValueExtractionResults',
|
|
39
|
+
:'diagnostics' => :'Diagnostics',
|
|
40
|
+
:'best_match_form_setting_name' => :'BestMatchFormSettingName'
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Attribute type mapping.
|
|
45
|
+
def self.swagger_types
|
|
46
|
+
{
|
|
47
|
+
:'successful' => :'BOOLEAN',
|
|
48
|
+
:'field_value_extraction_result' => :'Array<FieldResult>',
|
|
49
|
+
:'table_value_extraction_results' => :'Array<TableResult>',
|
|
50
|
+
:'diagnostics' => :'Array<String>',
|
|
51
|
+
:'best_match_form_setting_name' => :'String'
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Initializes the object
|
|
56
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
57
|
+
def initialize(attributes = {})
|
|
58
|
+
return unless attributes.is_a?(Hash)
|
|
59
|
+
|
|
60
|
+
# convert string to symbol for hash key
|
|
61
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
62
|
+
|
|
63
|
+
if attributes.has_key?(:'Successful')
|
|
64
|
+
self.successful = attributes[:'Successful']
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
if attributes.has_key?(:'FieldValueExtractionResult')
|
|
68
|
+
if (value = attributes[:'FieldValueExtractionResult']).is_a?(Array)
|
|
69
|
+
self.field_value_extraction_result = value
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
if attributes.has_key?(:'TableValueExtractionResults')
|
|
74
|
+
if (value = attributes[:'TableValueExtractionResults']).is_a?(Array)
|
|
75
|
+
self.table_value_extraction_results = value
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
if attributes.has_key?(:'Diagnostics')
|
|
80
|
+
if (value = attributes[:'Diagnostics']).is_a?(Array)
|
|
81
|
+
self.diagnostics = value
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
if attributes.has_key?(:'BestMatchFormSettingName')
|
|
86
|
+
self.best_match_form_setting_name = attributes[:'BestMatchFormSettingName']
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
91
|
+
# @return Array for valid properties with the reasons
|
|
92
|
+
def list_invalid_properties
|
|
93
|
+
invalid_properties = Array.new
|
|
94
|
+
invalid_properties
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Check to see if the all the properties in the model are valid
|
|
98
|
+
# @return true if the model is valid
|
|
99
|
+
def valid?
|
|
100
|
+
true
|
|
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
|
+
successful == o.successful &&
|
|
109
|
+
field_value_extraction_result == o.field_value_extraction_result &&
|
|
110
|
+
table_value_extraction_results == o.table_value_extraction_results &&
|
|
111
|
+
diagnostics == o.diagnostics &&
|
|
112
|
+
best_match_form_setting_name == o.best_match_form_setting_name
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# @see the `==` method
|
|
116
|
+
# @param [Object] Object to be compared
|
|
117
|
+
def eql?(o)
|
|
118
|
+
self == o
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Calculates hash code according to all attributes.
|
|
122
|
+
# @return [Fixnum] Hash code
|
|
123
|
+
def hash
|
|
124
|
+
[successful, field_value_extraction_result, table_value_extraction_results, diagnostics, best_match_form_setting_name].hash
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Builds the object from hash
|
|
128
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
129
|
+
# @return [Object] Returns the model itself
|
|
130
|
+
def build_from_hash(attributes)
|
|
131
|
+
return nil unless attributes.is_a?(Hash)
|
|
132
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
133
|
+
if type =~ /\AArray<(.*)>/i
|
|
134
|
+
# check to ensure the input is an array given that the attribute
|
|
135
|
+
# is documented as an array but the input is not
|
|
136
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
137
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
138
|
+
end
|
|
139
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
140
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
141
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
self
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Deserializes the data based on type
|
|
148
|
+
# @param string type Data type
|
|
149
|
+
# @param string value Value to be deserialized
|
|
150
|
+
# @return [Object] Deserialized data
|
|
151
|
+
def _deserialize(type, value)
|
|
152
|
+
case type.to_sym
|
|
153
|
+
when :DateTime
|
|
154
|
+
DateTime.parse(value)
|
|
155
|
+
when :Date
|
|
156
|
+
Date.parse(value)
|
|
157
|
+
when :String
|
|
158
|
+
value.to_s
|
|
159
|
+
when :Integer
|
|
160
|
+
value.to_i
|
|
161
|
+
when :Float
|
|
162
|
+
value.to_f
|
|
163
|
+
when :BOOLEAN
|
|
164
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
165
|
+
true
|
|
166
|
+
else
|
|
167
|
+
false
|
|
168
|
+
end
|
|
169
|
+
when :Object
|
|
170
|
+
# generic object (usually a Hash), return directly
|
|
171
|
+
value
|
|
172
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
173
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
174
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
175
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
176
|
+
k_type = Regexp.last_match[:k_type]
|
|
177
|
+
v_type = Regexp.last_match[:v_type]
|
|
178
|
+
{}.tap do |hash|
|
|
179
|
+
value.each do |k, v|
|
|
180
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
else # model
|
|
184
|
+
temp_model = CloudmersiveOcrApiClient.const_get(type).new
|
|
185
|
+
temp_model.build_from_hash(value)
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Returns the string representation of the object
|
|
190
|
+
# @return [String] String presentation of the object
|
|
191
|
+
def to_s
|
|
192
|
+
to_hash.to_s
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
196
|
+
# @return [Hash] Returns the object in the form of hash
|
|
197
|
+
def to_body
|
|
198
|
+
to_hash
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Returns the object in the form of hash
|
|
202
|
+
# @return [Hash] Returns the object in the form of hash
|
|
203
|
+
def to_hash
|
|
204
|
+
hash = {}
|
|
205
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
206
|
+
value = self.send(attr)
|
|
207
|
+
next if value.nil?
|
|
208
|
+
hash[param] = _to_hash(value)
|
|
209
|
+
end
|
|
210
|
+
hash
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Outputs non-array value in the form of hash
|
|
214
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
215
|
+
# @param [Object] value Any valid value
|
|
216
|
+
# @return [Hash] Returns the value in the form of hash
|
|
217
|
+
def _to_hash(value)
|
|
218
|
+
if value.is_a?(Array)
|
|
219
|
+
value.compact.map { |v| _to_hash(v) }
|
|
220
|
+
elsif value.is_a?(Hash)
|
|
221
|
+
{}.tap do |hash|
|
|
222
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
223
|
+
end
|
|
224
|
+
elsif value.respond_to? :to_hash
|
|
225
|
+
value.to_hash
|
|
226
|
+
else
|
|
227
|
+
value
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
end
|
|
232
|
+
end
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#ocrapi
|
|
3
|
+
|
|
4
|
+
#The powerful Optical Character Recognition (OCR) APIs let you convert scanned images of pages into recognized text.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: v1
|
|
7
|
+
|
|
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 CloudmersiveOcrApiClient
|
|
16
|
+
# Definition of a column within a table for OCR data extraction from images
|
|
17
|
+
class FormTableColumnDefinition
|
|
18
|
+
# The identifier of the field; use this to identify which field is being referenced
|
|
19
|
+
attr_accessor :column_id
|
|
20
|
+
|
|
21
|
+
# Optional - the top anchor of the column heading
|
|
22
|
+
attr_accessor :top_anchor
|
|
23
|
+
|
|
24
|
+
# Optional - the matching mode for the anchor. Possible values are Complete (requires the entire anchor to match) and Partial (allows only part of the anchor to match). Default is Partial.
|
|
25
|
+
attr_accessor :anchor_mode
|
|
26
|
+
|
|
27
|
+
# The data type of the field; possible values are INTEGER (Integer value), STRING (Arbitrary string value, spaces are permitted), DATE (Date in a structured format), DECIMAL (Decimal number), ALPHANUMERIC (Continuous alphanumeric string with no spaces), STRINGNOWHITESPACE (A string that contains no whitespace characters), SERIALNUMBER (A serial-number style string that contains letters and numbers, and certain symbols; must contain at least one number), ALPHAONLY (Alphabet characters only, no numbers or symbols or whitespace)
|
|
28
|
+
attr_accessor :data_type
|
|
29
|
+
|
|
30
|
+
# Optional - the target number of digits in the field; useful for fixed-length fields
|
|
31
|
+
attr_accessor :minimum_character_count
|
|
32
|
+
|
|
33
|
+
# Optional - set to false to block values that contain numeric digits, set to true to allow numeric digits
|
|
34
|
+
attr_accessor :allow_numeric_digits
|
|
35
|
+
|
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
37
|
+
def self.attribute_map
|
|
38
|
+
{
|
|
39
|
+
:'column_id' => :'ColumnID',
|
|
40
|
+
:'top_anchor' => :'TopAnchor',
|
|
41
|
+
:'anchor_mode' => :'AnchorMode',
|
|
42
|
+
:'data_type' => :'DataType',
|
|
43
|
+
:'minimum_character_count' => :'MinimumCharacterCount',
|
|
44
|
+
:'allow_numeric_digits' => :'AllowNumericDigits'
|
|
45
|
+
}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Attribute type mapping.
|
|
49
|
+
def self.swagger_types
|
|
50
|
+
{
|
|
51
|
+
:'column_id' => :'String',
|
|
52
|
+
:'top_anchor' => :'String',
|
|
53
|
+
:'anchor_mode' => :'String',
|
|
54
|
+
:'data_type' => :'String',
|
|
55
|
+
:'minimum_character_count' => :'Integer',
|
|
56
|
+
:'allow_numeric_digits' => :'BOOLEAN'
|
|
57
|
+
}
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Initializes the object
|
|
61
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
62
|
+
def initialize(attributes = {})
|
|
63
|
+
return unless attributes.is_a?(Hash)
|
|
64
|
+
|
|
65
|
+
# convert string to symbol for hash key
|
|
66
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
67
|
+
|
|
68
|
+
if attributes.has_key?(:'ColumnID')
|
|
69
|
+
self.column_id = attributes[:'ColumnID']
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
if attributes.has_key?(:'TopAnchor')
|
|
73
|
+
self.top_anchor = attributes[:'TopAnchor']
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
if attributes.has_key?(:'AnchorMode')
|
|
77
|
+
self.anchor_mode = attributes[:'AnchorMode']
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
if attributes.has_key?(:'DataType')
|
|
81
|
+
self.data_type = attributes[:'DataType']
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
if attributes.has_key?(:'MinimumCharacterCount')
|
|
85
|
+
self.minimum_character_count = attributes[:'MinimumCharacterCount']
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
if attributes.has_key?(:'AllowNumericDigits')
|
|
89
|
+
self.allow_numeric_digits = attributes[:'AllowNumericDigits']
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
94
|
+
# @return Array for valid properties with the reasons
|
|
95
|
+
def list_invalid_properties
|
|
96
|
+
invalid_properties = Array.new
|
|
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
|
+
true
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Checks equality by comparing each attribute.
|
|
107
|
+
# @param [Object] Object to be compared
|
|
108
|
+
def ==(o)
|
|
109
|
+
return true if self.equal?(o)
|
|
110
|
+
self.class == o.class &&
|
|
111
|
+
column_id == o.column_id &&
|
|
112
|
+
top_anchor == o.top_anchor &&
|
|
113
|
+
anchor_mode == o.anchor_mode &&
|
|
114
|
+
data_type == o.data_type &&
|
|
115
|
+
minimum_character_count == o.minimum_character_count &&
|
|
116
|
+
allow_numeric_digits == o.allow_numeric_digits
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# @see the `==` method
|
|
120
|
+
# @param [Object] Object to be compared
|
|
121
|
+
def eql?(o)
|
|
122
|
+
self == o
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Calculates hash code according to all attributes.
|
|
126
|
+
# @return [Fixnum] Hash code
|
|
127
|
+
def hash
|
|
128
|
+
[column_id, top_anchor, anchor_mode, data_type, minimum_character_count, allow_numeric_digits].hash
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Builds the object from hash
|
|
132
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
133
|
+
# @return [Object] Returns the model itself
|
|
134
|
+
def build_from_hash(attributes)
|
|
135
|
+
return nil unless attributes.is_a?(Hash)
|
|
136
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
137
|
+
if type =~ /\AArray<(.*)>/i
|
|
138
|
+
# check to ensure the input is an array given that the attribute
|
|
139
|
+
# is documented as an array but the input is not
|
|
140
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
141
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
142
|
+
end
|
|
143
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
144
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
145
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
self
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Deserializes the data based on type
|
|
152
|
+
# @param string type Data type
|
|
153
|
+
# @param string value Value to be deserialized
|
|
154
|
+
# @return [Object] Deserialized data
|
|
155
|
+
def _deserialize(type, value)
|
|
156
|
+
case type.to_sym
|
|
157
|
+
when :DateTime
|
|
158
|
+
DateTime.parse(value)
|
|
159
|
+
when :Date
|
|
160
|
+
Date.parse(value)
|
|
161
|
+
when :String
|
|
162
|
+
value.to_s
|
|
163
|
+
when :Integer
|
|
164
|
+
value.to_i
|
|
165
|
+
when :Float
|
|
166
|
+
value.to_f
|
|
167
|
+
when :BOOLEAN
|
|
168
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
169
|
+
true
|
|
170
|
+
else
|
|
171
|
+
false
|
|
172
|
+
end
|
|
173
|
+
when :Object
|
|
174
|
+
# generic object (usually a Hash), return directly
|
|
175
|
+
value
|
|
176
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
177
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
178
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
179
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
180
|
+
k_type = Regexp.last_match[:k_type]
|
|
181
|
+
v_type = Regexp.last_match[:v_type]
|
|
182
|
+
{}.tap do |hash|
|
|
183
|
+
value.each do |k, v|
|
|
184
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
else # model
|
|
188
|
+
temp_model = CloudmersiveOcrApiClient.const_get(type).new
|
|
189
|
+
temp_model.build_from_hash(value)
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Returns the string representation of the object
|
|
194
|
+
# @return [String] String presentation of the object
|
|
195
|
+
def to_s
|
|
196
|
+
to_hash.to_s
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
|
201
|
+
def to_body
|
|
202
|
+
to_hash
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Returns the object in the form of hash
|
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
|
207
|
+
def to_hash
|
|
208
|
+
hash = {}
|
|
209
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
210
|
+
value = self.send(attr)
|
|
211
|
+
next if value.nil?
|
|
212
|
+
hash[param] = _to_hash(value)
|
|
213
|
+
end
|
|
214
|
+
hash
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# Outputs non-array value in the form of hash
|
|
218
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
219
|
+
# @param [Object] value Any valid value
|
|
220
|
+
# @return [Hash] Returns the value in the form of hash
|
|
221
|
+
def _to_hash(value)
|
|
222
|
+
if value.is_a?(Array)
|
|
223
|
+
value.compact.map { |v| _to_hash(v) }
|
|
224
|
+
elsif value.is_a?(Hash)
|
|
225
|
+
{}.tap do |hash|
|
|
226
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
227
|
+
end
|
|
228
|
+
elsif value.respond_to? :to_hash
|
|
229
|
+
value.to_hash
|
|
230
|
+
else
|
|
231
|
+
value
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
end
|
|
236
|
+
end
|