cloudmersive-barcode-api-client 1.2.9 → 1.3.0
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/cloudmersive-barcode-api-client.gemspec +1 -1
- data/docs/BarcodeLookupResponse.md +2 -2
- data/docs/BarcodeScanApi.md +61 -0
- data/docs/BarcodeScanResult.md +10 -0
- data/docs/ProductMatch.md +2 -2
- data/lib/cloudmersive-barcode-api-client.rb +3 -1
- data/lib/cloudmersive-barcode-api-client/api/barcode_lookup_api.rb +1 -1
- data/lib/cloudmersive-barcode-api-client/api/barcode_scan_api.rb +79 -0
- data/lib/cloudmersive-barcode-api-client/api/generate_barcode_api.rb +1 -1
- data/lib/cloudmersive-barcode-api-client/api_client.rb +1 -1
- data/lib/cloudmersive-barcode-api-client/api_error.rb +1 -1
- data/lib/cloudmersive-barcode-api-client/configuration.rb +1 -1
- data/lib/cloudmersive-barcode-api-client/models/barcode_lookup_response.rb +4 -2
- data/lib/cloudmersive-barcode-api-client/models/barcode_scan_result.rb +209 -0
- data/lib/cloudmersive-barcode-api-client/models/product_match.rb +4 -2
- data/lib/cloudmersive-barcode-api-client/version.rb +2 -2
- data/spec/api/barcode_lookup_api_spec.rb +1 -1
- data/spec/api/barcode_scan_api_spec.rb +47 -0
- data/spec/api/generate_barcode_api_spec.rb +1 -1
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/barcode_lookup_response_spec.rb +1 -1
- data/spec/models/barcode_scan_result_spec.rb +54 -0
- data/spec/models/product_match_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +21 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f453a74eefd9d6c19bd65ca96f006457960fd639a9a9c753be1ee63b8ba7371
|
4
|
+
data.tar.gz: 588b5840b9d07a2ab445bf54eb1049df01db55b45d7ff3b4e9ce3b3962d3d121
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c771dc4e9b82545a5d1181d2f0901ade75d1b4ec57fd20f326ee8a80f041716378712f3e1318b262364f612a2943bccf3ddf66198375d8631e0d835ce18d9ae
|
7
|
+
data.tar.gz: db59fe5fbc13d1097be0507e8ea2e6b07d848ab18a2719dfbadf4eb9338639d79dc2d3e611082197c7e6b0ce981b9c9ce5279290414e37ef51008072294c3b9d
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Barcode APIs let you generate barcode images, and recognize values from images o
|
|
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.0
|
11
11
|
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
12
12
|
|
13
13
|
## Installation
|
@@ -23,15 +23,15 @@ gem build cloudmersive-barcode-api-client.gemspec
|
|
23
23
|
Then either install the gem locally:
|
24
24
|
|
25
25
|
```shell
|
26
|
-
gem install ./cloudmersive-barcode-api-client-1.
|
26
|
+
gem install ./cloudmersive-barcode-api-client-1.3.0.gem
|
27
27
|
```
|
28
|
-
(for development, run `gem install --dev ./cloudmersive-barcode-api-client-1.
|
28
|
+
(for development, run `gem install --dev ./cloudmersive-barcode-api-client-1.3.0.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-barcode-api-client', '~> 1.
|
34
|
+
gem 'cloudmersive-barcode-api-client', '~> 1.3.0'
|
35
35
|
|
36
36
|
### Install from Git
|
37
37
|
|
@@ -84,6 +84,7 @@ All URIs are relative to *https://api.cloudmersive.com*
|
|
84
84
|
Class | Method | HTTP request | Description
|
85
85
|
------------ | ------------- | ------------- | -------------
|
86
86
|
*CloudmersiveBarcodeApiClient::BarcodeLookupApi* | [**barcode_lookup_ean_lookup**](docs/BarcodeLookupApi.md#barcode_lookup_ean_lookup) | **POST** /barcode/lookup/ean | Lookup a barcode value and return product data
|
87
|
+
*CloudmersiveBarcodeApiClient::BarcodeScanApi* | [**barcode_scan_image**](docs/BarcodeScanApi.md#barcode_scan_image) | **POST** /barcode/scan/image | Scan an image for a barcode and turn the result. Supported barcode types include AZTEC, CODABAR, CODE_39, CODE_93, CODE_128, DATA_MATRIX, EAN_8, EAN_13, ITF, MAXICODE, PDF_417, QR_CODE, RSS_14, RSS_EXPANDED, UPC_A, UPC_E, All_1D, UPC_EAN_EXTENSION, MSI, PLESSEY, IMB
|
87
88
|
*CloudmersiveBarcodeApiClient::GenerateBarcodeApi* | [**generate_barcode_ean13**](docs/GenerateBarcodeApi.md#generate_barcode_ean13) | **POST** /barcode/generate/ean-13 | Validates and generate a EAN-13 barcode as a PNG file, a type of 1D barcode
|
88
89
|
*CloudmersiveBarcodeApiClient::GenerateBarcodeApi* | [**generate_barcode_ean8**](docs/GenerateBarcodeApi.md#generate_barcode_ean8) | **POST** /barcode/generate/ean-8 | Validates and generate a EAN-8 barcode as a PNG file, a type of 1D barcode
|
89
90
|
*CloudmersiveBarcodeApiClient::GenerateBarcodeApi* | [**generate_barcode_qr_code**](docs/GenerateBarcodeApi.md#generate_barcode_qr_code) | **POST** /barcode/generate/qrcode | Generate a QR code barcode as a PNG file, a type of 2D barcode which can encode free-form text information
|
@@ -94,6 +95,7 @@ Class | Method | HTTP request | Description
|
|
94
95
|
## Documentation for Models
|
95
96
|
|
96
97
|
- [CloudmersiveBarcodeApiClient::BarcodeLookupResponse](docs/BarcodeLookupResponse.md)
|
98
|
+
- [CloudmersiveBarcodeApiClient::BarcodeScanResult](docs/BarcodeScanResult.md)
|
97
99
|
- [CloudmersiveBarcodeApiClient::ProductMatch](docs/ProductMatch.md)
|
98
100
|
|
99
101
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
## Properties
|
4
4
|
Name | Type | Description | Notes
|
5
5
|
------------ | ------------- | ------------- | -------------
|
6
|
-
**successful** | **BOOLEAN** |
|
7
|
-
**matches** | [**Array<ProductMatch>**](ProductMatch.md) |
|
6
|
+
**successful** | **BOOLEAN** | True if operation was successful, false otherwise | [optional]
|
7
|
+
**matches** | [**Array<ProductMatch>**](ProductMatch.md) | Resulting product matches for the input barcode | [optional]
|
8
8
|
|
9
9
|
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# CloudmersiveBarcodeApiClient::BarcodeScanApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://api.cloudmersive.com*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
7
|
+
[**barcode_scan_image**](BarcodeScanApi.md#barcode_scan_image) | **POST** /barcode/scan/image | Scan an image for a barcode and turn the result. Supported barcode types include AZTEC, CODABAR, CODE_39, CODE_93, CODE_128, DATA_MATRIX, EAN_8, EAN_13, ITF, MAXICODE, PDF_417, QR_CODE, RSS_14, RSS_EXPANDED, UPC_A, UPC_E, All_1D, UPC_EAN_EXTENSION, MSI, PLESSEY, IMB
|
8
|
+
|
9
|
+
|
10
|
+
# **barcode_scan_image**
|
11
|
+
> BarcodeScanResult barcode_scan_image(image_file)
|
12
|
+
|
13
|
+
Scan an image for a barcode and turn the result. Supported barcode types include AZTEC, CODABAR, CODE_39, CODE_93, CODE_128, DATA_MATRIX, EAN_8, EAN_13, ITF, MAXICODE, PDF_417, QR_CODE, RSS_14, RSS_EXPANDED, UPC_A, UPC_E, All_1D, UPC_EAN_EXTENSION, MSI, PLESSEY, IMB
|
14
|
+
|
15
|
+
### Example
|
16
|
+
```ruby
|
17
|
+
# load the gem
|
18
|
+
require 'cloudmersive-barcode-api-client'
|
19
|
+
# setup authorization
|
20
|
+
CloudmersiveBarcodeApiClient.configure do |config|
|
21
|
+
# Configure API key authorization: Apikey
|
22
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
23
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
24
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
25
|
+
end
|
26
|
+
|
27
|
+
api_instance = CloudmersiveBarcodeApiClient::BarcodeScanApi.new
|
28
|
+
|
29
|
+
image_file = File.new("/path/to/file.txt") # File | Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
|
30
|
+
|
31
|
+
|
32
|
+
begin
|
33
|
+
#Scan an image for a barcode and turn the result. Supported barcode types include AZTEC, CODABAR, CODE_39, CODE_93, CODE_128, DATA_MATRIX, EAN_8, EAN_13, ITF, MAXICODE, PDF_417, QR_CODE, RSS_14, RSS_EXPANDED, UPC_A, UPC_E, All_1D, UPC_EAN_EXTENSION, MSI, PLESSEY, IMB
|
34
|
+
result = api_instance.barcode_scan_image(image_file)
|
35
|
+
p result
|
36
|
+
rescue CloudmersiveBarcodeApiClient::ApiError => e
|
37
|
+
puts "Exception when calling BarcodeScanApi->barcode_scan_image: #{e}"
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
### Parameters
|
42
|
+
|
43
|
+
Name | Type | Description | Notes
|
44
|
+
------------- | ------------- | ------------- | -------------
|
45
|
+
**image_file** | **File**| Image file to perform the operation on. Common file formats such as PNG, JPEG are supported. |
|
46
|
+
|
47
|
+
### Return type
|
48
|
+
|
49
|
+
[**BarcodeScanResult**](BarcodeScanResult.md)
|
50
|
+
|
51
|
+
### Authorization
|
52
|
+
|
53
|
+
[Apikey](../README.md#Apikey)
|
54
|
+
|
55
|
+
### HTTP request headers
|
56
|
+
|
57
|
+
- **Content-Type**: multipart/form-data
|
58
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
59
|
+
|
60
|
+
|
61
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# CloudmersiveBarcodeApiClient::BarcodeScanResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if the operation was successful, false otherwise | [optional]
|
7
|
+
**barcode_type** | **String** | The type of the barcode; possible values are AZTEC, CODABAR, CODE_39, CODE_93, CODE_128, DATA_MATRIX, EAN_8, EAN_13, ITF, MAXICODE, PDF_417, QR_CODE, RSS_14, RSS_EXPANDED, UPC_A, UPC_E, All_1D, UPC_EAN_EXTENSION, MSI, PLESSEY, IMB | [optional]
|
8
|
+
**raw_text** | **String** | The barcode text | [optional]
|
9
|
+
|
10
|
+
|
data/docs/ProductMatch.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
## Properties
|
4
4
|
Name | Type | Description | Notes
|
5
5
|
------------ | ------------- | ------------- | -------------
|
6
|
-
**ean** | **String** |
|
7
|
-
**title** | **String** |
|
6
|
+
**ean** | **String** | EAN code for the product | [optional]
|
7
|
+
**title** | **String** | Title of the product | [optional]
|
8
8
|
|
9
9
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version:
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -18,10 +18,12 @@ require 'cloudmersive-barcode-api-client/configuration'
|
|
18
18
|
|
19
19
|
# Models
|
20
20
|
require 'cloudmersive-barcode-api-client/models/barcode_lookup_response'
|
21
|
+
require 'cloudmersive-barcode-api-client/models/barcode_scan_result'
|
21
22
|
require 'cloudmersive-barcode-api-client/models/product_match'
|
22
23
|
|
23
24
|
# APIs
|
24
25
|
require 'cloudmersive-barcode-api-client/api/barcode_lookup_api'
|
26
|
+
require 'cloudmersive-barcode-api-client/api/barcode_scan_api'
|
25
27
|
require 'cloudmersive-barcode-api-client/api/generate_barcode_api'
|
26
28
|
|
27
29
|
module CloudmersiveBarcodeApiClient
|
@@ -0,0 +1,79 @@
|
|
1
|
+
=begin
|
2
|
+
#barcodeapi
|
3
|
+
|
4
|
+
#Barcode APIs let you generate barcode images, and recognize values from images of barcodes.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require "uri"
|
14
|
+
|
15
|
+
module CloudmersiveBarcodeApiClient
|
16
|
+
class BarcodeScanApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
|
23
|
+
# Scan an image for a barcode and turn the result. Supported barcode types include AZTEC, CODABAR, CODE_39, CODE_93, CODE_128, DATA_MATRIX, EAN_8, EAN_13, ITF, MAXICODE, PDF_417, QR_CODE, RSS_14, RSS_EXPANDED, UPC_A, UPC_E, All_1D, UPC_EAN_EXTENSION, MSI, PLESSEY, IMB
|
24
|
+
#
|
25
|
+
# @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @return [BarcodeScanResult]
|
28
|
+
def barcode_scan_image(image_file, opts = {})
|
29
|
+
data, _status_code, _headers = barcode_scan_image_with_http_info(image_file, opts)
|
30
|
+
return data
|
31
|
+
end
|
32
|
+
|
33
|
+
# Scan an image for a barcode and turn the result. Supported barcode types include AZTEC, CODABAR, CODE_39, CODE_93, CODE_128, DATA_MATRIX, EAN_8, EAN_13, ITF, MAXICODE, PDF_417, QR_CODE, RSS_14, RSS_EXPANDED, UPC_A, UPC_E, All_1D, UPC_EAN_EXTENSION, MSI, PLESSEY, IMB
|
34
|
+
#
|
35
|
+
# @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
|
36
|
+
# @param [Hash] opts the optional parameters
|
37
|
+
# @return [Array<(BarcodeScanResult, Fixnum, Hash)>] BarcodeScanResult data, response status code and response headers
|
38
|
+
def barcode_scan_image_with_http_info(image_file, opts = {})
|
39
|
+
if @api_client.config.debugging
|
40
|
+
@api_client.config.logger.debug "Calling API: BarcodeScanApi.barcode_scan_image ..."
|
41
|
+
end
|
42
|
+
# verify the required parameter 'image_file' is set
|
43
|
+
if @api_client.config.client_side_validation && image_file.nil?
|
44
|
+
fail ArgumentError, "Missing the required parameter 'image_file' when calling BarcodeScanApi.barcode_scan_image"
|
45
|
+
end
|
46
|
+
# resource path
|
47
|
+
local_var_path = "/barcode/scan/image"
|
48
|
+
|
49
|
+
# query parameters
|
50
|
+
query_params = {}
|
51
|
+
|
52
|
+
# header parameters
|
53
|
+
header_params = {}
|
54
|
+
# HTTP header 'Accept' (if needed)
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
56
|
+
# HTTP header 'Content-Type'
|
57
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
58
|
+
|
59
|
+
# form parameters
|
60
|
+
form_params = {}
|
61
|
+
form_params["imageFile"] = image_file
|
62
|
+
|
63
|
+
# http body (model)
|
64
|
+
post_body = nil
|
65
|
+
auth_names = ['Apikey']
|
66
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
67
|
+
:header_params => header_params,
|
68
|
+
:query_params => query_params,
|
69
|
+
:form_params => form_params,
|
70
|
+
:body => post_body,
|
71
|
+
:auth_names => auth_names,
|
72
|
+
:return_type => 'BarcodeScanResult')
|
73
|
+
if @api_client.config.debugging
|
74
|
+
@api_client.config.logger.debug "API called: BarcodeScanApi#barcode_scan_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
75
|
+
end
|
76
|
+
return data, status_code, headers
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -6,17 +6,19 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version:
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module CloudmersiveBarcodeApiClient
|
16
|
-
|
16
|
+
# Result of performing a barcode lookup
|
17
17
|
class BarcodeLookupResponse
|
18
|
+
# True if operation was successful, false otherwise
|
18
19
|
attr_accessor :successful
|
19
20
|
|
21
|
+
# Resulting product matches for the input barcode
|
20
22
|
attr_accessor :matches
|
21
23
|
|
22
24
|
|
@@ -0,0 +1,209 @@
|
|
1
|
+
=begin
|
2
|
+
#barcodeapi
|
3
|
+
|
4
|
+
#Barcode APIs let you generate barcode images, and recognize values from images of barcodes.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CloudmersiveBarcodeApiClient
|
16
|
+
# Result of the barcode scan
|
17
|
+
class BarcodeScanResult
|
18
|
+
# True if the operation was successful, false otherwise
|
19
|
+
attr_accessor :successful
|
20
|
+
|
21
|
+
# The type of the barcode; possible values are AZTEC, CODABAR, CODE_39, CODE_93, CODE_128, DATA_MATRIX, EAN_8, EAN_13, ITF, MAXICODE, PDF_417, QR_CODE, RSS_14, RSS_EXPANDED, UPC_A, UPC_E, All_1D, UPC_EAN_EXTENSION, MSI, PLESSEY, IMB
|
22
|
+
attr_accessor :barcode_type
|
23
|
+
|
24
|
+
# The barcode text
|
25
|
+
attr_accessor :raw_text
|
26
|
+
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'successful' => :'Successful',
|
32
|
+
:'barcode_type' => :'BarcodeType',
|
33
|
+
:'raw_text' => :'RawText'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.swagger_types
|
39
|
+
{
|
40
|
+
:'successful' => :'BOOLEAN',
|
41
|
+
:'barcode_type' => :'String',
|
42
|
+
:'raw_text' => :'String'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
return unless attributes.is_a?(Hash)
|
50
|
+
|
51
|
+
# convert string to symbol for hash key
|
52
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
53
|
+
|
54
|
+
if attributes.has_key?(:'Successful')
|
55
|
+
self.successful = attributes[:'Successful']
|
56
|
+
end
|
57
|
+
|
58
|
+
if attributes.has_key?(:'BarcodeType')
|
59
|
+
self.barcode_type = attributes[:'BarcodeType']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'RawText')
|
63
|
+
self.raw_text = attributes[:'RawText']
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
69
|
+
# @return Array for valid properties with the reasons
|
70
|
+
def list_invalid_properties
|
71
|
+
invalid_properties = Array.new
|
72
|
+
return invalid_properties
|
73
|
+
end
|
74
|
+
|
75
|
+
# Check to see if the all the properties in the model are valid
|
76
|
+
# @return true if the model is valid
|
77
|
+
def valid?
|
78
|
+
return true
|
79
|
+
end
|
80
|
+
|
81
|
+
# Checks equality by comparing each attribute.
|
82
|
+
# @param [Object] Object to be compared
|
83
|
+
def ==(o)
|
84
|
+
return true if self.equal?(o)
|
85
|
+
self.class == o.class &&
|
86
|
+
successful == o.successful &&
|
87
|
+
barcode_type == o.barcode_type &&
|
88
|
+
raw_text == o.raw_text
|
89
|
+
end
|
90
|
+
|
91
|
+
# @see the `==` method
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def eql?(o)
|
94
|
+
self == o
|
95
|
+
end
|
96
|
+
|
97
|
+
# Calculates hash code according to all attributes.
|
98
|
+
# @return [Fixnum] Hash code
|
99
|
+
def hash
|
100
|
+
[successful, barcode_type, raw_text].hash
|
101
|
+
end
|
102
|
+
|
103
|
+
# Builds the object from hash
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
+
# @return [Object] Returns the model itself
|
106
|
+
def build_from_hash(attributes)
|
107
|
+
return nil unless attributes.is_a?(Hash)
|
108
|
+
self.class.swagger_types.each_pair do |key, type|
|
109
|
+
if type =~ /\AArray<(.*)>/i
|
110
|
+
# check to ensure the input is an array given that the the attribute
|
111
|
+
# is documented as an array but the input is not
|
112
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
113
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
114
|
+
end
|
115
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
116
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
117
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
118
|
+
end
|
119
|
+
|
120
|
+
self
|
121
|
+
end
|
122
|
+
|
123
|
+
# Deserializes the data based on type
|
124
|
+
# @param string type Data type
|
125
|
+
# @param string value Value to be deserialized
|
126
|
+
# @return [Object] Deserialized data
|
127
|
+
def _deserialize(type, value)
|
128
|
+
case type.to_sym
|
129
|
+
when :DateTime
|
130
|
+
DateTime.parse(value)
|
131
|
+
when :Date
|
132
|
+
Date.parse(value)
|
133
|
+
when :String
|
134
|
+
value.to_s
|
135
|
+
when :Integer
|
136
|
+
value.to_i
|
137
|
+
when :Float
|
138
|
+
value.to_f
|
139
|
+
when :BOOLEAN
|
140
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
141
|
+
true
|
142
|
+
else
|
143
|
+
false
|
144
|
+
end
|
145
|
+
when :Object
|
146
|
+
# generic object (usually a Hash), return directly
|
147
|
+
value
|
148
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
149
|
+
inner_type = Regexp.last_match[:inner_type]
|
150
|
+
value.map { |v| _deserialize(inner_type, v) }
|
151
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
152
|
+
k_type = Regexp.last_match[:k_type]
|
153
|
+
v_type = Regexp.last_match[:v_type]
|
154
|
+
{}.tap do |hash|
|
155
|
+
value.each do |k, v|
|
156
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
else # model
|
160
|
+
temp_model = CloudmersiveBarcodeApiClient.const_get(type).new
|
161
|
+
temp_model.build_from_hash(value)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
# Returns the string representation of the object
|
166
|
+
# @return [String] String presentation of the object
|
167
|
+
def to_s
|
168
|
+
to_hash.to_s
|
169
|
+
end
|
170
|
+
|
171
|
+
# to_body is an alias to to_hash (backward compatibility)
|
172
|
+
# @return [Hash] Returns the object in the form of hash
|
173
|
+
def to_body
|
174
|
+
to_hash
|
175
|
+
end
|
176
|
+
|
177
|
+
# Returns the object in the form of hash
|
178
|
+
# @return [Hash] Returns the object in the form of hash
|
179
|
+
def to_hash
|
180
|
+
hash = {}
|
181
|
+
self.class.attribute_map.each_pair do |attr, param|
|
182
|
+
value = self.send(attr)
|
183
|
+
next if value.nil?
|
184
|
+
hash[param] = _to_hash(value)
|
185
|
+
end
|
186
|
+
hash
|
187
|
+
end
|
188
|
+
|
189
|
+
# Outputs non-array value in the form of hash
|
190
|
+
# For object, use to_hash. Otherwise, just return the value
|
191
|
+
# @param [Object] value Any valid value
|
192
|
+
# @return [Hash] Returns the value in the form of hash
|
193
|
+
def _to_hash(value)
|
194
|
+
if value.is_a?(Array)
|
195
|
+
value.compact.map{ |v| _to_hash(v) }
|
196
|
+
elsif value.is_a?(Hash)
|
197
|
+
{}.tap do |hash|
|
198
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
199
|
+
end
|
200
|
+
elsif value.respond_to? :to_hash
|
201
|
+
value.to_hash
|
202
|
+
else
|
203
|
+
value
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
208
|
+
|
209
|
+
end
|
@@ -6,17 +6,19 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version:
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module CloudmersiveBarcodeApiClient
|
16
|
-
|
16
|
+
# Matching product for the input barcode
|
17
17
|
class ProductMatch
|
18
|
+
# EAN code for the product
|
18
19
|
attr_accessor :ean
|
19
20
|
|
21
|
+
# Title of the product
|
20
22
|
attr_accessor :title
|
21
23
|
|
22
24
|
|
@@ -6,10 +6,10 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version:
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
module CloudmersiveBarcodeApiClient
|
14
|
-
VERSION = "1.
|
14
|
+
VERSION = "1.3.0"
|
15
15
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
=begin
|
2
|
+
#barcodeapi
|
3
|
+
|
4
|
+
#Barcode APIs let you generate barcode images, and recognize values from images of barcodes.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for CloudmersiveBarcodeApiClient::BarcodeScanApi
|
17
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'BarcodeScanApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@instance = CloudmersiveBarcodeApiClient::BarcodeScanApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of BarcodeScanApi' do
|
30
|
+
it 'should create an instance of BarcodeScanApi' do
|
31
|
+
expect(@instance).to be_instance_of(CloudmersiveBarcodeApiClient::BarcodeScanApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for barcode_scan_image
|
36
|
+
# Scan an image for a barcode and turn the result. Supported barcode types include AZTEC, CODABAR, CODE_39, CODE_93, CODE_128, DATA_MATRIX, EAN_8, EAN_13, ITF, MAXICODE, PDF_417, QR_CODE, RSS_14, RSS_EXPANDED, UPC_A, UPC_E, All_1D, UPC_EAN_EXTENSION, MSI, PLESSEY, IMB
|
37
|
+
#
|
38
|
+
# @param image_file Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [BarcodeScanResult]
|
41
|
+
describe 'barcode_scan_image test' 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
|
+
end
|
data/spec/api_client_spec.rb
CHANGED
data/spec/configuration_spec.rb
CHANGED
@@ -0,0 +1,54 @@
|
|
1
|
+
=begin
|
2
|
+
#barcodeapi
|
3
|
+
|
4
|
+
#Barcode APIs let you generate barcode images, and recognize values from images of barcodes.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for CloudmersiveBarcodeApiClient::BarcodeScanResult
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'BarcodeScanResult' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = CloudmersiveBarcodeApiClient::BarcodeScanResult.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of BarcodeScanResult' do
|
31
|
+
it 'should create an instance of BarcodeScanResult' do
|
32
|
+
expect(@instance).to be_instance_of(CloudmersiveBarcodeApiClient::BarcodeScanResult)
|
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 "barcode_type"' 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 "raw_text"' 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
|
+
end
|
54
|
+
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudmersive-barcode-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cloudmersive
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -34,42 +34,42 @@ dependencies:
|
|
34
34
|
name: json
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '2.1'
|
40
37
|
- - ">="
|
41
38
|
- !ruby/object:Gem::Version
|
42
39
|
version: 2.1.0
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '2.1'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '2.1'
|
50
47
|
- - ">="
|
51
48
|
- !ruby/object:Gem::Version
|
52
49
|
version: 2.1.0
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '2.1'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: rspec
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - "~>"
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: '3.6'
|
60
57
|
- - ">="
|
61
58
|
- !ruby/object:Gem::Version
|
62
59
|
version: 3.6.0
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '3.6'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "~>"
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '3.6'
|
70
67
|
- - ">="
|
71
68
|
- !ruby/object:Gem::Version
|
72
69
|
version: 3.6.0
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '3.6'
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: vcr
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -203,23 +203,29 @@ files:
|
|
203
203
|
- "./cloudmersive-barcode-api-client.gemspec"
|
204
204
|
- "./docs/BarcodeLookupApi.md"
|
205
205
|
- "./docs/BarcodeLookupResponse.md"
|
206
|
+
- "./docs/BarcodeScanApi.md"
|
207
|
+
- "./docs/BarcodeScanResult.md"
|
206
208
|
- "./docs/GenerateBarcodeApi.md"
|
207
209
|
- "./docs/ProductMatch.md"
|
208
210
|
- "./git_push.sh"
|
209
211
|
- "./lib/cloudmersive-barcode-api-client.rb"
|
210
212
|
- "./lib/cloudmersive-barcode-api-client/api/barcode_lookup_api.rb"
|
213
|
+
- "./lib/cloudmersive-barcode-api-client/api/barcode_scan_api.rb"
|
211
214
|
- "./lib/cloudmersive-barcode-api-client/api/generate_barcode_api.rb"
|
212
215
|
- "./lib/cloudmersive-barcode-api-client/api_client.rb"
|
213
216
|
- "./lib/cloudmersive-barcode-api-client/api_error.rb"
|
214
217
|
- "./lib/cloudmersive-barcode-api-client/configuration.rb"
|
215
218
|
- "./lib/cloudmersive-barcode-api-client/models/barcode_lookup_response.rb"
|
219
|
+
- "./lib/cloudmersive-barcode-api-client/models/barcode_scan_result.rb"
|
216
220
|
- "./lib/cloudmersive-barcode-api-client/models/product_match.rb"
|
217
221
|
- "./lib/cloudmersive-barcode-api-client/version.rb"
|
218
222
|
- "./spec/api/barcode_lookup_api_spec.rb"
|
223
|
+
- "./spec/api/barcode_scan_api_spec.rb"
|
219
224
|
- "./spec/api/generate_barcode_api_spec.rb"
|
220
225
|
- "./spec/api_client_spec.rb"
|
221
226
|
- "./spec/configuration_spec.rb"
|
222
227
|
- "./spec/models/barcode_lookup_response_spec.rb"
|
228
|
+
- "./spec/models/barcode_scan_result_spec.rb"
|
223
229
|
- "./spec/models/product_match_spec.rb"
|
224
230
|
- "./spec/spec_helper.rb"
|
225
231
|
homepage: https://www.cloudmersive.com/barcode-api
|
@@ -241,8 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
247
|
- !ruby/object:Gem::Version
|
242
248
|
version: '0'
|
243
249
|
requirements: []
|
244
|
-
|
245
|
-
rubygems_version: 2.7.6
|
250
|
+
rubygems_version: 3.0.3
|
246
251
|
signing_key:
|
247
252
|
specification_version: 4
|
248
253
|
summary: Generate and recognize 1D and 2D barcodes.
|