cloudmersive-ocr-api-client 1.2.9 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -7
- data/docs/ImageOcrApi.md +118 -0
- data/docs/ImageToLinesWithLocationResult.md +9 -0
- data/docs/ImageToWordsWithLocationResult.md +9 -0
- data/docs/OcrLineElement.md +9 -0
- data/docs/OcrWordElement.md +18 -0
- data/lib/cloudmersive-ocr-api-client.rb +4 -0
- data/lib/cloudmersive-ocr-api-client/api/image_ocr_api.rb +118 -0
- data/lib/cloudmersive-ocr-api-client/models/image_to_lines_with_location_result.rb +200 -0
- data/lib/cloudmersive-ocr-api-client/models/image_to_words_with_location_result.rb +199 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_line_element.rb +201 -0
- data/lib/cloudmersive-ocr-api-client/models/ocr_word_element.rb +289 -0
- data/lib/cloudmersive-ocr-api-client/version.rb +1 -1
- data/spec/api/image_ocr_api_spec.rb +26 -0
- data/spec/models/image_to_lines_with_location_result_spec.rb +48 -0
- data/spec/models/image_to_words_with_location_result_spec.rb +48 -0
- data/spec/models/ocr_line_element_spec.rb +48 -0
- data/spec/models/ocr_word_element_spec.rb +102 -0
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48779f781eb45517d5869a362687acaef8844d589e379bf2c3305e2043c4be45
|
4
|
+
data.tar.gz: bbfe6f9149da0eb9cea400c767ab3c9d382ad5fd94b8e95757a8ea87b2c51979
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83565b18cd88bcd6af4c617eddb7d9db35cb1b537b4df2399f3b8bbb62ea7361533b5084bbf33c32360297128aac022cd49c797197e73bf622a8bf8a13bb43ec
|
7
|
+
data.tar.gz: f170518128da9801d94f36467f1caade0c33b4788cef81df7bf0581ba52c542c3452b3d76c1ab4f69238f25997f02b65eece4fc2104806b18bd0448bef16b223
|
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.
|
10
|
+
- Package version: 1.3.1
|
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.
|
26
|
+
gem install ./cloudmersive-ocr-api-client-1.3.1.gem
|
27
27
|
```
|
28
|
-
(for development, run `gem install --dev ./cloudmersive-ocr-api-client-1.
|
28
|
+
(for development, run `gem install --dev ./cloudmersive-ocr-api-client-1.3.1.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.
|
34
|
+
gem 'cloudmersive-ocr-api-client', '~> 1.3.1'
|
35
35
|
|
36
36
|
### Install from Git
|
37
37
|
|
@@ -71,11 +71,11 @@ opts = {
|
|
71
71
|
}
|
72
72
|
|
73
73
|
begin
|
74
|
-
#Convert a
|
75
|
-
result = api_instance.
|
74
|
+
#Convert a scanned image into words with location
|
75
|
+
result = api_instance.image_ocr_image_lines_with_location(image_file, opts)
|
76
76
|
p result
|
77
77
|
rescue CloudmersiveOcrApiClient::ApiError => e
|
78
|
-
puts "Exception when calling ImageOcrApi->
|
78
|
+
puts "Exception when calling ImageOcrApi->image_ocr_image_lines_with_location: #{e}"
|
79
79
|
end
|
80
80
|
|
81
81
|
```
|
@@ -86,6 +86,8 @@ All URIs are relative to *https://api.cloudmersive.com*
|
|
86
86
|
|
87
87
|
Class | Method | HTTP request | Description
|
88
88
|
------------ | ------------- | ------------- | -------------
|
89
|
+
*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
|
90
|
+
*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
|
89
91
|
*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
|
90
92
|
*CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_post**](docs/ImageOcrApi.md#image_ocr_post) | **POST** /ocr/image/toText | Convert a scanned image into text
|
91
93
|
*CloudmersiveOcrApiClient::PdfOcrApi* | [**pdf_ocr_post**](docs/PdfOcrApi.md#pdf_ocr_post) | **POST** /ocr/pdf/toText | Converts an uploaded image in common formats such as JPEG, PNG into text via Optical Character Recognition.
|
@@ -95,8 +97,12 @@ Class | Method | HTTP request | Description
|
|
95
97
|
|
96
98
|
## Documentation for Models
|
97
99
|
|
100
|
+
- [CloudmersiveOcrApiClient::ImageToLinesWithLocationResult](docs/ImageToLinesWithLocationResult.md)
|
98
101
|
- [CloudmersiveOcrApiClient::ImageToTextResponse](docs/ImageToTextResponse.md)
|
102
|
+
- [CloudmersiveOcrApiClient::ImageToWordsWithLocationResult](docs/ImageToWordsWithLocationResult.md)
|
103
|
+
- [CloudmersiveOcrApiClient::OcrLineElement](docs/OcrLineElement.md)
|
99
104
|
- [CloudmersiveOcrApiClient::OcrPageResult](docs/OcrPageResult.md)
|
105
|
+
- [CloudmersiveOcrApiClient::OcrWordElement](docs/OcrWordElement.md)
|
100
106
|
- [CloudmersiveOcrApiClient::PdfToTextResponse](docs/PdfToTextResponse.md)
|
101
107
|
|
102
108
|
|
data/docs/ImageOcrApi.md
CHANGED
@@ -4,10 +4,128 @@ All URIs are relative to *https://api.cloudmersive.com*
|
|
4
4
|
|
5
5
|
Method | HTTP request | Description
|
6
6
|
------------- | ------------- | -------------
|
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
|
+
[**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
|
7
9
|
[**image_ocr_photo_to_text**](ImageOcrApi.md#image_ocr_photo_to_text) | **POST** /ocr/photo/toText | Convert a photo of a document into text
|
8
10
|
[**image_ocr_post**](ImageOcrApi.md#image_ocr_post) | **POST** /ocr/image/toText | Convert a scanned image into text
|
9
11
|
|
10
12
|
|
13
|
+
# **image_ocr_image_lines_with_location**
|
14
|
+
> ImageToLinesWithLocationResult image_ocr_image_lines_with_location(image_file, opts)
|
15
|
+
|
16
|
+
Convert a scanned image into words with location
|
17
|
+
|
18
|
+
Converts an uploaded image in common formats such as JPEG, PNG into lines/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
|
19
|
+
|
20
|
+
### Example
|
21
|
+
```ruby
|
22
|
+
# load the gem
|
23
|
+
require 'cloudmersive-ocr-api-client'
|
24
|
+
# setup authorization
|
25
|
+
CloudmersiveOcrApiClient.configure do |config|
|
26
|
+
# Configure API key authorization: Apikey
|
27
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
28
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
29
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
30
|
+
end
|
31
|
+
|
32
|
+
api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new
|
33
|
+
|
34
|
+
image_file = File.new("/path/to/file.txt") # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
35
|
+
|
36
|
+
opts = {
|
37
|
+
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)
|
38
|
+
}
|
39
|
+
|
40
|
+
begin
|
41
|
+
#Convert a scanned image into words with location
|
42
|
+
result = api_instance.image_ocr_image_lines_with_location(image_file, opts)
|
43
|
+
p result
|
44
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
45
|
+
puts "Exception when calling ImageOcrApi->image_ocr_image_lines_with_location: #{e}"
|
46
|
+
end
|
47
|
+
```
|
48
|
+
|
49
|
+
### Parameters
|
50
|
+
|
51
|
+
Name | Type | Description | Notes
|
52
|
+
------------- | ------------- | ------------- | -------------
|
53
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
54
|
+
**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]
|
55
|
+
|
56
|
+
### Return type
|
57
|
+
|
58
|
+
[**ImageToLinesWithLocationResult**](ImageToLinesWithLocationResult.md)
|
59
|
+
|
60
|
+
### Authorization
|
61
|
+
|
62
|
+
[Apikey](../README.md#Apikey)
|
63
|
+
|
64
|
+
### HTTP request headers
|
65
|
+
|
66
|
+
- **Content-Type**: multipart/form-data
|
67
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
# **image_ocr_image_words_with_location**
|
72
|
+
> ImageToWordsWithLocationResult image_ocr_image_words_with_location(image_file, opts)
|
73
|
+
|
74
|
+
Convert a scanned image into words with location
|
75
|
+
|
76
|
+
Converts an uploaded image in common formats such as JPEG, PNG into words/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
|
77
|
+
|
78
|
+
### Example
|
79
|
+
```ruby
|
80
|
+
# load the gem
|
81
|
+
require 'cloudmersive-ocr-api-client'
|
82
|
+
# setup authorization
|
83
|
+
CloudmersiveOcrApiClient.configure do |config|
|
84
|
+
# Configure API key authorization: Apikey
|
85
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
86
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
87
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
88
|
+
end
|
89
|
+
|
90
|
+
api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new
|
91
|
+
|
92
|
+
image_file = File.new("/path/to/file.txt") # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
93
|
+
|
94
|
+
opts = {
|
95
|
+
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)
|
96
|
+
}
|
97
|
+
|
98
|
+
begin
|
99
|
+
#Convert a scanned image into words with location
|
100
|
+
result = api_instance.image_ocr_image_words_with_location(image_file, opts)
|
101
|
+
p result
|
102
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
103
|
+
puts "Exception when calling ImageOcrApi->image_ocr_image_words_with_location: #{e}"
|
104
|
+
end
|
105
|
+
```
|
106
|
+
|
107
|
+
### Parameters
|
108
|
+
|
109
|
+
Name | Type | Description | Notes
|
110
|
+
------------- | ------------- | ------------- | -------------
|
111
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
112
|
+
**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]
|
113
|
+
|
114
|
+
### Return type
|
115
|
+
|
116
|
+
[**ImageToWordsWithLocationResult**](ImageToWordsWithLocationResult.md)
|
117
|
+
|
118
|
+
### Authorization
|
119
|
+
|
120
|
+
[Apikey](../README.md#Apikey)
|
121
|
+
|
122
|
+
### HTTP request headers
|
123
|
+
|
124
|
+
- **Content-Type**: multipart/form-data
|
125
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
126
|
+
|
127
|
+
|
128
|
+
|
11
129
|
# **image_ocr_photo_to_text**
|
12
130
|
> ImageToTextResponse image_ocr_photo_to_text(image_file, opts)
|
13
131
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::ImageToLinesWithLocationResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | | [optional]
|
7
|
+
**lines** | [**Array<OcrLineElement>**](OcrLineElement.md) | Words in the image | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::ImageToWordsWithLocationResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | | [optional]
|
7
|
+
**words** | [**Array<OcrWordElement>**](OcrWordElement.md) | | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::OcrLineElement
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**line_text** | **String** | Text of the line | [optional]
|
7
|
+
**words** | [**Array<OcrWordElement>**](OcrWordElement.md) | Word objects in the line | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::OcrWordElement
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**word_text** | **String** | Text of the word | [optional]
|
7
|
+
**line_number** | **Integer** | Line number of the word | [optional]
|
8
|
+
**word_number** | **Integer** | Index of the word in the line | [optional]
|
9
|
+
**x_left** | **Integer** | X location of the left edge of the word in pixels | [optional]
|
10
|
+
**y_top** | **Integer** | Y location of the top edge of the word in pixels | [optional]
|
11
|
+
**width** | **Integer** | Width of the word in pixels | [optional]
|
12
|
+
**height** | **Integer** | Height of the word in pixels | [optional]
|
13
|
+
**confidence_level** | **Float** | Confidence level of the machine learning result; possible values are 0.0 (lowest accuracy) - 1.0 (highest accuracy) | [optional]
|
14
|
+
**block_number** | **Integer** | Index of the containing block | [optional]
|
15
|
+
**paragraph_number** | **Integer** | Index of the containing paragraph | [optional]
|
16
|
+
**page_number** | **Integer** | Index of the containing page | [optional]
|
17
|
+
|
18
|
+
|
@@ -17,8 +17,12 @@ require 'cloudmersive-ocr-api-client/version'
|
|
17
17
|
require 'cloudmersive-ocr-api-client/configuration'
|
18
18
|
|
19
19
|
# Models
|
20
|
+
require 'cloudmersive-ocr-api-client/models/image_to_lines_with_location_result'
|
20
21
|
require 'cloudmersive-ocr-api-client/models/image_to_text_response'
|
22
|
+
require 'cloudmersive-ocr-api-client/models/image_to_words_with_location_result'
|
23
|
+
require 'cloudmersive-ocr-api-client/models/ocr_line_element'
|
21
24
|
require 'cloudmersive-ocr-api-client/models/ocr_page_result'
|
25
|
+
require 'cloudmersive-ocr-api-client/models/ocr_word_element'
|
22
26
|
require 'cloudmersive-ocr-api-client/models/pdf_to_text_response'
|
23
27
|
|
24
28
|
# APIs
|
@@ -20,6 +20,124 @@ module CloudmersiveOcrApiClient
|
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
22
|
|
23
|
+
# Convert a scanned image into words with location
|
24
|
+
# Converts an uploaded image in common formats such as JPEG, PNG into lines/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
|
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
|
+
# @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)
|
28
|
+
# @return [ImageToLinesWithLocationResult]
|
29
|
+
def image_ocr_image_lines_with_location(image_file, opts = {})
|
30
|
+
data, _status_code, _headers = image_ocr_image_lines_with_location_with_http_info(image_file, opts)
|
31
|
+
return data
|
32
|
+
end
|
33
|
+
|
34
|
+
# Convert a scanned image into words with location
|
35
|
+
# Converts an uploaded image in common formats such as JPEG, PNG into lines/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
|
36
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @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)
|
39
|
+
# @return [Array<(ImageToLinesWithLocationResult, Fixnum, Hash)>] ImageToLinesWithLocationResult data, response status code and response headers
|
40
|
+
def image_ocr_image_lines_with_location_with_http_info(image_file, opts = {})
|
41
|
+
if @api_client.config.debugging
|
42
|
+
@api_client.config.logger.debug "Calling API: ImageOcrApi.image_ocr_image_lines_with_location ..."
|
43
|
+
end
|
44
|
+
# verify the required parameter 'image_file' is set
|
45
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
46
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling ImageOcrApi.image_ocr_image_lines_with_location"
|
47
|
+
end
|
48
|
+
# resource path
|
49
|
+
local_var_path = "/ocr/image/to/lines-with-location"
|
50
|
+
|
51
|
+
# query parameters
|
52
|
+
query_params = {}
|
53
|
+
|
54
|
+
# header parameters
|
55
|
+
header_params = {}
|
56
|
+
# HTTP header 'Accept' (if needed)
|
57
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
58
|
+
# HTTP header 'Content-Type'
|
59
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
60
|
+
header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
61
|
+
|
62
|
+
# form parameters
|
63
|
+
form_params = {}
|
64
|
+
form_params["imageFile"] = image_file
|
65
|
+
|
66
|
+
# http body (model)
|
67
|
+
post_body = nil
|
68
|
+
auth_names = ['Apikey']
|
69
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
70
|
+
:header_params => header_params,
|
71
|
+
:query_params => query_params,
|
72
|
+
:form_params => form_params,
|
73
|
+
:body => post_body,
|
74
|
+
:auth_names => auth_names,
|
75
|
+
:return_type => 'ImageToLinesWithLocationResult')
|
76
|
+
if @api_client.config.debugging
|
77
|
+
@api_client.config.logger.debug "API called: ImageOcrApi#image_ocr_image_lines_with_location\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
78
|
+
end
|
79
|
+
return data, status_code, headers
|
80
|
+
end
|
81
|
+
|
82
|
+
# Convert a scanned image into words with location
|
83
|
+
# Converts an uploaded image in common formats such as JPEG, PNG into words/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
|
84
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
85
|
+
# @param [Hash] opts the optional parameters
|
86
|
+
# @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)
|
87
|
+
# @return [ImageToWordsWithLocationResult]
|
88
|
+
def image_ocr_image_words_with_location(image_file, opts = {})
|
89
|
+
data, _status_code, _headers = image_ocr_image_words_with_location_with_http_info(image_file, opts)
|
90
|
+
return data
|
91
|
+
end
|
92
|
+
|
93
|
+
# Convert a scanned image into words with location
|
94
|
+
# Converts an uploaded image in common formats such as JPEG, PNG into words/text with location information and other metdata via Optical Character Recognition. This API is intended to be run on scanned documents. If you want to OCR photos (e.g. taken with a smart phone camera), be sure to use the photo/toText API instead, as it is designed to unskew the image first.
|
95
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
96
|
+
# @param [Hash] opts the optional parameters
|
97
|
+
# @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)
|
98
|
+
# @return [Array<(ImageToWordsWithLocationResult, Fixnum, Hash)>] ImageToWordsWithLocationResult data, response status code and response headers
|
99
|
+
def image_ocr_image_words_with_location_with_http_info(image_file, opts = {})
|
100
|
+
if @api_client.config.debugging
|
101
|
+
@api_client.config.logger.debug "Calling API: ImageOcrApi.image_ocr_image_words_with_location ..."
|
102
|
+
end
|
103
|
+
# verify the required parameter 'image_file' is set
|
104
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
105
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling ImageOcrApi.image_ocr_image_words_with_location"
|
106
|
+
end
|
107
|
+
# resource path
|
108
|
+
local_var_path = "/ocr/image/to/words-with-location"
|
109
|
+
|
110
|
+
# query parameters
|
111
|
+
query_params = {}
|
112
|
+
|
113
|
+
# header parameters
|
114
|
+
header_params = {}
|
115
|
+
# HTTP header 'Accept' (if needed)
|
116
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
117
|
+
# HTTP header 'Content-Type'
|
118
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
119
|
+
header_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
|
120
|
+
|
121
|
+
# form parameters
|
122
|
+
form_params = {}
|
123
|
+
form_params["imageFile"] = image_file
|
124
|
+
|
125
|
+
# http body (model)
|
126
|
+
post_body = nil
|
127
|
+
auth_names = ['Apikey']
|
128
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
129
|
+
:header_params => header_params,
|
130
|
+
:query_params => query_params,
|
131
|
+
:form_params => form_params,
|
132
|
+
:body => post_body,
|
133
|
+
:auth_names => auth_names,
|
134
|
+
:return_type => 'ImageToWordsWithLocationResult')
|
135
|
+
if @api_client.config.debugging
|
136
|
+
@api_client.config.logger.debug "API called: ImageOcrApi#image_ocr_image_words_with_location\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
137
|
+
end
|
138
|
+
return data, status_code, headers
|
139
|
+
end
|
140
|
+
|
23
141
|
# Convert a photo of a document into text
|
24
142
|
# 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.
|
25
143
|
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
@@ -0,0 +1,200 @@
|
|
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 an image to lines-with-location OCR operation
|
17
|
+
class ImageToLinesWithLocationResult
|
18
|
+
attr_accessor :successful
|
19
|
+
|
20
|
+
# Words in the image
|
21
|
+
attr_accessor :lines
|
22
|
+
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'successful' => :'Successful',
|
28
|
+
:'lines' => :'Lines'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.swagger_types
|
34
|
+
{
|
35
|
+
:'successful' => :'BOOLEAN',
|
36
|
+
:'lines' => :'Array<OcrLineElement>'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Initializes the object
|
41
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
42
|
+
def initialize(attributes = {})
|
43
|
+
return unless attributes.is_a?(Hash)
|
44
|
+
|
45
|
+
# convert string to symbol for hash key
|
46
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
47
|
+
|
48
|
+
if attributes.has_key?(:'Successful')
|
49
|
+
self.successful = attributes[:'Successful']
|
50
|
+
end
|
51
|
+
|
52
|
+
if attributes.has_key?(:'Lines')
|
53
|
+
if (value = attributes[:'Lines']).is_a?(Array)
|
54
|
+
self.lines = value
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
61
|
+
# @return Array for valid properties with the reasons
|
62
|
+
def list_invalid_properties
|
63
|
+
invalid_properties = Array.new
|
64
|
+
return invalid_properties
|
65
|
+
end
|
66
|
+
|
67
|
+
# Check to see if the all the properties in the model are valid
|
68
|
+
# @return true if the model is valid
|
69
|
+
def valid?
|
70
|
+
return true
|
71
|
+
end
|
72
|
+
|
73
|
+
# Checks equality by comparing each attribute.
|
74
|
+
# @param [Object] Object to be compared
|
75
|
+
def ==(o)
|
76
|
+
return true if self.equal?(o)
|
77
|
+
self.class == o.class &&
|
78
|
+
successful == o.successful &&
|
79
|
+
lines == o.lines
|
80
|
+
end
|
81
|
+
|
82
|
+
# @see the `==` method
|
83
|
+
# @param [Object] Object to be compared
|
84
|
+
def eql?(o)
|
85
|
+
self == o
|
86
|
+
end
|
87
|
+
|
88
|
+
# Calculates hash code according to all attributes.
|
89
|
+
# @return [Fixnum] Hash code
|
90
|
+
def hash
|
91
|
+
[successful, lines].hash
|
92
|
+
end
|
93
|
+
|
94
|
+
# Builds the object from hash
|
95
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
96
|
+
# @return [Object] Returns the model itself
|
97
|
+
def build_from_hash(attributes)
|
98
|
+
return nil unless attributes.is_a?(Hash)
|
99
|
+
self.class.swagger_types.each_pair do |key, type|
|
100
|
+
if type =~ /\AArray<(.*)>/i
|
101
|
+
# check to ensure the input is an array given that the the attribute
|
102
|
+
# is documented as an array but the input is not
|
103
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
104
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
105
|
+
end
|
106
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
107
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
108
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
109
|
+
end
|
110
|
+
|
111
|
+
self
|
112
|
+
end
|
113
|
+
|
114
|
+
# Deserializes the data based on type
|
115
|
+
# @param string type Data type
|
116
|
+
# @param string value Value to be deserialized
|
117
|
+
# @return [Object] Deserialized data
|
118
|
+
def _deserialize(type, value)
|
119
|
+
case type.to_sym
|
120
|
+
when :DateTime
|
121
|
+
DateTime.parse(value)
|
122
|
+
when :Date
|
123
|
+
Date.parse(value)
|
124
|
+
when :String
|
125
|
+
value.to_s
|
126
|
+
when :Integer
|
127
|
+
value.to_i
|
128
|
+
when :Float
|
129
|
+
value.to_f
|
130
|
+
when :BOOLEAN
|
131
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
132
|
+
true
|
133
|
+
else
|
134
|
+
false
|
135
|
+
end
|
136
|
+
when :Object
|
137
|
+
# generic object (usually a Hash), return directly
|
138
|
+
value
|
139
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
140
|
+
inner_type = Regexp.last_match[:inner_type]
|
141
|
+
value.map { |v| _deserialize(inner_type, v) }
|
142
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
143
|
+
k_type = Regexp.last_match[:k_type]
|
144
|
+
v_type = Regexp.last_match[:v_type]
|
145
|
+
{}.tap do |hash|
|
146
|
+
value.each do |k, v|
|
147
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
else # model
|
151
|
+
temp_model = CloudmersiveOcrApiClient.const_get(type).new
|
152
|
+
temp_model.build_from_hash(value)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
# Returns the string representation of the object
|
157
|
+
# @return [String] String presentation of the object
|
158
|
+
def to_s
|
159
|
+
to_hash.to_s
|
160
|
+
end
|
161
|
+
|
162
|
+
# to_body is an alias to to_hash (backward compatibility)
|
163
|
+
# @return [Hash] Returns the object in the form of hash
|
164
|
+
def to_body
|
165
|
+
to_hash
|
166
|
+
end
|
167
|
+
|
168
|
+
# Returns the object in the form of hash
|
169
|
+
# @return [Hash] Returns the object in the form of hash
|
170
|
+
def to_hash
|
171
|
+
hash = {}
|
172
|
+
self.class.attribute_map.each_pair do |attr, param|
|
173
|
+
value = self.send(attr)
|
174
|
+
next if value.nil?
|
175
|
+
hash[param] = _to_hash(value)
|
176
|
+
end
|
177
|
+
hash
|
178
|
+
end
|
179
|
+
|
180
|
+
# Outputs non-array value in the form of hash
|
181
|
+
# For object, use to_hash. Otherwise, just return the value
|
182
|
+
# @param [Object] value Any valid value
|
183
|
+
# @return [Hash] Returns the value in the form of hash
|
184
|
+
def _to_hash(value)
|
185
|
+
if value.is_a?(Array)
|
186
|
+
value.compact.map{ |v| _to_hash(v) }
|
187
|
+
elsif value.is_a?(Hash)
|
188
|
+
{}.tap do |hash|
|
189
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
190
|
+
end
|
191
|
+
elsif value.respond_to? :to_hash
|
192
|
+
value.to_hash
|
193
|
+
else
|
194
|
+
value
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
199
|
+
|
200
|
+
end
|