aspose_barcode_cloud 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/README.md +42 -0
- data/aspose_barcode_cloud.gemspec +26 -0
- data/lib/aspose_barcode_cloud.rb +39 -0
- data/lib/aspose_barcode_cloud/api/barcode_api.rb +478 -0
- data/lib/aspose_barcode_cloud/api_client.rb +335 -0
- data/lib/aspose_barcode_cloud/api_error.rb +24 -0
- data/lib/aspose_barcode_cloud/configuration.rb +166 -0
- data/lib/aspose_barcode_cloud/models/barcode_builder.rb +189 -0
- data/lib/aspose_barcode_cloud/models/barcode_builders_list.rb +55 -0
- data/lib/aspose_barcode_cloud/models/barcode_reader.rb +69 -0
- data/lib/aspose_barcode_cloud/models/barcode_response.rb +63 -0
- data/lib/aspose_barcode_cloud/models/barcode_response_list.rb +63 -0
- data/lib/aspose_barcode_cloud/models/base_object.rb +86 -0
- data/lib/aspose_barcode_cloud/models/base_response.rb +53 -0
- data/lib/aspose_barcode_cloud/models/margins.rb +61 -0
- data/lib/aspose_barcode_cloud/models/resolution.rb +45 -0
- data/lib/aspose_barcode_cloud/version.rb +3 -0
- data/test/barcode_tests.rb +103 -0
- data/test/data/barcode.png +0 -0
- data/test/data/sample-barcode.jpeg +0 -0
- data/test/data/sample.txt +12 -0
- metadata +139 -0
@@ -0,0 +1,189 @@
|
|
1
|
+
module AsposeBarcodeCloud
|
2
|
+
#
|
3
|
+
class BarcodeBuilder < BaseObject
|
4
|
+
attr_accessor :type_of_barcode, :text, :resolution, :dimension_x, :dimension_y, :code_location, :graphics_unit, :auto_size, :bar_height, :image_height, :image_width, :image_quality, :rotation_angle, :margins, :back_color, :fore_color, :code_text_color, :border_color, :border_visible, :enable_checksum
|
5
|
+
# attribute mapping from ruby-style variable name to JSON key
|
6
|
+
def self.attribute_map
|
7
|
+
{
|
8
|
+
|
9
|
+
#
|
10
|
+
:'type_of_barcode' => :'TypeOfBarcode',
|
11
|
+
|
12
|
+
#
|
13
|
+
:'text' => :'Text',
|
14
|
+
|
15
|
+
#
|
16
|
+
:'resolution' => :'Resolution',
|
17
|
+
|
18
|
+
#
|
19
|
+
:'dimension_x' => :'DimensionX',
|
20
|
+
|
21
|
+
#
|
22
|
+
:'dimension_y' => :'DimensionY',
|
23
|
+
|
24
|
+
#
|
25
|
+
:'code_location' => :'CodeLocation',
|
26
|
+
|
27
|
+
#
|
28
|
+
:'graphics_unit' => :'GraphicsUnit',
|
29
|
+
|
30
|
+
#
|
31
|
+
:'auto_size' => :'AutoSize',
|
32
|
+
|
33
|
+
#
|
34
|
+
:'bar_height' => :'BarHeight',
|
35
|
+
|
36
|
+
#
|
37
|
+
:'image_height' => :'ImageHeight',
|
38
|
+
|
39
|
+
#
|
40
|
+
:'image_width' => :'ImageWidth',
|
41
|
+
|
42
|
+
#
|
43
|
+
:'image_quality' => :'ImageQuality',
|
44
|
+
|
45
|
+
#
|
46
|
+
:'rotation_angle' => :'RotationAngle',
|
47
|
+
|
48
|
+
#
|
49
|
+
:'margins' => :'Margins',
|
50
|
+
|
51
|
+
#
|
52
|
+
:'back_color' => :'BackColor',
|
53
|
+
|
54
|
+
#
|
55
|
+
:'fore_color' => :'ForeColor',
|
56
|
+
|
57
|
+
#
|
58
|
+
:'code_text_color' => :'CodeTextColor',
|
59
|
+
|
60
|
+
#
|
61
|
+
:'border_color' => :'BorderColor',
|
62
|
+
|
63
|
+
#
|
64
|
+
:'border_visible' => :'BorderVisible',
|
65
|
+
|
66
|
+
#
|
67
|
+
:'enable_checksum' => :'EnableChecksum'
|
68
|
+
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
# attribute type
|
73
|
+
def self.swagger_types
|
74
|
+
{
|
75
|
+
:'type_of_barcode' => :'String',
|
76
|
+
:'text' => :'String',
|
77
|
+
:'resolution' => :'Resolution',
|
78
|
+
:'dimension_x' => :'Float',
|
79
|
+
:'dimension_y' => :'Float',
|
80
|
+
:'code_location' => :'String',
|
81
|
+
:'graphics_unit' => :'String',
|
82
|
+
:'auto_size' => :'BOOLEAN',
|
83
|
+
:'bar_height' => :'Float',
|
84
|
+
:'image_height' => :'Float',
|
85
|
+
:'image_width' => :'Float',
|
86
|
+
:'image_quality' => :'String',
|
87
|
+
:'rotation_angle' => :'Float',
|
88
|
+
:'margins' => :'Margins',
|
89
|
+
:'back_color' => :'String',
|
90
|
+
:'fore_color' => :'String',
|
91
|
+
:'code_text_color' => :'String',
|
92
|
+
:'border_color' => :'String',
|
93
|
+
:'border_visible' => :'BOOLEAN',
|
94
|
+
:'enable_checksum' => :'String'
|
95
|
+
|
96
|
+
}
|
97
|
+
end
|
98
|
+
|
99
|
+
def initialize(attributes = {})
|
100
|
+
return if !attributes.is_a?(Hash) || attributes.empty?
|
101
|
+
|
102
|
+
# convert string to symbol for hash key
|
103
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
104
|
+
|
105
|
+
|
106
|
+
if attributes[:'TypeOfBarcode']
|
107
|
+
self.type_of_barcode = attributes[:'TypeOfBarcode']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes[:'Text']
|
111
|
+
self.text = attributes[:'Text']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes[:'Resolution']
|
115
|
+
self.resolution = attributes[:'Resolution']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes[:'DimensionX']
|
119
|
+
self.dimension_x = attributes[:'DimensionX']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes[:'DimensionY']
|
123
|
+
self.dimension_y = attributes[:'DimensionY']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes[:'CodeLocation']
|
127
|
+
self.code_location = attributes[:'CodeLocation']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes[:'GraphicsUnit']
|
131
|
+
self.graphics_unit = attributes[:'GraphicsUnit']
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes[:'AutoSize']
|
135
|
+
self.auto_size = attributes[:'AutoSize']
|
136
|
+
end
|
137
|
+
|
138
|
+
if attributes[:'BarHeight']
|
139
|
+
self.bar_height = attributes[:'BarHeight']
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes[:'ImageHeight']
|
143
|
+
self.image_height = attributes[:'ImageHeight']
|
144
|
+
end
|
145
|
+
|
146
|
+
if attributes[:'ImageWidth']
|
147
|
+
self.image_width = attributes[:'ImageWidth']
|
148
|
+
end
|
149
|
+
|
150
|
+
if attributes[:'ImageQuality']
|
151
|
+
self.image_quality = attributes[:'ImageQuality']
|
152
|
+
end
|
153
|
+
|
154
|
+
if attributes[:'RotationAngle']
|
155
|
+
self.rotation_angle = attributes[:'RotationAngle']
|
156
|
+
end
|
157
|
+
|
158
|
+
if attributes[:'Margins']
|
159
|
+
self.margins = attributes[:'Margins']
|
160
|
+
end
|
161
|
+
|
162
|
+
if attributes[:'BackColor']
|
163
|
+
self.back_color = attributes[:'BackColor']
|
164
|
+
end
|
165
|
+
|
166
|
+
if attributes[:'ForeColor']
|
167
|
+
self.fore_color = attributes[:'ForeColor']
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes[:'CodeTextColor']
|
171
|
+
self.code_text_color = attributes[:'CodeTextColor']
|
172
|
+
end
|
173
|
+
|
174
|
+
if attributes[:'BorderColor']
|
175
|
+
self.border_color = attributes[:'BorderColor']
|
176
|
+
end
|
177
|
+
|
178
|
+
if attributes[:'BorderVisible']
|
179
|
+
self.border_visible = attributes[:'BorderVisible']
|
180
|
+
end
|
181
|
+
|
182
|
+
if attributes[:'EnableChecksum']
|
183
|
+
self.enable_checksum = attributes[:'EnableChecksum']
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
|
188
|
+
end
|
189
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module AsposeBarcodeCloud
|
2
|
+
#
|
3
|
+
class BarcodeBuildersList < BaseObject
|
4
|
+
attr_accessor :barcode_builders, :x_step, :y_step
|
5
|
+
# attribute mapping from ruby-style variable name to JSON key
|
6
|
+
def self.attribute_map
|
7
|
+
{
|
8
|
+
|
9
|
+
#
|
10
|
+
:'barcode_builders' => :'BarcodeBuilders',
|
11
|
+
|
12
|
+
#
|
13
|
+
:'x_step' => :'XStep',
|
14
|
+
|
15
|
+
#
|
16
|
+
:'y_step' => :'YStep'
|
17
|
+
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
# attribute type
|
22
|
+
def self.swagger_types
|
23
|
+
{
|
24
|
+
:'barcode_builders' => :'Array<BarcodeBuilder>',
|
25
|
+
:'x_step' => :'Integer',
|
26
|
+
:'y_step' => :'Integer'
|
27
|
+
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def initialize(attributes = {})
|
32
|
+
return if !attributes.is_a?(Hash) || attributes.empty?
|
33
|
+
|
34
|
+
# convert string to symbol for hash key
|
35
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
36
|
+
|
37
|
+
|
38
|
+
if attributes[:'BarcodeBuilders']
|
39
|
+
if (value = attributes[:'BarcodeBuilders']).is_a?(Array)
|
40
|
+
self.barcode_builders = value
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
if attributes[:'XStep']
|
45
|
+
self.x_step = attributes[:'XStep']
|
46
|
+
end
|
47
|
+
|
48
|
+
if attributes[:'YStep']
|
49
|
+
self.y_step = attributes[:'YStep']
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module AsposeBarcodeCloud
|
2
|
+
#
|
3
|
+
class BarcodeReader < BaseObject
|
4
|
+
attr_accessor :checksum_validation, :strip_fnc, :barcodes_count, :rotation_angle, :binarization_hints
|
5
|
+
# attribute mapping from ruby-style variable name to JSON key
|
6
|
+
def self.attribute_map
|
7
|
+
{
|
8
|
+
|
9
|
+
#
|
10
|
+
:'checksum_validation' => :'ChecksumValidation',
|
11
|
+
|
12
|
+
#
|
13
|
+
:'strip_fnc' => :'StripFNC',
|
14
|
+
|
15
|
+
#
|
16
|
+
:'barcodes_count' => :'BarcodesCount',
|
17
|
+
|
18
|
+
#
|
19
|
+
:'rotation_angle' => :'RotationAngle',
|
20
|
+
|
21
|
+
#
|
22
|
+
:'binarization_hints' => :'BinarizationHints'
|
23
|
+
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# attribute type
|
28
|
+
def self.swagger_types
|
29
|
+
{
|
30
|
+
:'checksum_validation' => :'String',
|
31
|
+
:'strip_fnc' => :'BOOLEAN',
|
32
|
+
:'barcodes_count' => :'Integer',
|
33
|
+
:'rotation_angle' => :'Integer',
|
34
|
+
:'binarization_hints' => :'String'
|
35
|
+
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
def initialize(attributes = {})
|
40
|
+
return if !attributes.is_a?(Hash) || attributes.empty?
|
41
|
+
|
42
|
+
# convert string to symbol for hash key
|
43
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
44
|
+
|
45
|
+
|
46
|
+
if attributes[:'ChecksumValidation']
|
47
|
+
self.checksum_validation = attributes[:'ChecksumValidation']
|
48
|
+
end
|
49
|
+
|
50
|
+
if attributes[:'StripFNC']
|
51
|
+
self.strip_fnc = attributes[:'StripFNC']
|
52
|
+
end
|
53
|
+
|
54
|
+
if attributes[:'BarcodesCount']
|
55
|
+
self.barcodes_count = attributes[:'BarcodesCount']
|
56
|
+
end
|
57
|
+
|
58
|
+
if attributes[:'RotationAngle']
|
59
|
+
self.rotation_angle = attributes[:'RotationAngle']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes[:'BinarizationHints']
|
63
|
+
self.binarization_hints = attributes[:'BinarizationHints']
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module AsposeBarcodeCloud
|
2
|
+
#
|
3
|
+
class BarcodeResponse < BaseObject
|
4
|
+
attr_accessor :barcode_value, :barcode_type, :region, :checksum
|
5
|
+
# attribute mapping from ruby-style variable name to JSON key
|
6
|
+
def self.attribute_map
|
7
|
+
{
|
8
|
+
|
9
|
+
#
|
10
|
+
:'barcode_value' => :'BarcodeValue',
|
11
|
+
|
12
|
+
#
|
13
|
+
:'barcode_type' => :'BarcodeType',
|
14
|
+
|
15
|
+
#
|
16
|
+
:'region' => :'Region',
|
17
|
+
|
18
|
+
#
|
19
|
+
:'checksum' => :'Checksum'
|
20
|
+
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
# attribute type
|
25
|
+
def self.swagger_types
|
26
|
+
{
|
27
|
+
:'barcode_value' => :'String',
|
28
|
+
:'barcode_type' => :'String',
|
29
|
+
:'region' => :'Array<String>',
|
30
|
+
:'checksum' => :'String'
|
31
|
+
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize(attributes = {})
|
36
|
+
return if !attributes.is_a?(Hash) || attributes.empty?
|
37
|
+
|
38
|
+
# convert string to symbol for hash key
|
39
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
40
|
+
|
41
|
+
|
42
|
+
if attributes[:'BarcodeValue']
|
43
|
+
self.barcode_value = attributes[:'BarcodeValue']
|
44
|
+
end
|
45
|
+
|
46
|
+
if attributes[:'BarcodeType']
|
47
|
+
self.barcode_type = attributes[:'BarcodeType']
|
48
|
+
end
|
49
|
+
|
50
|
+
if attributes[:'Region']
|
51
|
+
if (value = attributes[:'Region']).is_a?(Array)
|
52
|
+
self.region = value
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
if attributes[:'Checksum']
|
57
|
+
self.checksum = attributes[:'Checksum']
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module AsposeBarcodeCloud
|
2
|
+
#
|
3
|
+
class BarcodeResponseList < BaseObject
|
4
|
+
attr_accessor :barcodes, :status, :code
|
5
|
+
# attribute mapping from ruby-style variable name to JSON key
|
6
|
+
def self.attribute_map
|
7
|
+
{
|
8
|
+
|
9
|
+
#
|
10
|
+
:'barcodes' => :'Barcodes',
|
11
|
+
|
12
|
+
#
|
13
|
+
:'status' => :'Status',
|
14
|
+
|
15
|
+
#
|
16
|
+
:'code' => :'Code'
|
17
|
+
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
# attribute type
|
22
|
+
def self.swagger_types
|
23
|
+
{
|
24
|
+
:'barcodes' => :'Array<BarcodeResponse>',
|
25
|
+
:'status' => :'String',
|
26
|
+
:'code' => :'String'
|
27
|
+
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def initialize(attributes = {})
|
32
|
+
return if !attributes.is_a?(Hash) || attributes.empty?
|
33
|
+
|
34
|
+
# convert string to symbol for hash key
|
35
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
36
|
+
|
37
|
+
|
38
|
+
if attributes[:'Barcodes']
|
39
|
+
if (value = attributes[:'Barcodes']).is_a?(Array)
|
40
|
+
self.barcodes = value
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
if attributes[:'Status']
|
45
|
+
self.status = attributes[:'Status']
|
46
|
+
end
|
47
|
+
|
48
|
+
if attributes[:'Code']
|
49
|
+
self.code = attributes[:'Code']
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
def status=(status)
|
55
|
+
allowed_values = ["Continue", "SwitchingProtocols", "OK", "Created", "Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther", "RedirectMethod", "NotModified", "UseProxy", "Unused", "TemporaryRedirect", "RedirectKeepVerb", "BadRequest", "Unauthorized", "PaymentRequired", "Forbidden", "NotFound", "MethodNotAllowed", "NotAcceptable", "ProxyAuthenticationRequired", "RequestTimeout", "Conflict", "Gone", "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", "HttpVersionNotSupported"]
|
56
|
+
if status && !allowed_values.include?(status)
|
57
|
+
fail "invalid value for 'status', must be one of #{allowed_values}"
|
58
|
+
end
|
59
|
+
@status = status
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module AsposeBarcodeCloud
|
4
|
+
# base class containing fundamental method such as to_hash, build_from_hash and more
|
5
|
+
class BaseObject
|
6
|
+
|
7
|
+
# build the object from hash
|
8
|
+
def build_from_hash(attributes)
|
9
|
+
return nil unless attributes.is_a?(Hash)
|
10
|
+
self.class.swagger_types.each_pair do |key, type|
|
11
|
+
if type =~ /^Array<(.*)>/i
|
12
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
13
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
14
|
+
else
|
15
|
+
#TODO show warning in debug mode
|
16
|
+
end
|
17
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
18
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
19
|
+
else
|
20
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
self
|
25
|
+
end
|
26
|
+
|
27
|
+
def _deserialize(type, value)
|
28
|
+
case type.to_sym
|
29
|
+
when :DateTime
|
30
|
+
DateTime.parse(value)
|
31
|
+
when :Date
|
32
|
+
Date.parse(value)
|
33
|
+
when :String
|
34
|
+
value.to_s
|
35
|
+
when :Integer
|
36
|
+
value.to_i
|
37
|
+
when :Float
|
38
|
+
value.to_f
|
39
|
+
when :BOOLEAN
|
40
|
+
if value =~ /^(true|t|yes|y|1)$/i
|
41
|
+
true
|
42
|
+
else
|
43
|
+
false
|
44
|
+
end
|
45
|
+
else # model
|
46
|
+
_model = AsposeBarcodeCloud.const_get(type).new
|
47
|
+
_model.build_from_hash(value)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def to_s
|
52
|
+
to_hash.to_s
|
53
|
+
end
|
54
|
+
|
55
|
+
# to_body is an alias to to_body (backward compatibility))
|
56
|
+
def to_body
|
57
|
+
to_hash
|
58
|
+
end
|
59
|
+
|
60
|
+
# return the object in the form of hash
|
61
|
+
def to_hash
|
62
|
+
hash = {}
|
63
|
+
self.class.attribute_map.each_pair do |attr, param|
|
64
|
+
value = self.send(attr)
|
65
|
+
next if value.nil?
|
66
|
+
if value.is_a?(Array)
|
67
|
+
hash[param] = value.compact.map{ |v| _to_hash(v) }
|
68
|
+
else
|
69
|
+
hash[param] = _to_hash(value)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
hash
|
73
|
+
end
|
74
|
+
|
75
|
+
# Method to output non-array value in the form of hash
|
76
|
+
# For object, use to_hash. Otherwise, just return the value
|
77
|
+
def _to_hash(value)
|
78
|
+
if value.respond_to? :to_hash
|
79
|
+
value.to_hash
|
80
|
+
else
|
81
|
+
value
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|