cloudmersive-ocr-api-client 1.3.8 → 1.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -4
- data/docs/BusinessCardRecognitionResult.md +15 -0
- data/docs/ImageOcrApi.md +55 -0
- data/lib/cloudmersive-ocr-api-client.rb +1 -0
- data/lib/cloudmersive-ocr-api-client/api/image_ocr_api.rb +56 -0
- data/lib/cloudmersive-ocr-api-client/models/business_card_recognition_result.rb +251 -0
- data/lib/cloudmersive-ocr-api-client/version.rb +1 -1
- data/spec/api/image_ocr_api_spec.rb +12 -0
- data/spec/models/business_card_recognition_result_spec.rb +84 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a2302dde77a2ded28d5e10f4f0fb273e50dbbec19452097af1b5a6ae4c2a855
|
4
|
+
data.tar.gz: 4ae09ef2769fae438559aecec6b84a8dcbfc4ff875430a4154253bfbbb03a49a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3151046237a6abf44e5fdf2987b36433a04f05a21d7b038099daf0fa2498da921528a6b7f05e88857a495b489beaf7205b626262e5677a2d4509f459ef827a66
|
7
|
+
data.tar.gz: c96111e6ffdc116d5e82235933f18dc9053604385621ddb5f1f8c362b92a1e79c22d551a0f0fe132dda9a88f4a60cf4198974dc0c7c294f6077cc375d99a1c53
|
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.
|
10
|
+
- Package version: 1.3.9
|
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.
|
26
|
+
gem install ./cloudmersive-ocr-api-client-1.3.9.gem
|
27
27
|
```
|
28
|
-
(for development, run `gem install --dev ./cloudmersive-ocr-api-client-1.3.
|
28
|
+
(for development, run `gem install --dev ./cloudmersive-ocr-api-client-1.3.9.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.
|
34
|
+
gem 'cloudmersive-ocr-api-client', '~> 1.3.9'
|
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_business_card**](docs/ImageOcrApi.md#image_ocr_photo_recognize_business_card) | **POST** /ocr/photo/recognize/business-card | Recognize a photo of a business card, extract key business information
|
92
93
|
*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
|
93
94
|
*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
|
94
95
|
*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
|
@@ -106,6 +107,7 @@ Class | Method | HTTP request | Description
|
|
106
107
|
|
107
108
|
## Documentation for Models
|
108
109
|
|
110
|
+
- [CloudmersiveOcrApiClient::BusinessCardRecognitionResult](docs/BusinessCardRecognitionResult.md)
|
109
111
|
- [CloudmersiveOcrApiClient::GetPageAngleResult](docs/GetPageAngleResult.md)
|
110
112
|
- [CloudmersiveOcrApiClient::ImageToLinesWithLocationResult](docs/ImageToLinesWithLocationResult.md)
|
111
113
|
- [CloudmersiveOcrApiClient::ImageToTextResponse](docs/ImageToTextResponse.md)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# CloudmersiveOcrApiClient::BusinessCardRecognitionResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | | [optional]
|
7
|
+
**person_name** | **String** | | [optional]
|
8
|
+
**person_title** | **String** | | [optional]
|
9
|
+
**business_name** | **String** | | [optional]
|
10
|
+
**address_string** | **String** | | [optional]
|
11
|
+
**phone_number** | **String** | | [optional]
|
12
|
+
**email_address** | **String** | | [optional]
|
13
|
+
**timestamp** | **DateTime** | | [optional]
|
14
|
+
|
15
|
+
|
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_business_card**](ImageOcrApi.md#image_ocr_photo_recognize_business_card) | **POST** /ocr/photo/recognize/business-card | Recognize a photo of a business card, extract key business information
|
9
10
|
[**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
|
10
11
|
[**image_ocr_photo_to_text**](ImageOcrApi.md#image_ocr_photo_to_text) | **POST** /ocr/photo/toText | Convert a photo of a document into text
|
11
12
|
[**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
|
@@ -132,6 +133,60 @@ Name | Type | Description | Notes
|
|
132
133
|
|
133
134
|
|
134
135
|
|
136
|
+
# **image_ocr_photo_recognize_business_card**
|
137
|
+
> BusinessCardRecognitionResult image_ocr_photo_recognize_business_card(image_file)
|
138
|
+
|
139
|
+
Recognize a photo of a business card, extract key business information
|
140
|
+
|
141
|
+
Analyzes a photograph of a business card as input, and outputs key business information such as the name of the person, name of the business, the address of the business, the phone number, the email address and more.
|
142
|
+
|
143
|
+
### Example
|
144
|
+
```ruby
|
145
|
+
# load the gem
|
146
|
+
require 'cloudmersive-ocr-api-client'
|
147
|
+
# setup authorization
|
148
|
+
CloudmersiveOcrApiClient.configure do |config|
|
149
|
+
# Configure API key authorization: Apikey
|
150
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
151
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
152
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
153
|
+
end
|
154
|
+
|
155
|
+
api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new
|
156
|
+
|
157
|
+
image_file = File.new("/path/to/file.txt") # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
158
|
+
|
159
|
+
|
160
|
+
begin
|
161
|
+
#Recognize a photo of a business card, extract key business information
|
162
|
+
result = api_instance.image_ocr_photo_recognize_business_card(image_file)
|
163
|
+
p result
|
164
|
+
rescue CloudmersiveOcrApiClient::ApiError => e
|
165
|
+
puts "Exception when calling ImageOcrApi->image_ocr_photo_recognize_business_card: #{e}"
|
166
|
+
end
|
167
|
+
```
|
168
|
+
|
169
|
+
### Parameters
|
170
|
+
|
171
|
+
Name | Type | Description | Notes
|
172
|
+
------------- | ------------- | ------------- | -------------
|
173
|
+
**image_file** | **File**| Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. |
|
174
|
+
|
175
|
+
### Return type
|
176
|
+
|
177
|
+
[**BusinessCardRecognitionResult**](BusinessCardRecognitionResult.md)
|
178
|
+
|
179
|
+
### Authorization
|
180
|
+
|
181
|
+
[Apikey](../README.md#Apikey)
|
182
|
+
|
183
|
+
### HTTP request headers
|
184
|
+
|
185
|
+
- **Content-Type**: multipart/form-data
|
186
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
187
|
+
|
188
|
+
|
189
|
+
|
135
190
|
# **image_ocr_photo_recognize_receipt**
|
136
191
|
> ReceiptRecognitionResult image_ocr_photo_recognize_receipt(image_file, opts)
|
137
192
|
|
@@ -17,6 +17,7 @@ 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/business_card_recognition_result'
|
20
21
|
require 'cloudmersive-ocr-api-client/models/get_page_angle_result'
|
21
22
|
require 'cloudmersive-ocr-api-client/models/image_to_lines_with_location_result'
|
22
23
|
require 'cloudmersive-ocr-api-client/models/image_to_text_response'
|
@@ -144,6 +144,62 @@ module CloudmersiveOcrApiClient
|
|
144
144
|
return data, status_code, headers
|
145
145
|
end
|
146
146
|
|
147
|
+
# Recognize a photo of a business card, extract key business information
|
148
|
+
# Analyzes a photograph of a business card as input, and outputs key business information such as the name of the person, name of the business, the address of the business, the phone number, the email address 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
|
+
# @return [BusinessCardRecognitionResult]
|
152
|
+
def image_ocr_photo_recognize_business_card(image_file, opts = {})
|
153
|
+
data, _status_code, _headers = image_ocr_photo_recognize_business_card_with_http_info(image_file, opts)
|
154
|
+
return data
|
155
|
+
end
|
156
|
+
|
157
|
+
# Recognize a photo of a business card, extract key business information
|
158
|
+
# Analyzes a photograph of a business card as input, and outputs key business information such as the name of the person, name of the business, the address of the business, the phone number, the email address and more.
|
159
|
+
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
160
|
+
# @param [Hash] opts the optional parameters
|
161
|
+
# @return [Array<(BusinessCardRecognitionResult, Fixnum, Hash)>] BusinessCardRecognitionResult data, response status code and response headers
|
162
|
+
def image_ocr_photo_recognize_business_card_with_http_info(image_file, opts = {})
|
163
|
+
if @api_client.config.debugging
|
164
|
+
@api_client.config.logger.debug "Calling API: ImageOcrApi.image_ocr_photo_recognize_business_card ..."
|
165
|
+
end
|
166
|
+
# verify the required parameter 'image_file' is set
|
167
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
168
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling ImageOcrApi.image_ocr_photo_recognize_business_card"
|
169
|
+
end
|
170
|
+
# resource path
|
171
|
+
local_var_path = "/ocr/photo/recognize/business-card"
|
172
|
+
|
173
|
+
# query parameters
|
174
|
+
query_params = {}
|
175
|
+
|
176
|
+
# header parameters
|
177
|
+
header_params = {}
|
178
|
+
# HTTP header 'Accept' (if needed)
|
179
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
180
|
+
# HTTP header 'Content-Type'
|
181
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
182
|
+
|
183
|
+
# form parameters
|
184
|
+
form_params = {}
|
185
|
+
form_params["imageFile"] = image_file
|
186
|
+
|
187
|
+
# http body (model)
|
188
|
+
post_body = nil
|
189
|
+
auth_names = ['Apikey']
|
190
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
191
|
+
:header_params => header_params,
|
192
|
+
:query_params => query_params,
|
193
|
+
:form_params => form_params,
|
194
|
+
:body => post_body,
|
195
|
+
:auth_names => auth_names,
|
196
|
+
:return_type => 'BusinessCardRecognitionResult')
|
197
|
+
if @api_client.config.debugging
|
198
|
+
@api_client.config.logger.debug "API called: ImageOcrApi#image_ocr_photo_recognize_business_card\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
199
|
+
end
|
200
|
+
return data, status_code, headers
|
201
|
+
end
|
202
|
+
|
147
203
|
# Recognize a photo of a receipt, extract key business information
|
148
204
|
# 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
205
|
# @param image_file Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
|
@@ -0,0 +1,251 @@
|
|
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 business card, to extract the key information from the business card
|
17
|
+
class BusinessCardRecognitionResult
|
18
|
+
attr_accessor :successful
|
19
|
+
|
20
|
+
attr_accessor :person_name
|
21
|
+
|
22
|
+
attr_accessor :person_title
|
23
|
+
|
24
|
+
attr_accessor :business_name
|
25
|
+
|
26
|
+
attr_accessor :address_string
|
27
|
+
|
28
|
+
attr_accessor :phone_number
|
29
|
+
|
30
|
+
attr_accessor :email_address
|
31
|
+
|
32
|
+
attr_accessor :timestamp
|
33
|
+
|
34
|
+
|
35
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
36
|
+
def self.attribute_map
|
37
|
+
{
|
38
|
+
:'successful' => :'Successful',
|
39
|
+
:'person_name' => :'PersonName',
|
40
|
+
:'person_title' => :'PersonTitle',
|
41
|
+
:'business_name' => :'BusinessName',
|
42
|
+
:'address_string' => :'AddressString',
|
43
|
+
:'phone_number' => :'PhoneNumber',
|
44
|
+
:'email_address' => :'EmailAddress',
|
45
|
+
:'timestamp' => :'Timestamp'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Attribute type mapping.
|
50
|
+
def self.swagger_types
|
51
|
+
{
|
52
|
+
:'successful' => :'BOOLEAN',
|
53
|
+
:'person_name' => :'String',
|
54
|
+
:'person_title' => :'String',
|
55
|
+
:'business_name' => :'String',
|
56
|
+
:'address_string' => :'String',
|
57
|
+
:'phone_number' => :'String',
|
58
|
+
:'email_address' => :'String',
|
59
|
+
:'timestamp' => :'DateTime'
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
# Initializes the object
|
64
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
65
|
+
def initialize(attributes = {})
|
66
|
+
return unless attributes.is_a?(Hash)
|
67
|
+
|
68
|
+
# convert string to symbol for hash key
|
69
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
70
|
+
|
71
|
+
if attributes.has_key?(:'Successful')
|
72
|
+
self.successful = attributes[:'Successful']
|
73
|
+
end
|
74
|
+
|
75
|
+
if attributes.has_key?(:'PersonName')
|
76
|
+
self.person_name = attributes[:'PersonName']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.has_key?(:'PersonTitle')
|
80
|
+
self.person_title = attributes[:'PersonTitle']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.has_key?(:'BusinessName')
|
84
|
+
self.business_name = attributes[:'BusinessName']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.has_key?(:'AddressString')
|
88
|
+
self.address_string = attributes[:'AddressString']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.has_key?(:'PhoneNumber')
|
92
|
+
self.phone_number = attributes[:'PhoneNumber']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.has_key?(:'EmailAddress')
|
96
|
+
self.email_address = attributes[:'EmailAddress']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.has_key?(:'Timestamp')
|
100
|
+
self.timestamp = attributes[:'Timestamp']
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
106
|
+
# @return Array for valid properties with the reasons
|
107
|
+
def list_invalid_properties
|
108
|
+
invalid_properties = Array.new
|
109
|
+
return invalid_properties
|
110
|
+
end
|
111
|
+
|
112
|
+
# Check to see if the all the properties in the model are valid
|
113
|
+
# @return true if the model is valid
|
114
|
+
def valid?
|
115
|
+
return true
|
116
|
+
end
|
117
|
+
|
118
|
+
# Checks equality by comparing each attribute.
|
119
|
+
# @param [Object] Object to be compared
|
120
|
+
def ==(o)
|
121
|
+
return true if self.equal?(o)
|
122
|
+
self.class == o.class &&
|
123
|
+
successful == o.successful &&
|
124
|
+
person_name == o.person_name &&
|
125
|
+
person_title == o.person_title &&
|
126
|
+
business_name == o.business_name &&
|
127
|
+
address_string == o.address_string &&
|
128
|
+
phone_number == o.phone_number &&
|
129
|
+
email_address == o.email_address &&
|
130
|
+
timestamp == o.timestamp
|
131
|
+
end
|
132
|
+
|
133
|
+
# @see the `==` method
|
134
|
+
# @param [Object] Object to be compared
|
135
|
+
def eql?(o)
|
136
|
+
self == o
|
137
|
+
end
|
138
|
+
|
139
|
+
# Calculates hash code according to all attributes.
|
140
|
+
# @return [Fixnum] Hash code
|
141
|
+
def hash
|
142
|
+
[successful, person_name, person_title, business_name, address_string, phone_number, email_address, timestamp].hash
|
143
|
+
end
|
144
|
+
|
145
|
+
# Builds the object from hash
|
146
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
147
|
+
# @return [Object] Returns the model itself
|
148
|
+
def build_from_hash(attributes)
|
149
|
+
return nil unless attributes.is_a?(Hash)
|
150
|
+
self.class.swagger_types.each_pair do |key, type|
|
151
|
+
if type =~ /\AArray<(.*)>/i
|
152
|
+
# check to ensure the input is an array given that the the attribute
|
153
|
+
# is documented as an array but the input is not
|
154
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
155
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
156
|
+
end
|
157
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
158
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
159
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
160
|
+
end
|
161
|
+
|
162
|
+
self
|
163
|
+
end
|
164
|
+
|
165
|
+
# Deserializes the data based on type
|
166
|
+
# @param string type Data type
|
167
|
+
# @param string value Value to be deserialized
|
168
|
+
# @return [Object] Deserialized data
|
169
|
+
def _deserialize(type, value)
|
170
|
+
case type.to_sym
|
171
|
+
when :DateTime
|
172
|
+
DateTime.parse(value)
|
173
|
+
when :Date
|
174
|
+
Date.parse(value)
|
175
|
+
when :String
|
176
|
+
value.to_s
|
177
|
+
when :Integer
|
178
|
+
value.to_i
|
179
|
+
when :Float
|
180
|
+
value.to_f
|
181
|
+
when :BOOLEAN
|
182
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
183
|
+
true
|
184
|
+
else
|
185
|
+
false
|
186
|
+
end
|
187
|
+
when :Object
|
188
|
+
# generic object (usually a Hash), return directly
|
189
|
+
value
|
190
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
191
|
+
inner_type = Regexp.last_match[:inner_type]
|
192
|
+
value.map { |v| _deserialize(inner_type, v) }
|
193
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
194
|
+
k_type = Regexp.last_match[:k_type]
|
195
|
+
v_type = Regexp.last_match[:v_type]
|
196
|
+
{}.tap do |hash|
|
197
|
+
value.each do |k, v|
|
198
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
else # model
|
202
|
+
temp_model = CloudmersiveOcrApiClient.const_get(type).new
|
203
|
+
temp_model.build_from_hash(value)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
# Returns the string representation of the object
|
208
|
+
# @return [String] String presentation of the object
|
209
|
+
def to_s
|
210
|
+
to_hash.to_s
|
211
|
+
end
|
212
|
+
|
213
|
+
# to_body is an alias to to_hash (backward compatibility)
|
214
|
+
# @return [Hash] Returns the object in the form of hash
|
215
|
+
def to_body
|
216
|
+
to_hash
|
217
|
+
end
|
218
|
+
|
219
|
+
# Returns the object in the form of hash
|
220
|
+
# @return [Hash] Returns the object in the form of hash
|
221
|
+
def to_hash
|
222
|
+
hash = {}
|
223
|
+
self.class.attribute_map.each_pair do |attr, param|
|
224
|
+
value = self.send(attr)
|
225
|
+
next if value.nil?
|
226
|
+
hash[param] = _to_hash(value)
|
227
|
+
end
|
228
|
+
hash
|
229
|
+
end
|
230
|
+
|
231
|
+
# Outputs non-array value in the form of hash
|
232
|
+
# For object, use to_hash. Otherwise, just return the value
|
233
|
+
# @param [Object] value Any valid value
|
234
|
+
# @return [Hash] Returns the value in the form of hash
|
235
|
+
def _to_hash(value)
|
236
|
+
if value.is_a?(Array)
|
237
|
+
value.compact.map{ |v| _to_hash(v) }
|
238
|
+
elsif value.is_a?(Hash)
|
239
|
+
{}.tap do |hash|
|
240
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
241
|
+
end
|
242
|
+
elsif value.respond_to? :to_hash
|
243
|
+
value.to_hash
|
244
|
+
else
|
245
|
+
value
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
end
|
250
|
+
|
251
|
+
end
|
@@ -60,6 +60,18 @@ describe 'ImageOcrApi' do
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
# unit tests for image_ocr_photo_recognize_business_card
|
64
|
+
# Recognize a photo of a business card, extract key business information
|
65
|
+
# Analyzes a photograph of a business card as input, and outputs key business information such as the name of the person, name of the business, the address of the business, the phone number, the email address 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
|
+
# @return [BusinessCardRecognitionResult]
|
69
|
+
describe 'image_ocr_photo_recognize_business_card test' do
|
70
|
+
it "should work" do
|
71
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
63
75
|
# unit tests for image_ocr_photo_recognize_receipt
|
64
76
|
# Recognize a photo of a receipt, extract key business information
|
65
77
|
# 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.
|
@@ -0,0 +1,84 @@
|
|
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::BusinessCardRecognitionResult
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'BusinessCardRecognitionResult' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = CloudmersiveOcrApiClient::BusinessCardRecognitionResult.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of BusinessCardRecognitionResult' do
|
31
|
+
it 'should create an instance of BusinessCardRecognitionResult' do
|
32
|
+
expect(@instance).to be_instance_of(CloudmersiveOcrApiClient::BusinessCardRecognitionResult)
|
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 "person_name"' 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 "person_title"' 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 "business_name"' 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 "address_string"' 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 "phone_number"' 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
|
+
describe 'test attribute "email_address"' do
|
72
|
+
it 'should work' do
|
73
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe 'test attribute "timestamp"' do
|
78
|
+
it 'should work' do
|
79
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudmersive-ocr-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cloudmersive
|
@@ -201,6 +201,7 @@ files:
|
|
201
201
|
- "./README.md"
|
202
202
|
- "./Rakefile"
|
203
203
|
- "./cloudmersive-ocr-api-client.gemspec"
|
204
|
+
- "./docs/BusinessCardRecognitionResult.md"
|
204
205
|
- "./docs/GetPageAngleResult.md"
|
205
206
|
- "./docs/ImageOcrApi.md"
|
206
207
|
- "./docs/ImageToLinesWithLocationResult.md"
|
@@ -229,6 +230,7 @@ files:
|
|
229
230
|
- "./lib/cloudmersive-ocr-api-client/api_client.rb"
|
230
231
|
- "./lib/cloudmersive-ocr-api-client/api_error.rb"
|
231
232
|
- "./lib/cloudmersive-ocr-api-client/configuration.rb"
|
233
|
+
- "./lib/cloudmersive-ocr-api-client/models/business_card_recognition_result.rb"
|
232
234
|
- "./lib/cloudmersive-ocr-api-client/models/get_page_angle_result.rb"
|
233
235
|
- "./lib/cloudmersive-ocr-api-client/models/image_to_lines_with_location_result.rb"
|
234
236
|
- "./lib/cloudmersive-ocr-api-client/models/image_to_text_response.rb"
|
@@ -251,6 +253,7 @@ files:
|
|
251
253
|
- "./spec/api/receipts_api_spec.rb"
|
252
254
|
- "./spec/api_client_spec.rb"
|
253
255
|
- "./spec/configuration_spec.rb"
|
256
|
+
- "./spec/models/business_card_recognition_result_spec.rb"
|
254
257
|
- "./spec/models/get_page_angle_result_spec.rb"
|
255
258
|
- "./spec/models/image_to_lines_with_location_result_spec.rb"
|
256
259
|
- "./spec/models/image_to_text_response_spec.rb"
|