cloudmersive-ocr-api-client 1.4.0 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -4
- data/docs/BusinessCardRecognitionResult.md +8 -8
- data/docs/FieldResult.md +2 -2
- data/docs/FormDefinitionTemplate.md +2 -1
- data/docs/FormFieldDefinition.md +13 -13
- data/docs/FormRecognitionResult.md +3 -2
- data/docs/FormTableColumnDefinition.md +13 -0
- data/docs/FormTableDefinition.md +11 -0
- data/docs/ImageOcrApi.md +5 -3
- data/docs/ImageToLinesWithLocationResult.md +1 -1
- data/docs/ImageToWordsWithLocationResult.md +1 -1
- data/docs/OcrPageResultWithLinesWithLocation.md +1 -1
- data/docs/OcrPageResultWithWordsWithLocation.md +1 -1
- data/docs/OcrPhotoTextElement.md +1 -0
- data/docs/PdfToLinesWithLocationResult.md +2 -2
- data/docs/PdfToTextResponse.md +2 -2
- data/docs/PdfToWordsWithLocationResult.md +2 -2
- data/docs/PhotoToWordsWithLocationResult.md +1 -1
- data/docs/Point.md +9 -0
- data/docs/PreprocessingApi.md +55 -0
- data/docs/ReceiptLineItem.md +2 -2
- data/docs/ReceiptRecognitionResult.md +8 -8
- data/docs/TableCellResult.md +9 -0
- data/docs/TableResult.md +9 -0
- data/docs/TableRowResult.md +8 -0
- data/lib/cloudmersive-ocr-api-client.rb +6 -0
- data/lib/cloudmersive-ocr-api-client/api/image_ocr_api.rb +6 -3
- data/lib/cloudmersive-ocr-api-client/api/preprocessing_api.rb +56 -0
- data/lib/cloudmersive-ocr-api-client/models/business_card_recognition_result.rb +8 -0
- data/lib/cloudmersive-ocr-api-client/models/field_result.rb +2 -0
- data/lib/cloudmersive-ocr-api-client/models/form_definition_template.rb +17 -4
- data/lib/cloudmersive-ocr-api-client/models/form_field_definition.rb +13 -0
- data/lib/cloudmersive-ocr-api-client/models/form_recognition_result.rb +18 -4
- data/lib/cloudmersive-ocr-api-client/models/form_table_column_definition.rb +239 -0
- data/lib/cloudmersive-ocr-api-client/models/form_table_definition.rb +221 -0
- data/lib/cloudmersive-ocr-api-client/models/image_to_lines_with_location_result.rb +1 -0
- data/lib/cloudmersive-ocr-api-client/models/image_to_words_with_location_result.rb +1 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_lines_with_location.rb +11 -10
- data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_words_with_location.rb +11 -10
- data/lib/cloudmersive-ocr-api-client/models/ocr_photo_text_element.rb +13 -1
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_lines_with_location_result.rb +2 -0
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_text_response.rb +2 -0
- data/lib/cloudmersive-ocr-api-client/models/pdf_to_words_with_location_result.rb +2 -0
- data/lib/cloudmersive-ocr-api-client/models/photo_to_words_with_location_result.rb +1 -0
- data/lib/cloudmersive-ocr-api-client/models/point.rb +199 -0
- data/lib/cloudmersive-ocr-api-client/models/receipt_line_item.rb +2 -0
- data/lib/cloudmersive-ocr-api-client/models/receipt_recognition_result.rb +8 -0
- data/lib/cloudmersive-ocr-api-client/models/table_cell_result.rb +201 -0
- data/lib/cloudmersive-ocr-api-client/models/table_result.rb +201 -0
- data/lib/cloudmersive-ocr-api-client/models/table_row_result.rb +191 -0
- data/lib/cloudmersive-ocr-api-client/version.rb +1 -1
- data/spec/api/image_ocr_api_spec.rb +2 -1
- data/spec/api/preprocessing_api_spec.rb +12 -0
- data/spec/models/form_definition_template_spec.rb +6 -0
- data/spec/models/form_recognition_result_spec.rb +6 -0
- data/spec/models/form_table_column_definition_spec.rb +72 -0
- data/spec/models/form_table_definition_spec.rb +60 -0
- data/spec/models/ocr_page_result_with_lines_with_location_spec.rb +2 -2
- data/spec/models/ocr_page_result_with_words_with_location_spec.rb +2 -2
- data/spec/models/ocr_photo_text_element_spec.rb +6 -0
- data/spec/models/point_spec.rb +48 -0
- data/spec/models/table_cell_result_spec.rb +48 -0
- data/spec/models/table_result_spec.rb +48 -0
- data/spec/models/table_row_result_spec.rb +42 -0
- metadata +20 -2
@@ -0,0 +1,8 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::TableRowResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**table_row_cells_result** | [**Array<TableCellResult>**](TableCellResult.md) | Table cells in this row result | [optional]
|
7
|
+
|
8
|
+
|
@@ -22,6 +22,8 @@ require 'cloudmersive-ocr-api-client/models/field_result'
|
|
22
22
|
require 'cloudmersive-ocr-api-client/models/form_definition_template'
|
23
23
|
require 'cloudmersive-ocr-api-client/models/form_field_definition'
|
24
24
|
require 'cloudmersive-ocr-api-client/models/form_recognition_result'
|
25
|
+
require 'cloudmersive-ocr-api-client/models/form_table_column_definition'
|
26
|
+
require 'cloudmersive-ocr-api-client/models/form_table_definition'
|
25
27
|
require 'cloudmersive-ocr-api-client/models/get_page_angle_result'
|
26
28
|
require 'cloudmersive-ocr-api-client/models/image_to_lines_with_location_result'
|
27
29
|
require 'cloudmersive-ocr-api-client/models/image_to_text_response'
|
@@ -36,8 +38,12 @@ require 'cloudmersive-ocr-api-client/models/pdf_to_lines_with_location_result'
|
|
36
38
|
require 'cloudmersive-ocr-api-client/models/pdf_to_text_response'
|
37
39
|
require 'cloudmersive-ocr-api-client/models/pdf_to_words_with_location_result'
|
38
40
|
require 'cloudmersive-ocr-api-client/models/photo_to_words_with_location_result'
|
41
|
+
require 'cloudmersive-ocr-api-client/models/point'
|
39
42
|
require 'cloudmersive-ocr-api-client/models/receipt_line_item'
|
40
43
|
require 'cloudmersive-ocr-api-client/models/receipt_recognition_result'
|
44
|
+
require 'cloudmersive-ocr-api-client/models/table_cell_result'
|
45
|
+
require 'cloudmersive-ocr-api-client/models/table_result'
|
46
|
+
require 'cloudmersive-ocr-api-client/models/table_row_result'
|
41
47
|
|
42
48
|
# APIs
|
43
49
|
require 'cloudmersive-ocr-api-client/api/image_ocr_api'
|
@@ -206,6 +206,7 @@ module CloudmersiveOcrApiClient
|
|
206
206
|
# @param [Hash] opts the optional parameters
|
207
207
|
# @option opts [String] :form_template_definition Form field definitions
|
208
208
|
# @option opts [String] :recognition_mode Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
209
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image - including automatic unrotation of the image - before OCR is applied; this is recommended). Set this to 'None' if you do not want to use automatic image unrotation and enhancement.
|
209
210
|
# @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)
|
210
211
|
# @return [FormRecognitionResult]
|
211
212
|
def image_ocr_photo_recognize_form(image_file, opts = {})
|
@@ -219,6 +220,7 @@ module CloudmersiveOcrApiClient
|
|
219
220
|
# @param [Hash] opts the optional parameters
|
220
221
|
# @option opts [String] :form_template_definition Form field definitions
|
221
222
|
# @option opts [String] :recognition_mode Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
223
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image - including automatic unrotation of the image - before OCR is applied; this is recommended). Set this to 'None' if you do not want to use automatic image unrotation and enhancement.
|
222
224
|
# @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)
|
223
225
|
# @return [Array<(FormRecognitionResult, Fixnum, Hash)>] FormRecognitionResult data, response status code and response headers
|
224
226
|
def image_ocr_photo_recognize_form_with_http_info(image_file, opts = {})
|
@@ -243,6 +245,7 @@ module CloudmersiveOcrApiClient
|
|
243
245
|
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
244
246
|
header_params[:'formTemplateDefinition'] = opts[:'form_template_definition'] if !opts[:'form_template_definition'].nil?
|
245
247
|
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
248
|
+
header_params[:'preprocessing'] = opts[:'preprocessing'] if !opts[:'preprocessing'].nil?
|
246
249
|
header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
247
250
|
|
248
251
|
# form parameters
|
@@ -269,9 +272,9 @@ module CloudmersiveOcrApiClient
|
|
269
272
|
# 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.
|
270
273
|
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
271
274
|
# @param [Hash] opts the optional parameters
|
272
|
-
# @option opts [String] :form_template_definition Form field definitions
|
273
275
|
# @option opts [String] :recognition_mode Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
274
276
|
# @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)
|
277
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'None'. Possible values are None (no preprocessing of the image), and 'Advanced' (automatic image enhancement of the image before OCR is applied; this is recommended and needed to handle rotated receipts).
|
275
278
|
# @return [ReceiptRecognitionResult]
|
276
279
|
def image_ocr_photo_recognize_receipt(image_file, opts = {})
|
277
280
|
data, _status_code, _headers = image_ocr_photo_recognize_receipt_with_http_info(image_file, opts)
|
@@ -282,9 +285,9 @@ module CloudmersiveOcrApiClient
|
|
282
285
|
# 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.
|
283
286
|
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
284
287
|
# @param [Hash] opts the optional parameters
|
285
|
-
# @option opts [String] :form_template_definition Form field definitions
|
286
288
|
# @option opts [String] :recognition_mode Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'. Default is disabled.
|
287
289
|
# @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)
|
290
|
+
# @option opts [String] :preprocessing Optional, preprocessing mode, default is 'None'. Possible values are None (no preprocessing of the image), and 'Advanced' (automatic image enhancement of the image before OCR is applied; this is recommended and needed to handle rotated receipts).
|
288
291
|
# @return [Array<(ReceiptRecognitionResult, Fixnum, Hash)>] ReceiptRecognitionResult data, response status code and response headers
|
289
292
|
def image_ocr_photo_recognize_receipt_with_http_info(image_file, opts = {})
|
290
293
|
if @api_client.config.debugging
|
@@ -306,9 +309,9 @@ module CloudmersiveOcrApiClient
|
|
306
309
|
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
307
310
|
# HTTP header 'Content-Type'
|
308
311
|
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
309
|
-
header_params[:'formTemplateDefinition'] = opts[:'form_template_definition'] if !opts[:'form_template_definition'].nil?
|
310
312
|
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
311
313
|
header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
314
|
+
header_params[:'preprocessing'] = opts[:'preprocessing'] if !opts[:'preprocessing'].nil?
|
312
315
|
|
313
316
|
# form parameters
|
314
317
|
form_params = {}
|
@@ -244,6 +244,62 @@ module CloudmersiveOcrApiClient
|
|
244
244
|
return data, status_code, headers
|
245
245
|
end
|
246
246
|
|
247
|
+
# Detect and unrotate a document image (advanced)
|
248
|
+
# Detect and unrotate an image of a document (e.g. that was scanned at an angle) using deep learning. Great for document scanning applications; once unskewed, this image is perfect for converting to PDF using the Convert API or optical character recognition using the OCR API.
|
249
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
250
|
+
# @param [Hash] opts the optional parameters
|
251
|
+
# @return [String]
|
252
|
+
def preprocessing_unrotate_advanced(image_file, opts = {})
|
253
|
+
data, _status_code, _headers = preprocessing_unrotate_advanced_with_http_info(image_file, opts)
|
254
|
+
return data
|
255
|
+
end
|
256
|
+
|
257
|
+
# Detect and unrotate a document image (advanced)
|
258
|
+
# Detect and unrotate an image of a document (e.g. that was scanned at an angle) using deep learning. Great for document scanning applications; once unskewed, this image is perfect for converting to PDF using the Convert API or optical character recognition using the OCR API.
|
259
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
260
|
+
# @param [Hash] opts the optional parameters
|
261
|
+
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
262
|
+
def preprocessing_unrotate_advanced_with_http_info(image_file, opts = {})
|
263
|
+
if @api_client.config.debugging
|
264
|
+
@api_client.config.logger.debug "Calling API: PreprocessingApi.preprocessing_unrotate_advanced ..."
|
265
|
+
end
|
266
|
+
# verify the required parameter 'image_file' is set
|
267
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
268
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling PreprocessingApi.preprocessing_unrotate_advanced"
|
269
|
+
end
|
270
|
+
# resource path
|
271
|
+
local_var_path = "/ocr/preprocessing/image/unrotate/advanced"
|
272
|
+
|
273
|
+
# query parameters
|
274
|
+
query_params = {}
|
275
|
+
|
276
|
+
# header parameters
|
277
|
+
header_params = {}
|
278
|
+
# HTTP header 'Accept' (if needed)
|
279
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
280
|
+
# HTTP header 'Content-Type'
|
281
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
282
|
+
|
283
|
+
# form parameters
|
284
|
+
form_params = {}
|
285
|
+
form_params["imageFile"] = image_file
|
286
|
+
|
287
|
+
# http body (model)
|
288
|
+
post_body = nil
|
289
|
+
auth_names = ['Apikey']
|
290
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
291
|
+
:header_params => header_params,
|
292
|
+
:query_params => query_params,
|
293
|
+
:form_params => form_params,
|
294
|
+
:body => post_body,
|
295
|
+
:auth_names => auth_names,
|
296
|
+
:return_type => 'String')
|
297
|
+
if @api_client.config.debugging
|
298
|
+
@api_client.config.logger.debug "API called: PreprocessingApi#preprocessing_unrotate_advanced\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
299
|
+
end
|
300
|
+
return data, status_code, headers
|
301
|
+
end
|
302
|
+
|
247
303
|
# Detect and unskew a photo of a document
|
248
304
|
# Detect and unskew a photo of a document (e.g. taken on a cell phone) into a perfectly square image. Great for document scanning applications; once unskewed, this image is perfect for converting to PDF using the Convert API or optical character recognition using the OCR API.
|
249
305
|
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
@@ -15,20 +15,28 @@ require 'date'
|
|
15
15
|
module CloudmersiveOcrApiClient
|
16
16
|
# Result of recognizing a business card, to extract the key information from the business card
|
17
17
|
class BusinessCardRecognitionResult
|
18
|
+
# True if the operation was successful, false otherwise
|
18
19
|
attr_accessor :successful
|
19
20
|
|
21
|
+
# The name of the person printed on the business card (if included on the business card)
|
20
22
|
attr_accessor :person_name
|
21
23
|
|
24
|
+
# The title of the person printed on the business card (if included on the business card)
|
22
25
|
attr_accessor :person_title
|
23
26
|
|
27
|
+
# The name of the business printed on the business card (if included on the business card)
|
24
28
|
attr_accessor :business_name
|
25
29
|
|
30
|
+
# The address printed on the business card (if included on the business card)
|
26
31
|
attr_accessor :address_string
|
27
32
|
|
33
|
+
# The phone number printed on the business card (if included on the business card)
|
28
34
|
attr_accessor :phone_number
|
29
35
|
|
36
|
+
# The email address printed on the business card (if included on the business card)
|
30
37
|
attr_accessor :email_address
|
31
38
|
|
39
|
+
# The date and time printed on the business card (if included on the business card)
|
32
40
|
attr_accessor :timestamp
|
33
41
|
|
34
42
|
|
@@ -15,8 +15,10 @@ require 'date'
|
|
15
15
|
module CloudmersiveOcrApiClient
|
16
16
|
# A pairing target field and actual value read from form
|
17
17
|
class FieldResult
|
18
|
+
# Target field to extract from the form
|
18
19
|
attr_accessor :target_field
|
19
20
|
|
21
|
+
# Result field value(s) extracted
|
20
22
|
attr_accessor :field_values
|
21
23
|
|
22
24
|
|
@@ -15,20 +15,26 @@ require 'date'
|
|
15
15
|
module CloudmersiveOcrApiClient
|
16
16
|
# Definition of a form template; use a form template definition to recognize the fields in a form with Cloudmersive OCR
|
17
17
|
class FormDefinitionTemplate
|
18
|
+
# Field definitions in the template; a field is comprised of a key/value pair
|
18
19
|
attr_accessor :field_definitions
|
19
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
|
+
|
20
24
|
|
21
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
22
26
|
def self.attribute_map
|
23
27
|
{
|
24
|
-
:'field_definitions' => :'FieldDefinitions'
|
28
|
+
:'field_definitions' => :'FieldDefinitions',
|
29
|
+
:'table_definitions' => :'TableDefinitions'
|
25
30
|
}
|
26
31
|
end
|
27
32
|
|
28
33
|
# Attribute type mapping.
|
29
34
|
def self.swagger_types
|
30
35
|
{
|
31
|
-
:'field_definitions' => :'Array<FormFieldDefinition>'
|
36
|
+
:'field_definitions' => :'Array<FormFieldDefinition>',
|
37
|
+
:'table_definitions' => :'Array<FormTableDefinition>'
|
32
38
|
}
|
33
39
|
end
|
34
40
|
|
@@ -46,6 +52,12 @@ module CloudmersiveOcrApiClient
|
|
46
52
|
end
|
47
53
|
end
|
48
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
|
+
|
49
61
|
end
|
50
62
|
|
51
63
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -66,7 +78,8 @@ module CloudmersiveOcrApiClient
|
|
66
78
|
def ==(o)
|
67
79
|
return true if self.equal?(o)
|
68
80
|
self.class == o.class &&
|
69
|
-
field_definitions == o.field_definitions
|
81
|
+
field_definitions == o.field_definitions &&
|
82
|
+
table_definitions == o.table_definitions
|
70
83
|
end
|
71
84
|
|
72
85
|
# @see the `==` method
|
@@ -78,7 +91,7 @@ module CloudmersiveOcrApiClient
|
|
78
91
|
# Calculates hash code according to all attributes.
|
79
92
|
# @return [Fixnum] Hash code
|
80
93
|
def hash
|
81
|
-
[field_definitions].hash
|
94
|
+
[field_definitions, table_definitions].hash
|
82
95
|
end
|
83
96
|
|
84
97
|
# Builds the object from hash
|
@@ -15,30 +15,43 @@ require 'date'
|
|
15
15
|
module CloudmersiveOcrApiClient
|
16
16
|
# Definition of a form field for OCR data extraction from images
|
17
17
|
class FormFieldDefinition
|
18
|
+
# The identifier of the field; use this to identify which field is being referenced
|
18
19
|
attr_accessor :field_id
|
19
20
|
|
21
|
+
# Optional - the left-hand anchor of the field
|
20
22
|
attr_accessor :left_anchor
|
21
23
|
|
24
|
+
# Optional - the top anchor of the field
|
22
25
|
attr_accessor :top_anchor
|
23
26
|
|
27
|
+
# Optional - the matching mode for the anchor. Possible values are Complete (requires the entire anchor to match) and Partial (allows only part of the anchor to match). Default is Partial.
|
24
28
|
attr_accessor :anchor_mode
|
25
29
|
|
30
|
+
# 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)
|
26
31
|
attr_accessor :data_type
|
27
32
|
|
33
|
+
# Optional - the target number of digits in the field; useful for fixed-length fields
|
28
34
|
attr_accessor :target_digit_count
|
29
35
|
|
36
|
+
# Optional - the target number of digits in the field; useful for fixed-length fields
|
30
37
|
attr_accessor :minimum_character_count
|
31
38
|
|
39
|
+
# Optional - set to false to block values that contain numeric digits, set to true to allow numeric digits
|
32
40
|
attr_accessor :allow_numeric_digits
|
33
41
|
|
42
|
+
# Vertical alignment of target value area relative to the field anchor; Possible values are VCenter, Top, Bottom
|
34
43
|
attr_accessor :vertical_alignment_type
|
35
44
|
|
45
|
+
# Horizontal alignment of target value area relative to the field anchor; Possible values are Left, Right
|
36
46
|
attr_accessor :horizontal_alignment_type
|
37
47
|
|
48
|
+
# 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.
|
38
49
|
attr_accessor :target_field_width_relative
|
39
50
|
|
51
|
+
# Optional - scale factor for target field height - relative to height of field title
|
40
52
|
attr_accessor :target_field_height_relative
|
41
53
|
|
54
|
+
# Optional - Ignore any result items that contain a partial or complete match with these text strings
|
42
55
|
attr_accessor :ignore
|
43
56
|
|
44
57
|
|
@@ -15,16 +15,22 @@ require 'date'
|
|
15
15
|
module CloudmersiveOcrApiClient
|
16
16
|
# The result of extracting form field values
|
17
17
|
class FormRecognitionResult
|
18
|
+
# True if the operation was successful, false otherwise
|
18
19
|
attr_accessor :successful
|
19
20
|
|
21
|
+
# Result of form field OCR data extraction
|
20
22
|
attr_accessor :field_value_extraction_result
|
21
23
|
|
24
|
+
# Result of form table OCR data extraction
|
25
|
+
attr_accessor :table_value_extraction_results
|
26
|
+
|
22
27
|
|
23
28
|
# Attribute mapping from ruby-style variable name to JSON key.
|
24
29
|
def self.attribute_map
|
25
30
|
{
|
26
31
|
:'successful' => :'Successful',
|
27
|
-
:'field_value_extraction_result' => :'FieldValueExtractionResult'
|
32
|
+
:'field_value_extraction_result' => :'FieldValueExtractionResult',
|
33
|
+
:'table_value_extraction_results' => :'TableValueExtractionResults'
|
28
34
|
}
|
29
35
|
end
|
30
36
|
|
@@ -32,7 +38,8 @@ module CloudmersiveOcrApiClient
|
|
32
38
|
def self.swagger_types
|
33
39
|
{
|
34
40
|
:'successful' => :'BOOLEAN',
|
35
|
-
:'field_value_extraction_result' => :'Array<FieldResult>'
|
41
|
+
:'field_value_extraction_result' => :'Array<FieldResult>',
|
42
|
+
:'table_value_extraction_results' => :'Array<TableResult>'
|
36
43
|
}
|
37
44
|
end
|
38
45
|
|
@@ -54,6 +61,12 @@ module CloudmersiveOcrApiClient
|
|
54
61
|
end
|
55
62
|
end
|
56
63
|
|
64
|
+
if attributes.has_key?(:'TableValueExtractionResults')
|
65
|
+
if (value = attributes[:'TableValueExtractionResults']).is_a?(Array)
|
66
|
+
self.table_value_extraction_results = value
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
57
70
|
end
|
58
71
|
|
59
72
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -75,7 +88,8 @@ module CloudmersiveOcrApiClient
|
|
75
88
|
return true if self.equal?(o)
|
76
89
|
self.class == o.class &&
|
77
90
|
successful == o.successful &&
|
78
|
-
field_value_extraction_result == o.field_value_extraction_result
|
91
|
+
field_value_extraction_result == o.field_value_extraction_result &&
|
92
|
+
table_value_extraction_results == o.table_value_extraction_results
|
79
93
|
end
|
80
94
|
|
81
95
|
# @see the `==` method
|
@@ -87,7 +101,7 @@ module CloudmersiveOcrApiClient
|
|
87
101
|
# Calculates hash code according to all attributes.
|
88
102
|
# @return [Fixnum] Hash code
|
89
103
|
def hash
|
90
|
-
[successful, field_value_extraction_result].hash
|
104
|
+
[successful, field_value_extraction_result, table_value_extraction_results].hash
|
91
105
|
end
|
92
106
|
|
93
107
|
# Builds the object from hash
|
@@ -0,0 +1,239 @@
|
|
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
|
+
# Definition of a column within a table for OCR data extraction from images
|
17
|
+
class FormTableColumnDefinition
|
18
|
+
# The identifier of the field; use this to identify which field is being referenced
|
19
|
+
attr_accessor :column_id
|
20
|
+
|
21
|
+
# Optional - the top anchor of the column heading
|
22
|
+
attr_accessor :top_anchor
|
23
|
+
|
24
|
+
# Optional - the matching mode for the anchor. Possible values are Complete (requires the entire anchor to match) and Partial (allows only part of the anchor to match). Default is Partial.
|
25
|
+
attr_accessor :anchor_mode
|
26
|
+
|
27
|
+
# The data type of the field; possible values are INTEGER (Integer value), STRING (Arbitrary string value, spaces are permitted), DATE (Date in a structured format), DECIMAL (Decimal number), ALPHANUMERIC (Continuous alphanumeric string with no spaces), STRINGNOWHITESPACE (A string that contains no whitespace characters), SERIALNUMBER (A serial-number style string that contains letters and numbers, and certain symbols; must contain at least one number), ALPHAONLY (Alphabet characters only, no numbers or symbols or whitespace)
|
28
|
+
attr_accessor :data_type
|
29
|
+
|
30
|
+
# Optional - the target number of digits in the field; useful for fixed-length fields
|
31
|
+
attr_accessor :minimum_character_count
|
32
|
+
|
33
|
+
# Optional - set to false to block values that contain numeric digits, set to true to allow numeric digits
|
34
|
+
attr_accessor :allow_numeric_digits
|
35
|
+
|
36
|
+
|
37
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
38
|
+
def self.attribute_map
|
39
|
+
{
|
40
|
+
:'column_id' => :'ColumnID',
|
41
|
+
:'top_anchor' => :'TopAnchor',
|
42
|
+
:'anchor_mode' => :'AnchorMode',
|
43
|
+
:'data_type' => :'DataType',
|
44
|
+
:'minimum_character_count' => :'MinimumCharacterCount',
|
45
|
+
:'allow_numeric_digits' => :'AllowNumericDigits'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Attribute type mapping.
|
50
|
+
def self.swagger_types
|
51
|
+
{
|
52
|
+
:'column_id' => :'String',
|
53
|
+
:'top_anchor' => :'String',
|
54
|
+
:'anchor_mode' => :'String',
|
55
|
+
:'data_type' => :'String',
|
56
|
+
:'minimum_character_count' => :'Integer',
|
57
|
+
:'allow_numeric_digits' => :'BOOLEAN'
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
# Initializes the object
|
62
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
63
|
+
def initialize(attributes = {})
|
64
|
+
return unless attributes.is_a?(Hash)
|
65
|
+
|
66
|
+
# convert string to symbol for hash key
|
67
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
68
|
+
|
69
|
+
if attributes.has_key?(:'ColumnID')
|
70
|
+
self.column_id = attributes[:'ColumnID']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.has_key?(:'TopAnchor')
|
74
|
+
self.top_anchor = attributes[:'TopAnchor']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.has_key?(:'AnchorMode')
|
78
|
+
self.anchor_mode = attributes[:'AnchorMode']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.has_key?(:'DataType')
|
82
|
+
self.data_type = attributes[:'DataType']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.has_key?(:'MinimumCharacterCount')
|
86
|
+
self.minimum_character_count = attributes[:'MinimumCharacterCount']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.has_key?(:'AllowNumericDigits')
|
90
|
+
self.allow_numeric_digits = attributes[:'AllowNumericDigits']
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
96
|
+
# @return Array for valid properties with the reasons
|
97
|
+
def list_invalid_properties
|
98
|
+
invalid_properties = Array.new
|
99
|
+
return invalid_properties
|
100
|
+
end
|
101
|
+
|
102
|
+
# Check to see if the all the properties in the model are valid
|
103
|
+
# @return true if the model is valid
|
104
|
+
def valid?
|
105
|
+
return true
|
106
|
+
end
|
107
|
+
|
108
|
+
# Checks equality by comparing each attribute.
|
109
|
+
# @param [Object] Object to be compared
|
110
|
+
def ==(o)
|
111
|
+
return true if self.equal?(o)
|
112
|
+
self.class == o.class &&
|
113
|
+
column_id == o.column_id &&
|
114
|
+
top_anchor == o.top_anchor &&
|
115
|
+
anchor_mode == o.anchor_mode &&
|
116
|
+
data_type == o.data_type &&
|
117
|
+
minimum_character_count == o.minimum_character_count &&
|
118
|
+
allow_numeric_digits == o.allow_numeric_digits
|
119
|
+
end
|
120
|
+
|
121
|
+
# @see the `==` method
|
122
|
+
# @param [Object] Object to be compared
|
123
|
+
def eql?(o)
|
124
|
+
self == o
|
125
|
+
end
|
126
|
+
|
127
|
+
# Calculates hash code according to all attributes.
|
128
|
+
# @return [Fixnum] Hash code
|
129
|
+
def hash
|
130
|
+
[column_id, top_anchor, anchor_mode, data_type, minimum_character_count, allow_numeric_digits].hash
|
131
|
+
end
|
132
|
+
|
133
|
+
# Builds the object from hash
|
134
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
135
|
+
# @return [Object] Returns the model itself
|
136
|
+
def build_from_hash(attributes)
|
137
|
+
return nil unless attributes.is_a?(Hash)
|
138
|
+
self.class.swagger_types.each_pair do |key, type|
|
139
|
+
if type =~ /\AArray<(.*)>/i
|
140
|
+
# check to ensure the input is an array given that the the attribute
|
141
|
+
# is documented as an array but the input is not
|
142
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
143
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
144
|
+
end
|
145
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
146
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
147
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
148
|
+
end
|
149
|
+
|
150
|
+
self
|
151
|
+
end
|
152
|
+
|
153
|
+
# Deserializes the data based on type
|
154
|
+
# @param string type Data type
|
155
|
+
# @param string value Value to be deserialized
|
156
|
+
# @return [Object] Deserialized data
|
157
|
+
def _deserialize(type, value)
|
158
|
+
case type.to_sym
|
159
|
+
when :DateTime
|
160
|
+
DateTime.parse(value)
|
161
|
+
when :Date
|
162
|
+
Date.parse(value)
|
163
|
+
when :String
|
164
|
+
value.to_s
|
165
|
+
when :Integer
|
166
|
+
value.to_i
|
167
|
+
when :Float
|
168
|
+
value.to_f
|
169
|
+
when :BOOLEAN
|
170
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
171
|
+
true
|
172
|
+
else
|
173
|
+
false
|
174
|
+
end
|
175
|
+
when :Object
|
176
|
+
# generic object (usually a Hash), return directly
|
177
|
+
value
|
178
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
179
|
+
inner_type = Regexp.last_match[:inner_type]
|
180
|
+
value.map { |v| _deserialize(inner_type, v) }
|
181
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
182
|
+
k_type = Regexp.last_match[:k_type]
|
183
|
+
v_type = Regexp.last_match[:v_type]
|
184
|
+
{}.tap do |hash|
|
185
|
+
value.each do |k, v|
|
186
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
else # model
|
190
|
+
temp_model = CloudmersiveOcrApiClient.const_get(type).new
|
191
|
+
temp_model.build_from_hash(value)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
# Returns the string representation of the object
|
196
|
+
# @return [String] String presentation of the object
|
197
|
+
def to_s
|
198
|
+
to_hash.to_s
|
199
|
+
end
|
200
|
+
|
201
|
+
# to_body is an alias to to_hash (backward compatibility)
|
202
|
+
# @return [Hash] Returns the object in the form of hash
|
203
|
+
def to_body
|
204
|
+
to_hash
|
205
|
+
end
|
206
|
+
|
207
|
+
# Returns the object in the form of hash
|
208
|
+
# @return [Hash] Returns the object in the form of hash
|
209
|
+
def to_hash
|
210
|
+
hash = {}
|
211
|
+
self.class.attribute_map.each_pair do |attr, param|
|
212
|
+
value = self.send(attr)
|
213
|
+
next if value.nil?
|
214
|
+
hash[param] = _to_hash(value)
|
215
|
+
end
|
216
|
+
hash
|
217
|
+
end
|
218
|
+
|
219
|
+
# Outputs non-array value in the form of hash
|
220
|
+
# For object, use to_hash. Otherwise, just return the value
|
221
|
+
# @param [Object] value Any valid value
|
222
|
+
# @return [Hash] Returns the value in the form of hash
|
223
|
+
def _to_hash(value)
|
224
|
+
if value.is_a?(Array)
|
225
|
+
value.compact.map{ |v| _to_hash(v) }
|
226
|
+
elsif value.is_a?(Hash)
|
227
|
+
{}.tap do |hash|
|
228
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
229
|
+
end
|
230
|
+
elsif value.respond_to? :to_hash
|
231
|
+
value.to_hash
|
232
|
+
else
|
233
|
+
value
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
end
|
238
|
+
|
239
|
+
end
|