cloudmersive-ocr-api-client 1.3.7 → 1.3.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1b5a3699492d2fa535b5173b9607a76c1a754a9d59f0049baadc3f563514dce
4
- data.tar.gz: 5e7e7a8ea78364e15871ceb77e70dc93deeeb9acf59dbfc6c17a87fd872bd713
3
+ metadata.gz: 8e8cfa56fbd57f18eb39d81ccdbb453661ae711a46ac47bd43f67e29b7c3e0c6
4
+ data.tar.gz: 8abfebe51dc5e4fea93363cc73d9b239bf27657d958f5add2bc9ba1cc198d81c
5
5
  SHA512:
6
- metadata.gz: 53f1cad544f7617a7fcd659485d90f0a52fedf533f1acc0d8af3597fa1a8453f79d791fe8f9e42304a87716ba82fc0999aebc30d45836cf2d695c59848e6b1e4
7
- data.tar.gz: 79db60a648f53388aa622270ad581df86702759830fd9f5660f1df2b537b45a2f315054cad95f98b8ee9c7ede349b3dfe8327bca827f1d9b7505c1848b4861dc
6
+ metadata.gz: 865b89f335c21d37ad1fb01aba466fe36de96068a377f85192ad78b56a6a367804505e1dab13ea63940b4c9c456696c52f2481f9193cb93b216a59fc6e56079d
7
+ data.tar.gz: 507b509aabcf1d11ada4e55de067bc5d2058c8027bddca6a834de47bd6518e8a84c25360bcf7de51e560140e047ee2542f63f5fcc30c71bd2fc828601adb3ddb
data/README.md CHANGED
@@ -7,7 +7,7 @@ The powerful Optical Character Recognition (OCR) APIs let you convert scanned im
7
7
  This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
8
8
 
9
9
  - API version: v1
10
- - Package version: 1.3.7
10
+ - Package version: 1.3.8
11
11
  - Build package: io.swagger.codegen.languages.RubyClientCodegen
12
12
 
13
13
  ## Installation
@@ -23,15 +23,15 @@ gem build cloudmersive-ocr-api-client.gemspec
23
23
  Then either install the gem locally:
24
24
 
25
25
  ```shell
26
- gem install ./cloudmersive-ocr-api-client-1.3.7.gem
26
+ gem install ./cloudmersive-ocr-api-client-1.3.8.gem
27
27
  ```
28
- (for development, run `gem install --dev ./cloudmersive-ocr-api-client-1.3.7.gem` to install the development dependencies)
28
+ (for development, run `gem install --dev ./cloudmersive-ocr-api-client-1.3.8.gem` to install the development dependencies)
29
29
 
30
30
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
31
31
 
32
32
  Finally add this to the Gemfile:
33
33
 
34
- gem 'cloudmersive-ocr-api-client', '~> 1.3.7'
34
+ gem 'cloudmersive-ocr-api-client', '~> 1.3.8'
35
35
 
36
36
  ### Install from Git
37
37
 
@@ -89,6 +89,7 @@ Class | Method | HTTP request | Description
89
89
  ------------ | ------------- | ------------- | -------------
90
90
  *CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_image_lines_with_location**](docs/ImageOcrApi.md#image_ocr_image_lines_with_location) | **POST** /ocr/image/to/lines-with-location | Convert a scanned image into words with location
91
91
  *CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_image_words_with_location**](docs/ImageOcrApi.md#image_ocr_image_words_with_location) | **POST** /ocr/image/to/words-with-location | Convert a scanned image into words with location
92
+ *CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_photo_recognize_receipt**](docs/ImageOcrApi.md#image_ocr_photo_recognize_receipt) | **POST** /ocr/photo/recognize/receipt | Recognize a photo of a receipt, extract key business information
92
93
  *CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_photo_to_text**](docs/ImageOcrApi.md#image_ocr_photo_to_text) | **POST** /ocr/photo/toText | Convert a photo of a document into text
93
94
  *CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_photo_words_with_location**](docs/ImageOcrApi.md#image_ocr_photo_words_with_location) | **POST** /ocr/photo/to/words-with-location | Convert a photo of a document or receipt into words with location
94
95
  *CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_post**](docs/ImageOcrApi.md#image_ocr_post) | **POST** /ocr/image/toText | Convert a scanned image into text
@@ -119,6 +120,7 @@ Class | Method | HTTP request | Description
119
120
  - [CloudmersiveOcrApiClient::PdfToTextResponse](docs/PdfToTextResponse.md)
120
121
  - [CloudmersiveOcrApiClient::PdfToWordsWithLocationResult](docs/PdfToWordsWithLocationResult.md)
121
122
  - [CloudmersiveOcrApiClient::PhotoToWordsWithLocationResult](docs/PhotoToWordsWithLocationResult.md)
123
+ - [CloudmersiveOcrApiClient::ReceiptRecognitionResult](docs/ReceiptRecognitionResult.md)
122
124
 
123
125
 
124
126
  ## Documentation for Authorization
data/docs/ImageOcrApi.md CHANGED
@@ -6,6 +6,7 @@ Method | HTTP request | Description
6
6
  ------------- | ------------- | -------------
7
7
  [**image_ocr_image_lines_with_location**](ImageOcrApi.md#image_ocr_image_lines_with_location) | **POST** /ocr/image/to/lines-with-location | Convert a scanned image into words with location
8
8
  [**image_ocr_image_words_with_location**](ImageOcrApi.md#image_ocr_image_words_with_location) | **POST** /ocr/image/to/words-with-location | Convert a scanned image into words with location
9
+ [**image_ocr_photo_recognize_receipt**](ImageOcrApi.md#image_ocr_photo_recognize_receipt) | **POST** /ocr/photo/recognize/receipt | Recognize a photo of a receipt, extract key business information
9
10
  [**image_ocr_photo_to_text**](ImageOcrApi.md#image_ocr_photo_to_text) | **POST** /ocr/photo/toText | Convert a photo of a document into text
10
11
  [**image_ocr_photo_words_with_location**](ImageOcrApi.md#image_ocr_photo_words_with_location) | **POST** /ocr/photo/to/words-with-location | Convert a photo of a document or receipt into words with location
11
12
  [**image_ocr_post**](ImageOcrApi.md#image_ocr_post) | **POST** /ocr/image/toText | Convert a scanned image into text
@@ -131,6 +132,64 @@ Name | Type | Description | Notes
131
132
 
132
133
 
133
134
 
135
+ # **image_ocr_photo_recognize_receipt**
136
+ > ReceiptRecognitionResult image_ocr_photo_recognize_receipt(image_file, opts)
137
+
138
+ Recognize a photo of a receipt, extract key business information
139
+
140
+ Analyzes a photograph of a receipt as input, and outputs key business information such as the name of the business, the address of the business, the phone number of the business, the total of the receipt, the date of the receipt, and more.
141
+
142
+ ### Example
143
+ ```ruby
144
+ # load the gem
145
+ require 'cloudmersive-ocr-api-client'
146
+ # setup authorization
147
+ CloudmersiveOcrApiClient.configure do |config|
148
+ # Configure API key authorization: Apikey
149
+ config.api_key['Apikey'] = 'YOUR API KEY'
150
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
151
+ #config.api_key_prefix['Apikey'] = 'Bearer'
152
+ end
153
+
154
+ api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new
155
+
156
+ image_file = File.new("/path/to/file.txt") # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
157
+
158
+ opts = {
159
+ language: "language_example" # String | Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
160
+ }
161
+
162
+ begin
163
+ #Recognize a photo of a receipt, extract key business information
164
+ result = api_instance.image_ocr_photo_recognize_receipt(image_file, opts)
165
+ p result
166
+ rescue CloudmersiveOcrApiClient::ApiError => e
167
+ puts "Exception when calling ImageOcrApi->image_ocr_photo_recognize_receipt: #{e}"
168
+ end
169
+ ```
170
+
171
+ ### Parameters
172
+
173
+ Name | Type | Description | Notes
174
+ ------------- | ------------- | ------------- | -------------
175
+ **image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
176
+ **language** | **String**| Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish) | [optional]
177
+
178
+ ### Return type
179
+
180
+ [**ReceiptRecognitionResult**](ReceiptRecognitionResult.md)
181
+
182
+ ### Authorization
183
+
184
+ [Apikey](../README.md#Apikey)
185
+
186
+ ### HTTP request headers
187
+
188
+ - **Content-Type**: multipart/form-data
189
+ - **Accept**: application/json, text/json, application/xml, text/xml
190
+
191
+
192
+
134
193
  # **image_ocr_photo_to_text**
135
194
  > ImageToTextResponse image_ocr_photo_to_text(image_file, opts)
136
195
 
@@ -0,0 +1,13 @@
1
+ # CloudmersiveOcrApiClient::ReceiptRecognitionResult
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **successful** | **BOOLEAN** | | [optional]
7
+ **timestamp** | **DateTime** | | [optional]
8
+ **business_name** | **String** | | [optional]
9
+ **address_string** | **String** | | [optional]
10
+ **phone_number** | **String** | | [optional]
11
+ **receipt_total** | **Float** | | [optional]
12
+
13
+
@@ -31,6 +31,7 @@ require 'cloudmersive-ocr-api-client/models/pdf_to_lines_with_location_result'
31
31
  require 'cloudmersive-ocr-api-client/models/pdf_to_text_response'
32
32
  require 'cloudmersive-ocr-api-client/models/pdf_to_words_with_location_result'
33
33
  require 'cloudmersive-ocr-api-client/models/photo_to_words_with_location_result'
34
+ require 'cloudmersive-ocr-api-client/models/receipt_recognition_result'
34
35
 
35
36
  # APIs
36
37
  require 'cloudmersive-ocr-api-client/api/image_ocr_api'
@@ -144,6 +144,65 @@ module CloudmersiveOcrApiClient
144
144
  return data, status_code, headers
145
145
  end
146
146
 
147
+ # Recognize a photo of a receipt, extract key business information
148
+ # Analyzes a photograph of a receipt as input, and outputs key business information such as the name of the business, the address of the business, the phone number of the business, the total of the receipt, the date of the receipt, and more.
149
+ # @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
150
+ # @param [Hash] opts the optional parameters
151
+ # @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
152
+ # @return [ReceiptRecognitionResult]
153
+ def image_ocr_photo_recognize_receipt(image_file, opts = {})
154
+ data, _status_code, _headers = image_ocr_photo_recognize_receipt_with_http_info(image_file, opts)
155
+ return data
156
+ end
157
+
158
+ # Recognize a photo of a receipt, extract key business information
159
+ # Analyzes a photograph of a receipt as input, and outputs key business information such as the name of the business, the address of the business, the phone number of the business, the total of the receipt, the date of the receipt, and more.
160
+ # @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
161
+ # @param [Hash] opts the optional parameters
162
+ # @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
163
+ # @return [Array<(ReceiptRecognitionResult, Fixnum, Hash)>] ReceiptRecognitionResult data, response status code and response headers
164
+ def image_ocr_photo_recognize_receipt_with_http_info(image_file, opts = {})
165
+ if @api_client.config.debugging
166
+ @api_client.config.logger.debug "Calling API: ImageOcrApi.image_ocr_photo_recognize_receipt ..."
167
+ end
168
+ # verify the required parameter 'image_file' is set
169
+ if @api_client.config.client_side_validation && image_file.nil?
170
+ fail ArgumentError, "Missing the required parameter 'image_file' when calling ImageOcrApi.image_ocr_photo_recognize_receipt"
171
+ end
172
+ # resource path
173
+ local_var_path = "/ocr/photo/recognize/receipt"
174
+
175
+ # query parameters
176
+ query_params = {}
177
+
178
+ # header parameters
179
+ header_params = {}
180
+ # HTTP header 'Accept' (if needed)
181
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
182
+ # HTTP header 'Content-Type'
183
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
184
+ header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
185
+
186
+ # form parameters
187
+ form_params = {}
188
+ form_params["imageFile"] = image_file
189
+
190
+ # http body (model)
191
+ post_body = nil
192
+ auth_names = ['Apikey']
193
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
194
+ :header_params => header_params,
195
+ :query_params => query_params,
196
+ :form_params => form_params,
197
+ :body => post_body,
198
+ :auth_names => auth_names,
199
+ :return_type => 'ReceiptRecognitionResult')
200
+ if @api_client.config.debugging
201
+ @api_client.config.logger.debug "API called: ImageOcrApi#image_ocr_photo_recognize_receipt\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
202
+ end
203
+ return data, status_code, headers
204
+ end
205
+
147
206
  # Convert a photo of a document into text
148
207
  # Converts an uploaded photo of a document in common formats such as JPEG, PNG into text via Optical Character Recognition. This API is intended to be run on photos of documents, e.g. taken with a smartphone and supports cases where other content, such as a desk, are in the frame and the camera is crooked. If you want to OCR a scanned image, use the image/toText API call instead as it is designed for scanned images.
149
208
  # @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
@@ -0,0 +1,233 @@
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 recognizing a receipt, to extract the key information from the receipt
17
+ class ReceiptRecognitionResult
18
+ attr_accessor :successful
19
+
20
+ attr_accessor :timestamp
21
+
22
+ attr_accessor :business_name
23
+
24
+ attr_accessor :address_string
25
+
26
+ attr_accessor :phone_number
27
+
28
+ attr_accessor :receipt_total
29
+
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'successful' => :'Successful',
35
+ :'timestamp' => :'Timestamp',
36
+ :'business_name' => :'BusinessName',
37
+ :'address_string' => :'AddressString',
38
+ :'phone_number' => :'PhoneNumber',
39
+ :'receipt_total' => :'ReceiptTotal'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.swagger_types
45
+ {
46
+ :'successful' => :'BOOLEAN',
47
+ :'timestamp' => :'DateTime',
48
+ :'business_name' => :'String',
49
+ :'address_string' => :'String',
50
+ :'phone_number' => :'String',
51
+ :'receipt_total' => :'Float'
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?(:'Timestamp')
68
+ self.timestamp = attributes[:'Timestamp']
69
+ end
70
+
71
+ if attributes.has_key?(:'BusinessName')
72
+ self.business_name = attributes[:'BusinessName']
73
+ end
74
+
75
+ if attributes.has_key?(:'AddressString')
76
+ self.address_string = attributes[:'AddressString']
77
+ end
78
+
79
+ if attributes.has_key?(:'PhoneNumber')
80
+ self.phone_number = attributes[:'PhoneNumber']
81
+ end
82
+
83
+ if attributes.has_key?(:'ReceiptTotal')
84
+ self.receipt_total = attributes[:'ReceiptTotal']
85
+ end
86
+
87
+ end
88
+
89
+ # Show invalid properties with the reasons. Usually used together with valid?
90
+ # @return Array for valid properties with the reasons
91
+ def list_invalid_properties
92
+ invalid_properties = Array.new
93
+ return invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ return true
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ successful == o.successful &&
108
+ timestamp == o.timestamp &&
109
+ business_name == o.business_name &&
110
+ address_string == o.address_string &&
111
+ phone_number == o.phone_number &&
112
+ receipt_total == o.receipt_total
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, timestamp, business_name, address_string, phone_number, receipt_total].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 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
+
233
+ end
@@ -11,5 +11,5 @@ Swagger Codegen version: unset
11
11
  =end
12
12
 
13
13
  module CloudmersiveOcrApiClient
14
- VERSION = "1.3.7"
14
+ VERSION = "1.3.8"
15
15
  end
@@ -60,6 +60,19 @@ describe 'ImageOcrApi' do
60
60
  end
61
61
  end
62
62
 
63
+ # unit tests for image_ocr_photo_recognize_receipt
64
+ # Recognize a photo of a receipt, extract key business information
65
+ # Analyzes a photograph of a receipt as input, and outputs key business information such as the name of the business, the address of the business, the phone number of the business, the total of the receipt, the date of the receipt, and more.
66
+ # @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
67
+ # @param [Hash] opts the optional parameters
68
+ # @option opts [String] :language Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
69
+ # @return [ReceiptRecognitionResult]
70
+ describe 'image_ocr_photo_recognize_receipt test' do
71
+ it "should work" do
72
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
73
+ end
74
+ end
75
+
63
76
  # unit tests for image_ocr_photo_to_text
64
77
  # Convert a photo of a document into text
65
78
  # Converts an uploaded photo of a document in common formats such as JPEG, PNG into text via Optical Character Recognition. This API is intended to be run on photos of documents, e.g. taken with a smartphone and supports cases where other content, such as a desk, are in the frame and the camera is crooked. If you want to OCR a scanned image, use the image/toText API call instead as it is designed for scanned images.
@@ -0,0 +1,72 @@
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 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for CloudmersiveOcrApiClient::ReceiptRecognitionResult
18
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
+ # Please update as you see appropriate
20
+ describe 'ReceiptRecognitionResult' do
21
+ before do
22
+ # run before each test
23
+ @instance = CloudmersiveOcrApiClient::ReceiptRecognitionResult.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of ReceiptRecognitionResult' do
31
+ it 'should create an instance of ReceiptRecognitionResult' do
32
+ expect(@instance).to be_instance_of(CloudmersiveOcrApiClient::ReceiptRecognitionResult)
33
+ end
34
+ end
35
+ describe 'test attribute "successful"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "timestamp"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ describe 'test attribute "business_name"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ describe 'test attribute "address_string"' do
54
+ it 'should work' do
55
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
+ end
57
+ end
58
+
59
+ describe 'test attribute "phone_number"' do
60
+ it 'should work' do
61
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
62
+ end
63
+ end
64
+
65
+ describe 'test attribute "receipt_total"' do
66
+ it 'should work' do
67
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
68
+ end
69
+ end
70
+
71
+ end
72
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudmersive-ocr-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.7
4
+ version: 1.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cloudmersive
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-12 00:00:00.000000000 Z
11
+ date: 2019-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -218,6 +218,7 @@ files:
218
218
  - "./docs/PdfToWordsWithLocationResult.md"
219
219
  - "./docs/PhotoToWordsWithLocationResult.md"
220
220
  - "./docs/PreprocessingApi.md"
221
+ - "./docs/ReceiptRecognitionResult.md"
221
222
  - "./docs/ReceiptsApi.md"
222
223
  - "./git_push.sh"
223
224
  - "./lib/cloudmersive-ocr-api-client.rb"
@@ -242,6 +243,7 @@ files:
242
243
  - "./lib/cloudmersive-ocr-api-client/models/pdf_to_text_response.rb"
243
244
  - "./lib/cloudmersive-ocr-api-client/models/pdf_to_words_with_location_result.rb"
244
245
  - "./lib/cloudmersive-ocr-api-client/models/photo_to_words_with_location_result.rb"
246
+ - "./lib/cloudmersive-ocr-api-client/models/receipt_recognition_result.rb"
245
247
  - "./lib/cloudmersive-ocr-api-client/version.rb"
246
248
  - "./spec/api/image_ocr_api_spec.rb"
247
249
  - "./spec/api/pdf_ocr_api_spec.rb"
@@ -263,6 +265,7 @@ files:
263
265
  - "./spec/models/pdf_to_text_response_spec.rb"
264
266
  - "./spec/models/pdf_to_words_with_location_result_spec.rb"
265
267
  - "./spec/models/photo_to_words_with_location_result_spec.rb"
268
+ - "./spec/models/receipt_recognition_result_spec.rb"
266
269
  - "./spec/spec_helper.rb"
267
270
  homepage: https://www.cloudmersive.com/ocr-api
268
271
  licenses: