cloudmersive-ocr-api-client 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -5
  3. data/cloudmersive-ocr-api-client.gemspec +1 -1
  4. data/docs/GetPageAngleResult.md +9 -0
  5. data/docs/ImageOcrApi.md +3 -1
  6. data/docs/PreprocessingApi.md +114 -4
  7. data/docs/ReceiptsApi.md +63 -0
  8. data/lib/cloudmersive-ocr-api-client.rb +3 -1
  9. data/lib/cloudmersive-ocr-api-client/api/image_ocr_api.rb +4 -1
  10. data/lib/cloudmersive-ocr-api-client/api/pdf_ocr_api.rb +1 -1
  11. data/lib/cloudmersive-ocr-api-client/api/preprocessing_api.rb +117 -5
  12. data/lib/cloudmersive-ocr-api-client/api/receipts_api.rb +79 -0
  13. data/lib/cloudmersive-ocr-api-client/api_client.rb +1 -1
  14. data/lib/cloudmersive-ocr-api-client/api_error.rb +1 -1
  15. data/lib/cloudmersive-ocr-api-client/configuration.rb +1 -1
  16. data/lib/cloudmersive-ocr-api-client/models/get_page_angle_result.rb +199 -0
  17. data/lib/cloudmersive-ocr-api-client/models/image_to_lines_with_location_result.rb +1 -1
  18. data/lib/cloudmersive-ocr-api-client/models/image_to_text_response.rb +1 -1
  19. data/lib/cloudmersive-ocr-api-client/models/image_to_words_with_location_result.rb +1 -1
  20. data/lib/cloudmersive-ocr-api-client/models/ocr_line_element.rb +1 -1
  21. data/lib/cloudmersive-ocr-api-client/models/ocr_page_result.rb +1 -1
  22. data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_lines_with_location.rb +1 -1
  23. data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_words_with_location.rb +1 -1
  24. data/lib/cloudmersive-ocr-api-client/models/ocr_photo_text_element.rb +1 -1
  25. data/lib/cloudmersive-ocr-api-client/models/ocr_word_element.rb +1 -1
  26. data/lib/cloudmersive-ocr-api-client/models/pdf_to_lines_with_location_result.rb +1 -1
  27. data/lib/cloudmersive-ocr-api-client/models/pdf_to_text_response.rb +1 -1
  28. data/lib/cloudmersive-ocr-api-client/models/pdf_to_words_with_location_result.rb +1 -1
  29. data/lib/cloudmersive-ocr-api-client/models/photo_to_words_with_location_result.rb +1 -1
  30. data/lib/cloudmersive-ocr-api-client/version.rb +2 -2
  31. data/spec/api/image_ocr_api_spec.rb +2 -1
  32. data/spec/api/pdf_ocr_api_spec.rb +1 -1
  33. data/spec/api/preprocessing_api_spec.rb +27 -3
  34. data/spec/api/receipts_api_spec.rb +47 -0
  35. data/spec/api_client_spec.rb +1 -1
  36. data/spec/configuration_spec.rb +1 -1
  37. data/spec/models/get_page_angle_result_spec.rb +48 -0
  38. data/spec/models/image_to_lines_with_location_result_spec.rb +1 -1
  39. data/spec/models/image_to_text_response_spec.rb +1 -1
  40. data/spec/models/image_to_words_with_location_result_spec.rb +1 -1
  41. data/spec/models/ocr_line_element_spec.rb +1 -1
  42. data/spec/models/ocr_page_result_spec.rb +1 -1
  43. data/spec/models/ocr_page_result_with_lines_with_location_spec.rb +1 -1
  44. data/spec/models/ocr_page_result_with_words_with_location_spec.rb +1 -1
  45. data/spec/models/ocr_photo_text_element_spec.rb +1 -1
  46. data/spec/models/ocr_word_element_spec.rb +1 -1
  47. data/spec/models/pdf_to_lines_with_location_result_spec.rb +1 -1
  48. data/spec/models/pdf_to_text_response_spec.rb +1 -1
  49. data/spec/models/pdf_to_words_with_location_result_spec.rb +1 -1
  50. data/spec/models/photo_to_words_with_location_result_spec.rb +1 -1
  51. data/spec/spec_helper.rb +1 -1
  52. metadata +22 -15
@@ -0,0 +1,79 @@
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: unset
10
+
11
+ =end
12
+
13
+ require "uri"
14
+
15
+ module CloudmersiveOcrApiClient
16
+ class ReceiptsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ # Convert a photo of a receipt into a CSV file containing structured information from the receipt
24
+ # Leverage Deep Learning to automatically turn a photo of a receipt into a CSV file containing the structured information from the receipt.
25
+ # @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [Object]
28
+ def receipts_photo_to_csv(image_file, opts = {})
29
+ data, _status_code, _headers = receipts_photo_to_csv_with_http_info(image_file, opts)
30
+ return data
31
+ end
32
+
33
+ # Convert a photo of a receipt into a CSV file containing structured information from the receipt
34
+ # Leverage Deep Learning to automatically turn a photo of a receipt into a CSV file containing the structured information from the receipt.
35
+ # @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
36
+ # @param [Hash] opts the optional parameters
37
+ # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers
38
+ def receipts_photo_to_csv_with_http_info(image_file, opts = {})
39
+ if @api_client.config.debugging
40
+ @api_client.config.logger.debug "Calling API: ReceiptsApi.receipts_photo_to_csv ..."
41
+ end
42
+ # verify the required parameter 'image_file' is set
43
+ if @api_client.config.client_side_validation && image_file.nil?
44
+ fail ArgumentError, "Missing the required parameter 'image_file' when calling ReceiptsApi.receipts_photo_to_csv"
45
+ end
46
+ # resource path
47
+ local_var_path = "/ocr/receipts/photo/to/csv"
48
+
49
+ # query parameters
50
+ query_params = {}
51
+
52
+ # header parameters
53
+ header_params = {}
54
+ # HTTP header 'Accept' (if needed)
55
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
56
+ # HTTP header 'Content-Type'
57
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
58
+
59
+ # form parameters
60
+ form_params = {}
61
+ form_params["imageFile"] = image_file
62
+
63
+ # http body (model)
64
+ post_body = nil
65
+ auth_names = ['Apikey']
66
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
67
+ :header_params => header_params,
68
+ :query_params => query_params,
69
+ :form_params => form_params,
70
+ :body => post_body,
71
+ :auth_names => auth_names,
72
+ :return_type => 'Object')
73
+ if @api_client.config.debugging
74
+ @api_client.config.logger.debug "API called: ReceiptsApi#receipts_photo_to_csv\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
75
+ end
76
+ return data, status_code, headers
77
+ end
78
+ end
79
+ end
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
@@ -0,0 +1,199 @@
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: unset
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveOcrApiClient
16
+ # Result of performing a get-page-angle operation
17
+ class GetPageAngleResult
18
+ # True if the operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # Angle of the page in radians; 0 represents perfectly horizontal
22
+ attr_accessor :angle
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'successful' => :'Successful',
29
+ :'angle' => :'Angle'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'successful' => :'BOOLEAN',
37
+ :'angle' => :'Float'
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?(:'Successful')
50
+ self.successful = attributes[:'Successful']
51
+ end
52
+
53
+ if attributes.has_key?(:'Angle')
54
+ self.angle = attributes[:'Angle']
55
+ end
56
+
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ return invalid_properties
64
+ end
65
+
66
+ # Check to see if the all the properties in the model are valid
67
+ # @return true if the model is valid
68
+ def valid?
69
+ return true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ successful == o.successful &&
78
+ angle == o.angle
79
+ end
80
+
81
+ # @see the `==` method
82
+ # @param [Object] Object to be compared
83
+ def eql?(o)
84
+ self == o
85
+ end
86
+
87
+ # Calculates hash code according to all attributes.
88
+ # @return [Fixnum] Hash code
89
+ def hash
90
+ [successful, angle].hash
91
+ end
92
+
93
+ # Builds the object from hash
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ # @return [Object] Returns the model itself
96
+ def build_from_hash(attributes)
97
+ return nil unless attributes.is_a?(Hash)
98
+ self.class.swagger_types.each_pair do |key, type|
99
+ if type =~ /\AArray<(.*)>/i
100
+ # check to ensure the input is an array given that the the attribute
101
+ # is documented as an array but the input is not
102
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
103
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
104
+ end
105
+ elsif !attributes[self.class.attribute_map[key]].nil?
106
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
107
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
108
+ end
109
+
110
+ self
111
+ end
112
+
113
+ # Deserializes the data based on type
114
+ # @param string type Data type
115
+ # @param string value Value to be deserialized
116
+ # @return [Object] Deserialized data
117
+ def _deserialize(type, value)
118
+ case type.to_sym
119
+ when :DateTime
120
+ DateTime.parse(value)
121
+ when :Date
122
+ Date.parse(value)
123
+ when :String
124
+ value.to_s
125
+ when :Integer
126
+ value.to_i
127
+ when :Float
128
+ value.to_f
129
+ when :BOOLEAN
130
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
131
+ true
132
+ else
133
+ false
134
+ end
135
+ when :Object
136
+ # generic object (usually a Hash), return directly
137
+ value
138
+ when /\AArray<(?<inner_type>.+)>\z/
139
+ inner_type = Regexp.last_match[:inner_type]
140
+ value.map { |v| _deserialize(inner_type, v) }
141
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
142
+ k_type = Regexp.last_match[:k_type]
143
+ v_type = Regexp.last_match[:v_type]
144
+ {}.tap do |hash|
145
+ value.each do |k, v|
146
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
147
+ end
148
+ end
149
+ else # model
150
+ temp_model = CloudmersiveOcrApiClient.const_get(type).new
151
+ temp_model.build_from_hash(value)
152
+ end
153
+ end
154
+
155
+ # Returns the string representation of the object
156
+ # @return [String] String presentation of the object
157
+ def to_s
158
+ to_hash.to_s
159
+ end
160
+
161
+ # to_body is an alias to to_hash (backward compatibility)
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_body
164
+ to_hash
165
+ end
166
+
167
+ # Returns the object in the form of hash
168
+ # @return [Hash] Returns the object in the form of hash
169
+ def to_hash
170
+ hash = {}
171
+ self.class.attribute_map.each_pair do |attr, param|
172
+ value = self.send(attr)
173
+ next if value.nil?
174
+ hash[param] = _to_hash(value)
175
+ end
176
+ hash
177
+ end
178
+
179
+ # Outputs non-array value in the form of hash
180
+ # For object, use to_hash. Otherwise, just return the value
181
+ # @param [Object] value Any valid value
182
+ # @return [Hash] Returns the value in the form of hash
183
+ def _to_hash(value)
184
+ if value.is_a?(Array)
185
+ value.compact.map{ |v| _to_hash(v) }
186
+ elsif value.is_a?(Hash)
187
+ {}.tap do |hash|
188
+ value.each { |k, v| hash[k] = _to_hash(v) }
189
+ end
190
+ elsif value.respond_to? :to_hash
191
+ value.to_hash
192
+ else
193
+ value
194
+ end
195
+ end
196
+
197
+ end
198
+
199
+ end
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
@@ -6,10 +6,10 @@
6
6
  OpenAPI spec version: v1
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: unset
10
10
 
11
11
  =end
12
12
 
13
13
  module CloudmersiveOcrApiClient
14
- VERSION = "1.3.4"
14
+ VERSION = "1.3.5"
15
15
  end