cloudmersive-ocr-api-client 1.5.0 → 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 -25
  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 -571
  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 -191
  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 -605
  41. data/lib/cloudmersive-ocr-api-client/api/pdf_ocr_api.rb +0 -212
  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 -361
  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 -169
  76. data/spec/api/pdf_ocr_api_spec.rb +0 -78
  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 -144
  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,361 +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 - alterate match text for the specified anchor
31
- attr_accessor :alternate_anchor
32
-
33
- # 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.
34
- attr_accessor :anchor_mode
35
-
36
- # 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)
37
- attr_accessor :data_type
38
-
39
- # Optional - the target number of digits in the field; useful for fixed-length fields
40
- attr_accessor :target_digit_count
41
-
42
- # Optional - the target number of digits in the field; useful for fixed-length fields
43
- attr_accessor :minimum_character_count
44
-
45
- # Optional - set to false to block values that contain numeric digits, set to true to allow numeric digits
46
- attr_accessor :allow_numeric_digits
47
-
48
- # Vertical alignment of target value area relative to the field anchor; Possible values are VCenter, Top, Bottom
49
- attr_accessor :vertical_alignment_type
50
-
51
- # Horizontal alignment of target value area relative to the field anchor; Possible values are Left, Right
52
- attr_accessor :horizontal_alignment_type
53
-
54
- # 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.
55
- attr_accessor :target_field_width_relative
56
-
57
- # Optional - scale factor for target field height - relative to height of field title
58
- attr_accessor :target_field_height_relative
59
-
60
- # Optional - horizontal adjestment in relative width of the field
61
- attr_accessor :target_field_horizontal_adjustment
62
-
63
- # Optional - vertical adjestment in relative height of the field
64
- attr_accessor :target_field_vertical_adjustment
65
-
66
- # Optional - Ignore any result items that contain a partial or complete match with these text strings
67
- attr_accessor :ignore
68
-
69
- # Optional - additional options that can be set for this field definition, separated by commas. Possible values are AllowMultiMatch (allow the same anchor to be matched to multiple fields)
70
- attr_accessor :options
71
-
72
-
73
- # Attribute mapping from ruby-style variable name to JSON key.
74
- def self.attribute_map
75
- {
76
- :'field_id' => :'FieldID',
77
- :'left_anchor' => :'LeftAnchor',
78
- :'top_anchor' => :'TopAnchor',
79
- :'bottom_anchor' => :'BottomAnchor',
80
- :'alternate_anchor' => :'AlternateAnchor',
81
- :'anchor_mode' => :'AnchorMode',
82
- :'data_type' => :'DataType',
83
- :'target_digit_count' => :'TargetDigitCount',
84
- :'minimum_character_count' => :'MinimumCharacterCount',
85
- :'allow_numeric_digits' => :'AllowNumericDigits',
86
- :'vertical_alignment_type' => :'VerticalAlignmentType',
87
- :'horizontal_alignment_type' => :'HorizontalAlignmentType',
88
- :'target_field_width_relative' => :'TargetFieldWidth_Relative',
89
- :'target_field_height_relative' => :'TargetFieldHeight_Relative',
90
- :'target_field_horizontal_adjustment' => :'TargetFieldHorizontalAdjustment',
91
- :'target_field_vertical_adjustment' => :'TargetFieldVerticalAdjustment',
92
- :'ignore' => :'Ignore',
93
- :'options' => :'Options'
94
- }
95
- end
96
-
97
- # Attribute type mapping.
98
- def self.swagger_types
99
- {
100
- :'field_id' => :'String',
101
- :'left_anchor' => :'String',
102
- :'top_anchor' => :'String',
103
- :'bottom_anchor' => :'String',
104
- :'alternate_anchor' => :'String',
105
- :'anchor_mode' => :'String',
106
- :'data_type' => :'String',
107
- :'target_digit_count' => :'Integer',
108
- :'minimum_character_count' => :'Integer',
109
- :'allow_numeric_digits' => :'BOOLEAN',
110
- :'vertical_alignment_type' => :'String',
111
- :'horizontal_alignment_type' => :'String',
112
- :'target_field_width_relative' => :'Float',
113
- :'target_field_height_relative' => :'Float',
114
- :'target_field_horizontal_adjustment' => :'Float',
115
- :'target_field_vertical_adjustment' => :'Float',
116
- :'ignore' => :'Array<String>',
117
- :'options' => :'String'
118
- }
119
- end
120
-
121
- # Initializes the object
122
- # @param [Hash] attributes Model attributes in the form of hash
123
- def initialize(attributes = {})
124
- return unless attributes.is_a?(Hash)
125
-
126
- # convert string to symbol for hash key
127
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
128
-
129
- if attributes.has_key?(:'FieldID')
130
- self.field_id = attributes[:'FieldID']
131
- end
132
-
133
- if attributes.has_key?(:'LeftAnchor')
134
- self.left_anchor = attributes[:'LeftAnchor']
135
- end
136
-
137
- if attributes.has_key?(:'TopAnchor')
138
- self.top_anchor = attributes[:'TopAnchor']
139
- end
140
-
141
- if attributes.has_key?(:'BottomAnchor')
142
- self.bottom_anchor = attributes[:'BottomAnchor']
143
- end
144
-
145
- if attributes.has_key?(:'AlternateAnchor')
146
- self.alternate_anchor = attributes[:'AlternateAnchor']
147
- end
148
-
149
- if attributes.has_key?(:'AnchorMode')
150
- self.anchor_mode = attributes[:'AnchorMode']
151
- end
152
-
153
- if attributes.has_key?(:'DataType')
154
- self.data_type = attributes[:'DataType']
155
- end
156
-
157
- if attributes.has_key?(:'TargetDigitCount')
158
- self.target_digit_count = attributes[:'TargetDigitCount']
159
- end
160
-
161
- if attributes.has_key?(:'MinimumCharacterCount')
162
- self.minimum_character_count = attributes[:'MinimumCharacterCount']
163
- end
164
-
165
- if attributes.has_key?(:'AllowNumericDigits')
166
- self.allow_numeric_digits = attributes[:'AllowNumericDigits']
167
- end
168
-
169
- if attributes.has_key?(:'VerticalAlignmentType')
170
- self.vertical_alignment_type = attributes[:'VerticalAlignmentType']
171
- end
172
-
173
- if attributes.has_key?(:'HorizontalAlignmentType')
174
- self.horizontal_alignment_type = attributes[:'HorizontalAlignmentType']
175
- end
176
-
177
- if attributes.has_key?(:'TargetFieldWidth_Relative')
178
- self.target_field_width_relative = attributes[:'TargetFieldWidth_Relative']
179
- end
180
-
181
- if attributes.has_key?(:'TargetFieldHeight_Relative')
182
- self.target_field_height_relative = attributes[:'TargetFieldHeight_Relative']
183
- end
184
-
185
- if attributes.has_key?(:'TargetFieldHorizontalAdjustment')
186
- self.target_field_horizontal_adjustment = attributes[:'TargetFieldHorizontalAdjustment']
187
- end
188
-
189
- if attributes.has_key?(:'TargetFieldVerticalAdjustment')
190
- self.target_field_vertical_adjustment = attributes[:'TargetFieldVerticalAdjustment']
191
- end
192
-
193
- if attributes.has_key?(:'Ignore')
194
- if (value = attributes[:'Ignore']).is_a?(Array)
195
- self.ignore = value
196
- end
197
- end
198
-
199
- if attributes.has_key?(:'Options')
200
- self.options = attributes[:'Options']
201
- end
202
-
203
- end
204
-
205
- # Show invalid properties with the reasons. Usually used together with valid?
206
- # @return Array for valid properties with the reasons
207
- def list_invalid_properties
208
- invalid_properties = Array.new
209
- return invalid_properties
210
- end
211
-
212
- # Check to see if the all the properties in the model are valid
213
- # @return true if the model is valid
214
- def valid?
215
- return true
216
- end
217
-
218
- # Checks equality by comparing each attribute.
219
- # @param [Object] Object to be compared
220
- def ==(o)
221
- return true if self.equal?(o)
222
- self.class == o.class &&
223
- field_id == o.field_id &&
224
- left_anchor == o.left_anchor &&
225
- top_anchor == o.top_anchor &&
226
- bottom_anchor == o.bottom_anchor &&
227
- alternate_anchor == o.alternate_anchor &&
228
- anchor_mode == o.anchor_mode &&
229
- data_type == o.data_type &&
230
- target_digit_count == o.target_digit_count &&
231
- minimum_character_count == o.minimum_character_count &&
232
- allow_numeric_digits == o.allow_numeric_digits &&
233
- vertical_alignment_type == o.vertical_alignment_type &&
234
- horizontal_alignment_type == o.horizontal_alignment_type &&
235
- target_field_width_relative == o.target_field_width_relative &&
236
- target_field_height_relative == o.target_field_height_relative &&
237
- target_field_horizontal_adjustment == o.target_field_horizontal_adjustment &&
238
- target_field_vertical_adjustment == o.target_field_vertical_adjustment &&
239
- ignore == o.ignore &&
240
- options == o.options
241
- end
242
-
243
- # @see the `==` method
244
- # @param [Object] Object to be compared
245
- def eql?(o)
246
- self == o
247
- end
248
-
249
- # Calculates hash code according to all attributes.
250
- # @return [Fixnum] Hash code
251
- def hash
252
- [field_id, left_anchor, top_anchor, bottom_anchor, alternate_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, options].hash
253
- end
254
-
255
- # Builds the object from hash
256
- # @param [Hash] attributes Model attributes in the form of hash
257
- # @return [Object] Returns the model itself
258
- def build_from_hash(attributes)
259
- return nil unless attributes.is_a?(Hash)
260
- self.class.swagger_types.each_pair do |key, type|
261
- if type =~ /\AArray<(.*)>/i
262
- # check to ensure the input is an array given that the the attribute
263
- # is documented as an array but the input is not
264
- if attributes[self.class.attribute_map[key]].is_a?(Array)
265
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
266
- end
267
- elsif !attributes[self.class.attribute_map[key]].nil?
268
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
269
- end # or else data not found in attributes(hash), not an issue as the data can be optional
270
- end
271
-
272
- self
273
- end
274
-
275
- # Deserializes the data based on type
276
- # @param string type Data type
277
- # @param string value Value to be deserialized
278
- # @return [Object] Deserialized data
279
- def _deserialize(type, value)
280
- case type.to_sym
281
- when :DateTime
282
- DateTime.parse(value)
283
- when :Date
284
- Date.parse(value)
285
- when :String
286
- value.to_s
287
- when :Integer
288
- value.to_i
289
- when :Float
290
- value.to_f
291
- when :BOOLEAN
292
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
293
- true
294
- else
295
- false
296
- end
297
- when :Object
298
- # generic object (usually a Hash), return directly
299
- value
300
- when /\AArray<(?<inner_type>.+)>\z/
301
- inner_type = Regexp.last_match[:inner_type]
302
- value.map { |v| _deserialize(inner_type, v) }
303
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
304
- k_type = Regexp.last_match[:k_type]
305
- v_type = Regexp.last_match[:v_type]
306
- {}.tap do |hash|
307
- value.each do |k, v|
308
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
309
- end
310
- end
311
- else # model
312
- temp_model = CloudmersiveOcrApiClient.const_get(type).new
313
- temp_model.build_from_hash(value)
314
- end
315
- end
316
-
317
- # Returns the string representation of the object
318
- # @return [String] String presentation of the object
319
- def to_s
320
- to_hash.to_s
321
- end
322
-
323
- # to_body is an alias to to_hash (backward compatibility)
324
- # @return [Hash] Returns the object in the form of hash
325
- def to_body
326
- to_hash
327
- end
328
-
329
- # Returns the object in the form of hash
330
- # @return [Hash] Returns the object in the form of hash
331
- def to_hash
332
- hash = {}
333
- self.class.attribute_map.each_pair do |attr, param|
334
- value = self.send(attr)
335
- next if value.nil?
336
- hash[param] = _to_hash(value)
337
- end
338
- hash
339
- end
340
-
341
- # Outputs non-array value in the form of hash
342
- # For object, use to_hash. Otherwise, just return the value
343
- # @param [Object] value Any valid value
344
- # @return [Hash] Returns the value in the form of hash
345
- def _to_hash(value)
346
- if value.is_a?(Array)
347
- value.compact.map{ |v| _to_hash(v) }
348
- elsif value.is_a?(Hash)
349
- {}.tap do |hash|
350
- value.each { |k, v| hash[k] = _to_hash(v) }
351
- end
352
- elsif value.respond_to? :to_hash
353
- value.to_hash
354
- else
355
- value
356
- end
357
- end
358
-
359
- end
360
-
361
- end