aspose_barcode_cloud 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,53 @@
1
+ module AsposeBarcodeCloud
2
+ #
3
+ class BaseResponse < BaseObject
4
+ attr_accessor :status, :code
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'status' => :'Status',
11
+
12
+ #
13
+ :'code' => :'Code'
14
+
15
+ }
16
+ end
17
+
18
+ # attribute type
19
+ def self.swagger_types
20
+ {
21
+ :'status' => :'String',
22
+ :'code' => :'String'
23
+
24
+ }
25
+ end
26
+
27
+ def initialize(attributes = {})
28
+ return if !attributes.is_a?(Hash) || attributes.empty?
29
+
30
+ # convert string to symbol for hash key
31
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
32
+
33
+
34
+ if attributes[:'Status']
35
+ self.status = attributes[:'Status']
36
+ end
37
+
38
+ if attributes[:'Code']
39
+ self.code = attributes[:'Code']
40
+ end
41
+
42
+ end
43
+
44
+ def status=(status)
45
+ 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"]
46
+ if status && !allowed_values.include?(status)
47
+ fail "invalid value for 'status', must be one of #{allowed_values}"
48
+ end
49
+ @status = status
50
+ end
51
+
52
+ end
53
+ end
@@ -0,0 +1,61 @@
1
+ module AsposeBarcodeCloud
2
+ #
3
+ class Margins < BaseObject
4
+ attr_accessor :left, :right, :top, :bottom
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'left' => :'Left',
11
+
12
+ #
13
+ :'right' => :'Right',
14
+
15
+ #
16
+ :'top' => :'Top',
17
+
18
+ #
19
+ :'bottom' => :'Bottom'
20
+
21
+ }
22
+ end
23
+
24
+ # attribute type
25
+ def self.swagger_types
26
+ {
27
+ :'left' => :'Float',
28
+ :'right' => :'Float',
29
+ :'top' => :'Float',
30
+ :'bottom' => :'Float'
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[:'Left']
43
+ self.left = attributes[:'Left']
44
+ end
45
+
46
+ if attributes[:'Right']
47
+ self.right = attributes[:'Right']
48
+ end
49
+
50
+ if attributes[:'Top']
51
+ self.top = attributes[:'Top']
52
+ end
53
+
54
+ if attributes[:'Bottom']
55
+ self.bottom = attributes[:'Bottom']
56
+ end
57
+
58
+ end
59
+
60
+ end
61
+ end
@@ -0,0 +1,45 @@
1
+ module AsposeBarcodeCloud
2
+ #
3
+ class Resolution < BaseObject
4
+ attr_accessor :resolution_x, :resolution_y
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'resolution_x' => :'ResolutionX',
11
+
12
+ #
13
+ :'resolution_y' => :'ResolutionY'
14
+
15
+ }
16
+ end
17
+
18
+ # attribute type
19
+ def self.swagger_types
20
+ {
21
+ :'resolution_x' => :'Float',
22
+ :'resolution_y' => :'Float'
23
+
24
+ }
25
+ end
26
+
27
+ def initialize(attributes = {})
28
+ return if !attributes.is_a?(Hash) || attributes.empty?
29
+
30
+ # convert string to symbol for hash key
31
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
32
+
33
+
34
+ if attributes[:'ResolutionX']
35
+ self.resolution_x = attributes[:'ResolutionX']
36
+ end
37
+
38
+ if attributes[:'ResolutionY']
39
+ self.resolution_y = attributes[:'ResolutionY']
40
+ end
41
+
42
+ end
43
+
44
+ end
45
+ end
@@ -0,0 +1,3 @@
1
+ module AsposeBarcodeCloud
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,103 @@
1
+ require "minitest/autorun"
2
+ require "minitest/unit"
3
+
4
+ require_relative '../lib/aspose_barcode_cloud'
5
+
6
+ class BarcodeTests < Minitest::Test
7
+ include MiniTest::Assertions
8
+ include AsposeBarcodeCloud
9
+ include AsposeStorageCloud
10
+
11
+ def setup
12
+ #Get App key and App SID from https://cloud.aspose.com
13
+ AsposeApp.app_key_and_sid("53b8b19adffa41a3e87dbbd8858977ae", "0B17F60A-6D69-426B-9ABD-79F35A6E9F7B")
14
+ @barcode_api = BarcodeApi.new
15
+ end
16
+
17
+ def teardown
18
+ end
19
+
20
+ def upload_file(file_name)
21
+ @storage_api = StorageApi.new
22
+ response = @storage_api.put_create(file_name, File.open("data/" << file_name,"r") { |io| io.read } )
23
+ assert(response, message="Failed to upload {file_name} file.")
24
+ end
25
+
26
+ def test_get_barcode_generate
27
+ opts = {text: "Dairy Products", type: "qr", format: "png"}
28
+
29
+ response = @barcode_api.get_barcode_generate(opts)
30
+ assert(response, message="Failed to generate barcode")
31
+ end
32
+
33
+ def test_post_generate_multiple
34
+ barcode_builders_list = BarcodeBuildersList.new
35
+ barcode_builders_list.x_step = 1
36
+ barcode_builders_list.y_step = 2
37
+ barcode_builder_1 = BarcodeBuilder.new
38
+ barcode_builder_1.type_of_barcode = "qr"
39
+ barcode_builder_1.text = "Aspose Your File Format APIs"
40
+ barcode_builder_2 = BarcodeBuilder.new
41
+ barcode_builder_2.type_of_barcode = "qr"
42
+ barcode_builder_2.text = "Aspose.Barcode for Cloud"
43
+ barcode_builders_list.barcode_builders = [barcode_builder_1, barcode_builder_2]
44
+ opts = {format: "png"}
45
+
46
+ response = @barcode_api.post_generate_multiple(barcode_builders_list, opts)
47
+ assert(response, message="Failed to generate multiple barcodes and return in response stream")
48
+ end
49
+
50
+ def test_post_barcode_recognize_from_urlor_content
51
+ opts = {type: "Code39Standard", url: "http://www.barcoding.com/images/Barcodes/code93.gif"}
52
+
53
+ response = @barcode_api.post_barcode_recognize_from_urlor_content(opts)
54
+ assert(response, message="Failed to recognize barcode from an url.")
55
+ end
56
+
57
+ def test_put_barcode_generate_file
58
+ name = "NewBarcode.png"
59
+ opts = {text: "Aspose.Barcode for Cloud", type: "qr"}
60
+
61
+ response = @barcode_api.put_barcode_generate_file(name, opts)
62
+ assert(response, message="Failed to generate barcode and save on server.")
63
+ end
64
+
65
+ def test_put_generate_multiple
66
+ name = "AsposeBarcode.png"
67
+ barcode_builders_list = BarcodeBuildersList.new
68
+ barcode_builders_list.x_step = 1
69
+ barcode_builders_list.y_step = 2
70
+ barcode_builder_1 = BarcodeBuilder.new
71
+ barcode_builder_1.type_of_barcode = "qr"
72
+ barcode_builder_1.text = "Aspose Your File Format APIs"
73
+ barcode_builder_2 = BarcodeBuilder.new
74
+ barcode_builder_2.type_of_barcode = "qr"
75
+ barcode_builder_2.text = "Aspose.Barcode for Cloud"
76
+ barcode_builders_list.barcode_builders = [barcode_builder_1, barcode_builder_2]
77
+
78
+ response = @barcode_api.put_generate_multiple(name, barcode_builders_list)
79
+ assert(response, message="Failed to generate image with multiple barcodes and put new file on server")
80
+ end
81
+
82
+ def test_get_barcode_recognize
83
+ file_name = "barcode.png"
84
+ upload_file(file_name)
85
+ opts = {type: "Code39Standard"}
86
+
87
+ response = @barcode_api.get_barcode_recognize(file_name, opts)
88
+ assert(response, message="Failed to recognize barcode from a file on server.")
89
+ end
90
+
91
+ def test_put_barcode_recognize_from_body
92
+ file_name = "sample-barcode.jpeg"
93
+ upload_file(file_name)
94
+ barcode_reader = BarcodeReader.new
95
+ barcode_reader.strip_fnc = true
96
+ barcode_reader.checksum_validation = "Off"
97
+ opts = {type: "Code39Standard"}
98
+
99
+ response = @barcode_api.put_barcode_recognize_from_body(file_name, barcode_reader, opts)
100
+ assert(response, message="Failed to recognize barcode from file on server with parameters in body.")
101
+ end
102
+
103
+ end
Binary file
@@ -0,0 +1,12 @@
1
+ {
2
+ "BarcodeBuilders": [
3
+ {
4
+ "TypeOfBarcode": "qr",
5
+ "Text": "Aspose.com"
6
+ }
7
+ {
8
+ "TypeOfBarcode": "qr",
9
+ "Text": "Aspose.Barcode for Cloud"
10
+ }
11
+ ]
12
+ }
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aspose_barcode_cloud
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - M. Sohail Ismail
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: typhoeus
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.8'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: aspose_storage_cloud
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 1.0.0
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '1.0'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.0.0
61
+ - !ruby/object:Gem::Dependency
62
+ name: minitest
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '5.8'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '5.8'
75
+ description: 'Aspose.Barcode for Cloud is a REST API for barcode generation and recognition.
76
+ It helps you generate barcode images from scratch in linear (1D), two dimensional
77
+ (2D), and postal formats. Generate barcode images in a variety of image formats:
78
+ JPEG, PNG, GIF, BMP, TIFF and many others. Recognize barcodes from different image
79
+ types. Aspose.Barcode for Cloud allows you to control all aspects of the image and
80
+ barcode when generating barcode images. Specify image width, height, border style,
81
+ output image format and more. You can also set barcode attributes like font style,
82
+ font color, background color, barcode type and the barcode text location.'
83
+ email:
84
+ - muhammad.sohail@aspose.com
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - LICENSE
90
+ - README.md
91
+ - aspose_barcode_cloud.gemspec
92
+ - lib/aspose_barcode_cloud.rb
93
+ - lib/aspose_barcode_cloud/api/barcode_api.rb
94
+ - lib/aspose_barcode_cloud/api_client.rb
95
+ - lib/aspose_barcode_cloud/api_error.rb
96
+ - lib/aspose_barcode_cloud/configuration.rb
97
+ - lib/aspose_barcode_cloud/models/barcode_builder.rb
98
+ - lib/aspose_barcode_cloud/models/barcode_builders_list.rb
99
+ - lib/aspose_barcode_cloud/models/barcode_reader.rb
100
+ - lib/aspose_barcode_cloud/models/barcode_response.rb
101
+ - lib/aspose_barcode_cloud/models/barcode_response_list.rb
102
+ - lib/aspose_barcode_cloud/models/base_object.rb
103
+ - lib/aspose_barcode_cloud/models/base_response.rb
104
+ - lib/aspose_barcode_cloud/models/margins.rb
105
+ - lib/aspose_barcode_cloud/models/resolution.rb
106
+ - lib/aspose_barcode_cloud/version.rb
107
+ - test/barcode_tests.rb
108
+ - test/data/barcode.png
109
+ - test/data/sample-barcode.jpeg
110
+ - test/data/sample.txt
111
+ homepage: http://www.aspose.com/cloud/barcode-api.aspx
112
+ licenses:
113
+ - MIT
114
+ metadata: {}
115
+ post_install_message:
116
+ rdoc_options: []
117
+ require_paths:
118
+ - lib
119
+ required_ruby_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ requirements: []
130
+ rubyforge_project:
131
+ rubygems_version: 2.5.1
132
+ signing_key:
133
+ specification_version: 4
134
+ summary: Aspose.Barcode for Cloud
135
+ test_files:
136
+ - test/barcode_tests.rb
137
+ - test/data/barcode.png
138
+ - test/data/sample-barcode.jpeg
139
+ - test/data/sample.txt