cloudmersive-ocr-api-client 1.4.6 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. metadata +3 -109
  3. data/Gemfile +0 -7
  4. data/README.md +0 -150
  5. data/Rakefile +0 -8
  6. data/cloudmersive-ocr-api-client.gemspec +0 -45
  7. data/docs/BusinessCardRecognitionResult.md +0 -15
  8. data/docs/FieldResult.md +0 -9
  9. data/docs/FormDefinitionTemplate.md +0 -9
  10. data/docs/FormFieldDefinition.md +0 -23
  11. data/docs/FormRecognitionResult.md +0 -12
  12. data/docs/FormTableColumnDefinition.md +0 -13
  13. data/docs/FormTableDefinition.md +0 -11
  14. data/docs/GetPageAngleResult.md +0 -9
  15. data/docs/ImageOcrApi.md +0 -565
  16. data/docs/ImageToLinesWithLocationResult.md +0 -9
  17. data/docs/ImageToTextResponse.md +0 -9
  18. data/docs/ImageToWordsWithLocationResult.md +0 -9
  19. data/docs/OcrLineElement.md +0 -9
  20. data/docs/OcrPageResult.md +0 -10
  21. data/docs/OcrPageResultWithLinesWithLocation.md +0 -10
  22. data/docs/OcrPageResultWithWordsWithLocation.md +0 -10
  23. data/docs/OcrPhotoTextElement.md +0 -14
  24. data/docs/OcrWordElement.md +0 -18
  25. data/docs/PdfOcrApi.md +0 -189
  26. data/docs/PdfToLinesWithLocationResult.md +0 -9
  27. data/docs/PdfToTextResponse.md +0 -9
  28. data/docs/PdfToWordsWithLocationResult.md +0 -9
  29. data/docs/PhotoToWordsWithLocationResult.md +0 -10
  30. data/docs/Point.md +0 -9
  31. data/docs/PreprocessingApi.md +0 -338
  32. data/docs/ReceiptLineItem.md +0 -9
  33. data/docs/ReceiptRecognitionResult.md +0 -16
  34. data/docs/ReceiptsApi.md +0 -63
  35. data/docs/TableCellResult.md +0 -9
  36. data/docs/TableResult.md +0 -9
  37. data/docs/TableRowResult.md +0 -8
  38. data/git_push.sh +0 -55
  39. data/lib/cloudmersive-ocr-api-client.rb +0 -70
  40. data/lib/cloudmersive-ocr-api-client/api/image_ocr_api.rb +0 -596
  41. data/lib/cloudmersive-ocr-api-client/api/pdf_ocr_api.rb +0 -209
  42. data/lib/cloudmersive-ocr-api-client/api/preprocessing_api.rb +0 -359
  43. data/lib/cloudmersive-ocr-api-client/api/receipts_api.rb +0 -79
  44. data/lib/cloudmersive-ocr-api-client/api_client.rb +0 -389
  45. data/lib/cloudmersive-ocr-api-client/api_error.rb +0 -38
  46. data/lib/cloudmersive-ocr-api-client/configuration.rb +0 -209
  47. data/lib/cloudmersive-ocr-api-client/models/business_card_recognition_result.rb +0 -259
  48. data/lib/cloudmersive-ocr-api-client/models/field_result.rb +0 -201
  49. data/lib/cloudmersive-ocr-api-client/models/form_definition_template.rb +0 -203
  50. data/lib/cloudmersive-ocr-api-client/models/form_field_definition.rb +0 -341
  51. data/lib/cloudmersive-ocr-api-client/models/form_recognition_result.rb +0 -235
  52. data/lib/cloudmersive-ocr-api-client/models/form_table_column_definition.rb +0 -239
  53. data/lib/cloudmersive-ocr-api-client/models/form_table_definition.rb +0 -221
  54. data/lib/cloudmersive-ocr-api-client/models/get_page_angle_result.rb +0 -199
  55. data/lib/cloudmersive-ocr-api-client/models/image_to_lines_with_location_result.rb +0 -201
  56. data/lib/cloudmersive-ocr-api-client/models/image_to_text_response.rb +0 -199
  57. data/lib/cloudmersive-ocr-api-client/models/image_to_words_with_location_result.rb +0 -201
  58. data/lib/cloudmersive-ocr-api-client/models/ocr_line_element.rb +0 -201
  59. data/lib/cloudmersive-ocr-api-client/models/ocr_page_result.rb +0 -209
  60. data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_lines_with_location.rb +0 -211
  61. data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_words_with_location.rb +0 -211
  62. data/lib/cloudmersive-ocr-api-client/models/ocr_photo_text_element.rb +0 -251
  63. data/lib/cloudmersive-ocr-api-client/models/ocr_word_element.rb +0 -289
  64. data/lib/cloudmersive-ocr-api-client/models/pdf_to_lines_with_location_result.rb +0 -201
  65. data/lib/cloudmersive-ocr-api-client/models/pdf_to_text_response.rb +0 -201
  66. data/lib/cloudmersive-ocr-api-client/models/pdf_to_words_with_location_result.rb +0 -201
  67. data/lib/cloudmersive-ocr-api-client/models/photo_to_words_with_location_result.rb +0 -227
  68. data/lib/cloudmersive-ocr-api-client/models/point.rb +0 -199
  69. data/lib/cloudmersive-ocr-api-client/models/receipt_line_item.rb +0 -199
  70. data/lib/cloudmersive-ocr-api-client/models/receipt_recognition_result.rb +0 -271
  71. data/lib/cloudmersive-ocr-api-client/models/table_cell_result.rb +0 -201
  72. data/lib/cloudmersive-ocr-api-client/models/table_result.rb +0 -201
  73. data/lib/cloudmersive-ocr-api-client/models/table_row_result.rb +0 -191
  74. data/lib/cloudmersive-ocr-api-client/version.rb +0 -15
  75. data/spec/api/image_ocr_api_spec.rb +0 -166
  76. data/spec/api/pdf_ocr_api_spec.rb +0 -77
  77. data/spec/api/preprocessing_api_spec.rb +0 -107
  78. data/spec/api/receipts_api_spec.rb +0 -47
  79. data/spec/api_client_spec.rb +0 -226
  80. data/spec/configuration_spec.rb +0 -42
  81. data/spec/models/business_card_recognition_result_spec.rb +0 -84
  82. data/spec/models/field_result_spec.rb +0 -48
  83. data/spec/models/form_definition_template_spec.rb +0 -48
  84. data/spec/models/form_field_definition_spec.rb +0 -132
  85. data/spec/models/form_recognition_result_spec.rb +0 -66
  86. data/spec/models/form_table_column_definition_spec.rb +0 -72
  87. data/spec/models/form_table_definition_spec.rb +0 -60
  88. data/spec/models/get_page_angle_result_spec.rb +0 -48
  89. data/spec/models/image_to_lines_with_location_result_spec.rb +0 -48
  90. data/spec/models/image_to_text_response_spec.rb +0 -48
  91. data/spec/models/image_to_words_with_location_result_spec.rb +0 -48
  92. data/spec/models/ocr_line_element_spec.rb +0 -48
  93. data/spec/models/ocr_page_result_spec.rb +0 -54
  94. data/spec/models/ocr_page_result_with_lines_with_location_spec.rb +0 -54
  95. data/spec/models/ocr_page_result_with_words_with_location_spec.rb +0 -54
  96. data/spec/models/ocr_photo_text_element_spec.rb +0 -78
  97. data/spec/models/ocr_word_element_spec.rb +0 -102
  98. data/spec/models/pdf_to_lines_with_location_result_spec.rb +0 -48
  99. data/spec/models/pdf_to_text_response_spec.rb +0 -48
  100. data/spec/models/pdf_to_words_with_location_result_spec.rb +0 -48
  101. data/spec/models/photo_to_words_with_location_result_spec.rb +0 -54
  102. data/spec/models/point_spec.rb +0 -48
  103. data/spec/models/receipt_line_item_spec.rb +0 -48
  104. data/spec/models/receipt_recognition_result_spec.rb +0 -90
  105. data/spec/models/table_cell_result_spec.rb +0 -48
  106. data/spec/models/table_result_spec.rb +0 -48
  107. data/spec/models/table_row_result_spec.rb +0 -42
  108. data/spec/spec_helper.rb +0 -111
@@ -1,201 +0,0 @@
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.3.1
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CloudmersiveOcrApiClient
16
- # A pairing target field and actual value read from form
17
- class FieldResult
18
- # Target field to extract from the form
19
- attr_accessor :target_field
20
-
21
- # Result field value(s) extracted
22
- attr_accessor :field_values
23
-
24
-
25
- # Attribute mapping from ruby-style variable name to JSON key.
26
- def self.attribute_map
27
- {
28
- :'target_field' => :'TargetField',
29
- :'field_values' => :'FieldValues'
30
- }
31
- end
32
-
33
- # Attribute type mapping.
34
- def self.swagger_types
35
- {
36
- :'target_field' => :'FormFieldDefinition',
37
- :'field_values' => :'Array<OcrPhotoTextElement>'
38
- }
39
- end
40
-
41
- # Initializes the object
42
- # @param [Hash] attributes Model attributes in the form of hash
43
- def initialize(attributes = {})
44
- return unless attributes.is_a?(Hash)
45
-
46
- # convert string to symbol for hash key
47
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
-
49
- if attributes.has_key?(:'TargetField')
50
- self.target_field = attributes[:'TargetField']
51
- end
52
-
53
- if attributes.has_key?(:'FieldValues')
54
- if (value = attributes[:'FieldValues']).is_a?(Array)
55
- self.field_values = value
56
- end
57
- end
58
-
59
- end
60
-
61
- # Show invalid properties with the reasons. Usually used together with valid?
62
- # @return Array for valid properties with the reasons
63
- def list_invalid_properties
64
- invalid_properties = Array.new
65
- return invalid_properties
66
- end
67
-
68
- # Check to see if the all the properties in the model are valid
69
- # @return true if the model is valid
70
- def valid?
71
- return true
72
- end
73
-
74
- # Checks equality by comparing each attribute.
75
- # @param [Object] Object to be compared
76
- def ==(o)
77
- return true if self.equal?(o)
78
- self.class == o.class &&
79
- target_field == o.target_field &&
80
- field_values == o.field_values
81
- end
82
-
83
- # @see the `==` method
84
- # @param [Object] Object to be compared
85
- def eql?(o)
86
- self == o
87
- end
88
-
89
- # Calculates hash code according to all attributes.
90
- # @return [Fixnum] Hash code
91
- def hash
92
- [target_field, field_values].hash
93
- end
94
-
95
- # Builds the object from hash
96
- # @param [Hash] attributes Model attributes in the form of hash
97
- # @return [Object] Returns the model itself
98
- def build_from_hash(attributes)
99
- return nil unless attributes.is_a?(Hash)
100
- self.class.swagger_types.each_pair do |key, type|
101
- if type =~ /\AArray<(.*)>/i
102
- # check to ensure the input is an array given that the the attribute
103
- # is documented as an array but the input is not
104
- if attributes[self.class.attribute_map[key]].is_a?(Array)
105
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
106
- end
107
- elsif !attributes[self.class.attribute_map[key]].nil?
108
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
109
- end # or else data not found in attributes(hash), not an issue as the data can be optional
110
- end
111
-
112
- self
113
- end
114
-
115
- # Deserializes the data based on type
116
- # @param string type Data type
117
- # @param string value Value to be deserialized
118
- # @return [Object] Deserialized data
119
- def _deserialize(type, value)
120
- case type.to_sym
121
- when :DateTime
122
- DateTime.parse(value)
123
- when :Date
124
- Date.parse(value)
125
- when :String
126
- value.to_s
127
- when :Integer
128
- value.to_i
129
- when :Float
130
- value.to_f
131
- when :BOOLEAN
132
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
133
- true
134
- else
135
- false
136
- end
137
- when :Object
138
- # generic object (usually a Hash), return directly
139
- value
140
- when /\AArray<(?<inner_type>.+)>\z/
141
- inner_type = Regexp.last_match[:inner_type]
142
- value.map { |v| _deserialize(inner_type, v) }
143
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
144
- k_type = Regexp.last_match[:k_type]
145
- v_type = Regexp.last_match[:v_type]
146
- {}.tap do |hash|
147
- value.each do |k, v|
148
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
149
- end
150
- end
151
- else # model
152
- temp_model = CloudmersiveOcrApiClient.const_get(type).new
153
- temp_model.build_from_hash(value)
154
- end
155
- end
156
-
157
- # Returns the string representation of the object
158
- # @return [String] String presentation of the object
159
- def to_s
160
- to_hash.to_s
161
- end
162
-
163
- # to_body is an alias to to_hash (backward compatibility)
164
- # @return [Hash] Returns the object in the form of hash
165
- def to_body
166
- to_hash
167
- end
168
-
169
- # Returns the object in the form of hash
170
- # @return [Hash] Returns the object in the form of hash
171
- def to_hash
172
- hash = {}
173
- self.class.attribute_map.each_pair do |attr, param|
174
- value = self.send(attr)
175
- next if value.nil?
176
- hash[param] = _to_hash(value)
177
- end
178
- hash
179
- end
180
-
181
- # Outputs non-array value in the form of hash
182
- # For object, use to_hash. Otherwise, just return the value
183
- # @param [Object] value Any valid value
184
- # @return [Hash] Returns the value in the form of hash
185
- def _to_hash(value)
186
- if value.is_a?(Array)
187
- value.compact.map{ |v| _to_hash(v) }
188
- elsif value.is_a?(Hash)
189
- {}.tap do |hash|
190
- value.each { |k, v| hash[k] = _to_hash(v) }
191
- end
192
- elsif value.respond_to? :to_hash
193
- value.to_hash
194
- else
195
- value
196
- end
197
- end
198
-
199
- end
200
-
201
- end
@@ -1,203 +0,0 @@
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.3.1
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CloudmersiveOcrApiClient
16
- # Definition of a form template; use a form template definition to recognize the fields in a form with Cloudmersive OCR
17
- class FormDefinitionTemplate
18
- # Field definitions in the template; a field is comprised of a key/value pair
19
- attr_accessor :field_definitions
20
-
21
- # Table definitions in the template; a table is comprised of columns and rows and exists in a 2-dimensional layout; a common example of a table would be an invoice
22
- attr_accessor :table_definitions
23
-
24
-
25
- # Attribute mapping from ruby-style variable name to JSON key.
26
- def self.attribute_map
27
- {
28
- :'field_definitions' => :'FieldDefinitions',
29
- :'table_definitions' => :'TableDefinitions'
30
- }
31
- end
32
-
33
- # Attribute type mapping.
34
- def self.swagger_types
35
- {
36
- :'field_definitions' => :'Array<FormFieldDefinition>',
37
- :'table_definitions' => :'Array<FormTableDefinition>'
38
- }
39
- end
40
-
41
- # Initializes the object
42
- # @param [Hash] attributes Model attributes in the form of hash
43
- def initialize(attributes = {})
44
- return unless attributes.is_a?(Hash)
45
-
46
- # convert string to symbol for hash key
47
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
-
49
- if attributes.has_key?(:'FieldDefinitions')
50
- if (value = attributes[:'FieldDefinitions']).is_a?(Array)
51
- self.field_definitions = value
52
- end
53
- end
54
-
55
- if attributes.has_key?(:'TableDefinitions')
56
- if (value = attributes[:'TableDefinitions']).is_a?(Array)
57
- self.table_definitions = value
58
- end
59
- end
60
-
61
- end
62
-
63
- # Show invalid properties with the reasons. Usually used together with valid?
64
- # @return Array for valid properties with the reasons
65
- def list_invalid_properties
66
- invalid_properties = Array.new
67
- return invalid_properties
68
- end
69
-
70
- # Check to see if the all the properties in the model are valid
71
- # @return true if the model is valid
72
- def valid?
73
- return true
74
- end
75
-
76
- # Checks equality by comparing each attribute.
77
- # @param [Object] Object to be compared
78
- def ==(o)
79
- return true if self.equal?(o)
80
- self.class == o.class &&
81
- field_definitions == o.field_definitions &&
82
- table_definitions == o.table_definitions
83
- end
84
-
85
- # @see the `==` method
86
- # @param [Object] Object to be compared
87
- def eql?(o)
88
- self == o
89
- end
90
-
91
- # Calculates hash code according to all attributes.
92
- # @return [Fixnum] Hash code
93
- def hash
94
- [field_definitions, table_definitions].hash
95
- end
96
-
97
- # Builds the object from hash
98
- # @param [Hash] attributes Model attributes in the form of hash
99
- # @return [Object] Returns the model itself
100
- def build_from_hash(attributes)
101
- return nil unless attributes.is_a?(Hash)
102
- self.class.swagger_types.each_pair do |key, type|
103
- if type =~ /\AArray<(.*)>/i
104
- # check to ensure the input is an array given that the the attribute
105
- # is documented as an array but the input is not
106
- if attributes[self.class.attribute_map[key]].is_a?(Array)
107
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
108
- end
109
- elsif !attributes[self.class.attribute_map[key]].nil?
110
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
111
- end # or else data not found in attributes(hash), not an issue as the data can be optional
112
- end
113
-
114
- self
115
- end
116
-
117
- # Deserializes the data based on type
118
- # @param string type Data type
119
- # @param string value Value to be deserialized
120
- # @return [Object] Deserialized data
121
- def _deserialize(type, value)
122
- case type.to_sym
123
- when :DateTime
124
- DateTime.parse(value)
125
- when :Date
126
- Date.parse(value)
127
- when :String
128
- value.to_s
129
- when :Integer
130
- value.to_i
131
- when :Float
132
- value.to_f
133
- when :BOOLEAN
134
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
135
- true
136
- else
137
- false
138
- end
139
- when :Object
140
- # generic object (usually a Hash), return directly
141
- value
142
- when /\AArray<(?<inner_type>.+)>\z/
143
- inner_type = Regexp.last_match[:inner_type]
144
- value.map { |v| _deserialize(inner_type, v) }
145
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
146
- k_type = Regexp.last_match[:k_type]
147
- v_type = Regexp.last_match[:v_type]
148
- {}.tap do |hash|
149
- value.each do |k, v|
150
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
151
- end
152
- end
153
- else # model
154
- temp_model = CloudmersiveOcrApiClient.const_get(type).new
155
- temp_model.build_from_hash(value)
156
- end
157
- end
158
-
159
- # Returns the string representation of the object
160
- # @return [String] String presentation of the object
161
- def to_s
162
- to_hash.to_s
163
- end
164
-
165
- # to_body is an alias to to_hash (backward compatibility)
166
- # @return [Hash] Returns the object in the form of hash
167
- def to_body
168
- to_hash
169
- end
170
-
171
- # Returns the object in the form of hash
172
- # @return [Hash] Returns the object in the form of hash
173
- def to_hash
174
- hash = {}
175
- self.class.attribute_map.each_pair do |attr, param|
176
- value = self.send(attr)
177
- next if value.nil?
178
- hash[param] = _to_hash(value)
179
- end
180
- hash
181
- end
182
-
183
- # Outputs non-array value in the form of hash
184
- # For object, use to_hash. Otherwise, just return the value
185
- # @param [Object] value Any valid value
186
- # @return [Hash] Returns the value in the form of hash
187
- def _to_hash(value)
188
- if value.is_a?(Array)
189
- value.compact.map{ |v| _to_hash(v) }
190
- elsif value.is_a?(Hash)
191
- {}.tap do |hash|
192
- value.each { |k, v| hash[k] = _to_hash(v) }
193
- end
194
- elsif value.respond_to? :to_hash
195
- value.to_hash
196
- else
197
- value
198
- end
199
- end
200
-
201
- end
202
-
203
- end
@@ -1,341 +0,0 @@
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.3.1
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CloudmersiveOcrApiClient
16
- # Definition of a form field for OCR data extraction from images
17
- class FormFieldDefinition
18
- # The identifier of the field; use this to identify which field is being referenced. Set to SkipField if you do not wish to return the value of this field in the result.
19
- attr_accessor :field_id
20
-
21
- # Optional - the left-hand anchor of the field
22
- attr_accessor :left_anchor
23
-
24
- # Optional - the top anchor of the field
25
- attr_accessor :top_anchor
26
-
27
- # Optional - the bottom anchor of the field
28
- attr_accessor :bottom_anchor
29
-
30
- # 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) and Horizontal (anchor must be laid out horizontally). Default is Partial.
31
- attr_accessor :anchor_mode
32
-
33
- # 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)
34
- attr_accessor :data_type
35
-
36
- # Optional - the target number of digits in the field; useful for fixed-length fields
37
- attr_accessor :target_digit_count
38
-
39
- # Optional - the target number of digits in the field; useful for fixed-length fields
40
- attr_accessor :minimum_character_count
41
-
42
- # Optional - set to false to block values that contain numeric digits, set to true to allow numeric digits
43
- attr_accessor :allow_numeric_digits
44
-
45
- # Vertical alignment of target value area relative to the field anchor; Possible values are VCenter, Top, Bottom
46
- attr_accessor :vertical_alignment_type
47
-
48
- # Horizontal alignment of target value area relative to the field anchor; Possible values are Left, Right
49
- attr_accessor :horizontal_alignment_type
50
-
51
- # Optional - scale factor for target field width - relative to width of field title; a value of 1.0 indicates the target value area has the same width as the field value as occurring in the image; a value of 2.0 would indicate that the target value area has 2 times the width of the field value as occurring in the image.
52
- attr_accessor :target_field_width_relative
53
-
54
- # Optional - scale factor for target field height - relative to height of field title
55
- attr_accessor :target_field_height_relative
56
-
57
- # Optional - horizontal adjestment in relative width of the field
58
- attr_accessor :target_field_horizontal_adjustment
59
-
60
- # Optional - vertical adjestment in relative height of the field
61
- attr_accessor :target_field_vertical_adjustment
62
-
63
- # Optional - Ignore any result items that contain a partial or complete match with these text strings
64
- attr_accessor :ignore
65
-
66
-
67
- # Attribute mapping from ruby-style variable name to JSON key.
68
- def self.attribute_map
69
- {
70
- :'field_id' => :'FieldID',
71
- :'left_anchor' => :'LeftAnchor',
72
- :'top_anchor' => :'TopAnchor',
73
- :'bottom_anchor' => :'BottomAnchor',
74
- :'anchor_mode' => :'AnchorMode',
75
- :'data_type' => :'DataType',
76
- :'target_digit_count' => :'TargetDigitCount',
77
- :'minimum_character_count' => :'MinimumCharacterCount',
78
- :'allow_numeric_digits' => :'AllowNumericDigits',
79
- :'vertical_alignment_type' => :'VerticalAlignmentType',
80
- :'horizontal_alignment_type' => :'HorizontalAlignmentType',
81
- :'target_field_width_relative' => :'TargetFieldWidth_Relative',
82
- :'target_field_height_relative' => :'TargetFieldHeight_Relative',
83
- :'target_field_horizontal_adjustment' => :'TargetFieldHorizontalAdjustment',
84
- :'target_field_vertical_adjustment' => :'TargetFieldVerticalAdjustment',
85
- :'ignore' => :'Ignore'
86
- }
87
- end
88
-
89
- # Attribute type mapping.
90
- def self.swagger_types
91
- {
92
- :'field_id' => :'String',
93
- :'left_anchor' => :'String',
94
- :'top_anchor' => :'String',
95
- :'bottom_anchor' => :'String',
96
- :'anchor_mode' => :'String',
97
- :'data_type' => :'String',
98
- :'target_digit_count' => :'Integer',
99
- :'minimum_character_count' => :'Integer',
100
- :'allow_numeric_digits' => :'BOOLEAN',
101
- :'vertical_alignment_type' => :'String',
102
- :'horizontal_alignment_type' => :'String',
103
- :'target_field_width_relative' => :'Float',
104
- :'target_field_height_relative' => :'Float',
105
- :'target_field_horizontal_adjustment' => :'Float',
106
- :'target_field_vertical_adjustment' => :'Float',
107
- :'ignore' => :'Array<String>'
108
- }
109
- end
110
-
111
- # Initializes the object
112
- # @param [Hash] attributes Model attributes in the form of hash
113
- def initialize(attributes = {})
114
- return unless attributes.is_a?(Hash)
115
-
116
- # convert string to symbol for hash key
117
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
118
-
119
- if attributes.has_key?(:'FieldID')
120
- self.field_id = attributes[:'FieldID']
121
- end
122
-
123
- if attributes.has_key?(:'LeftAnchor')
124
- self.left_anchor = attributes[:'LeftAnchor']
125
- end
126
-
127
- if attributes.has_key?(:'TopAnchor')
128
- self.top_anchor = attributes[:'TopAnchor']
129
- end
130
-
131
- if attributes.has_key?(:'BottomAnchor')
132
- self.bottom_anchor = attributes[:'BottomAnchor']
133
- end
134
-
135
- if attributes.has_key?(:'AnchorMode')
136
- self.anchor_mode = attributes[:'AnchorMode']
137
- end
138
-
139
- if attributes.has_key?(:'DataType')
140
- self.data_type = attributes[:'DataType']
141
- end
142
-
143
- if attributes.has_key?(:'TargetDigitCount')
144
- self.target_digit_count = attributes[:'TargetDigitCount']
145
- end
146
-
147
- if attributes.has_key?(:'MinimumCharacterCount')
148
- self.minimum_character_count = attributes[:'MinimumCharacterCount']
149
- end
150
-
151
- if attributes.has_key?(:'AllowNumericDigits')
152
- self.allow_numeric_digits = attributes[:'AllowNumericDigits']
153
- end
154
-
155
- if attributes.has_key?(:'VerticalAlignmentType')
156
- self.vertical_alignment_type = attributes[:'VerticalAlignmentType']
157
- end
158
-
159
- if attributes.has_key?(:'HorizontalAlignmentType')
160
- self.horizontal_alignment_type = attributes[:'HorizontalAlignmentType']
161
- end
162
-
163
- if attributes.has_key?(:'TargetFieldWidth_Relative')
164
- self.target_field_width_relative = attributes[:'TargetFieldWidth_Relative']
165
- end
166
-
167
- if attributes.has_key?(:'TargetFieldHeight_Relative')
168
- self.target_field_height_relative = attributes[:'TargetFieldHeight_Relative']
169
- end
170
-
171
- if attributes.has_key?(:'TargetFieldHorizontalAdjustment')
172
- self.target_field_horizontal_adjustment = attributes[:'TargetFieldHorizontalAdjustment']
173
- end
174
-
175
- if attributes.has_key?(:'TargetFieldVerticalAdjustment')
176
- self.target_field_vertical_adjustment = attributes[:'TargetFieldVerticalAdjustment']
177
- end
178
-
179
- if attributes.has_key?(:'Ignore')
180
- if (value = attributes[:'Ignore']).is_a?(Array)
181
- self.ignore = value
182
- end
183
- end
184
-
185
- end
186
-
187
- # Show invalid properties with the reasons. Usually used together with valid?
188
- # @return Array for valid properties with the reasons
189
- def list_invalid_properties
190
- invalid_properties = Array.new
191
- return invalid_properties
192
- end
193
-
194
- # Check to see if the all the properties in the model are valid
195
- # @return true if the model is valid
196
- def valid?
197
- return true
198
- end
199
-
200
- # Checks equality by comparing each attribute.
201
- # @param [Object] Object to be compared
202
- def ==(o)
203
- return true if self.equal?(o)
204
- self.class == o.class &&
205
- field_id == o.field_id &&
206
- left_anchor == o.left_anchor &&
207
- top_anchor == o.top_anchor &&
208
- bottom_anchor == o.bottom_anchor &&
209
- anchor_mode == o.anchor_mode &&
210
- data_type == o.data_type &&
211
- target_digit_count == o.target_digit_count &&
212
- minimum_character_count == o.minimum_character_count &&
213
- allow_numeric_digits == o.allow_numeric_digits &&
214
- vertical_alignment_type == o.vertical_alignment_type &&
215
- horizontal_alignment_type == o.horizontal_alignment_type &&
216
- target_field_width_relative == o.target_field_width_relative &&
217
- target_field_height_relative == o.target_field_height_relative &&
218
- target_field_horizontal_adjustment == o.target_field_horizontal_adjustment &&
219
- target_field_vertical_adjustment == o.target_field_vertical_adjustment &&
220
- ignore == o.ignore
221
- end
222
-
223
- # @see the `==` method
224
- # @param [Object] Object to be compared
225
- def eql?(o)
226
- self == o
227
- end
228
-
229
- # Calculates hash code according to all attributes.
230
- # @return [Fixnum] Hash code
231
- def hash
232
- [field_id, left_anchor, top_anchor, bottom_anchor, anchor_mode, data_type, target_digit_count, minimum_character_count, allow_numeric_digits, vertical_alignment_type, horizontal_alignment_type, target_field_width_relative, target_field_height_relative, target_field_horizontal_adjustment, target_field_vertical_adjustment, ignore].hash
233
- end
234
-
235
- # Builds the object from hash
236
- # @param [Hash] attributes Model attributes in the form of hash
237
- # @return [Object] Returns the model itself
238
- def build_from_hash(attributes)
239
- return nil unless attributes.is_a?(Hash)
240
- self.class.swagger_types.each_pair do |key, type|
241
- if type =~ /\AArray<(.*)>/i
242
- # check to ensure the input is an array given that the the attribute
243
- # is documented as an array but the input is not
244
- if attributes[self.class.attribute_map[key]].is_a?(Array)
245
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
246
- end
247
- elsif !attributes[self.class.attribute_map[key]].nil?
248
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
249
- end # or else data not found in attributes(hash), not an issue as the data can be optional
250
- end
251
-
252
- self
253
- end
254
-
255
- # Deserializes the data based on type
256
- # @param string type Data type
257
- # @param string value Value to be deserialized
258
- # @return [Object] Deserialized data
259
- def _deserialize(type, value)
260
- case type.to_sym
261
- when :DateTime
262
- DateTime.parse(value)
263
- when :Date
264
- Date.parse(value)
265
- when :String
266
- value.to_s
267
- when :Integer
268
- value.to_i
269
- when :Float
270
- value.to_f
271
- when :BOOLEAN
272
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
273
- true
274
- else
275
- false
276
- end
277
- when :Object
278
- # generic object (usually a Hash), return directly
279
- value
280
- when /\AArray<(?<inner_type>.+)>\z/
281
- inner_type = Regexp.last_match[:inner_type]
282
- value.map { |v| _deserialize(inner_type, v) }
283
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
284
- k_type = Regexp.last_match[:k_type]
285
- v_type = Regexp.last_match[:v_type]
286
- {}.tap do |hash|
287
- value.each do |k, v|
288
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
289
- end
290
- end
291
- else # model
292
- temp_model = CloudmersiveOcrApiClient.const_get(type).new
293
- temp_model.build_from_hash(value)
294
- end
295
- end
296
-
297
- # Returns the string representation of the object
298
- # @return [String] String presentation of the object
299
- def to_s
300
- to_hash.to_s
301
- end
302
-
303
- # to_body is an alias to to_hash (backward compatibility)
304
- # @return [Hash] Returns the object in the form of hash
305
- def to_body
306
- to_hash
307
- end
308
-
309
- # Returns the object in the form of hash
310
- # @return [Hash] Returns the object in the form of hash
311
- def to_hash
312
- hash = {}
313
- self.class.attribute_map.each_pair do |attr, param|
314
- value = self.send(attr)
315
- next if value.nil?
316
- hash[param] = _to_hash(value)
317
- end
318
- hash
319
- end
320
-
321
- # Outputs non-array value in the form of hash
322
- # For object, use to_hash. Otherwise, just return the value
323
- # @param [Object] value Any valid value
324
- # @return [Hash] Returns the value in the form of hash
325
- def _to_hash(value)
326
- if value.is_a?(Array)
327
- value.compact.map{ |v| _to_hash(v) }
328
- elsif value.is_a?(Hash)
329
- {}.tap do |hash|
330
- value.each { |k, v| hash[k] = _to_hash(v) }
331
- end
332
- elsif value.respond_to? :to_hash
333
- value.to_hash
334
- else
335
- value
336
- end
337
- end
338
-
339
- end
340
-
341
- end