AuraPrint 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/aura-print.rb +48 -0
  3. metadata +73 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: adb36beea14a5691ccb00caee4e86afdb8c6cddb
4
+ data.tar.gz: 77a9b2aec38f0ca1568a78df0b4b63479fde19e2
5
+ SHA512:
6
+ metadata.gz: 722211efe04e4fb03fcbadec25d15af26cdc24597e90bf6e34427c6c041c73437e7a840b167ed4e5f9f1b3a1b4cd229e04b638f525bb5998e15c61890f4ce565
7
+ data.tar.gz: 2c2d5652458d415e753fc30a05a06a8d696cd05f754ea013040cd70555ba947dbc671e53b665500b4a51aaad9a2127597f1c5a1a5e8f895de381efd0244617c9
data/lib/aura-print.rb ADDED
@@ -0,0 +1,48 @@
1
+ require 'yaml'
2
+ module AuraPrint
3
+ @config = {
4
+ print_address: 'http://10.0.2.232/printer/aura.php',
5
+ printer: 'Stage1'
6
+ }
7
+
8
+ @valid_config_keys = @config.keys
9
+
10
+ # Configure through hash
11
+ def self.configure(opts = {})
12
+ opts.each { |k, v| @config[k.to_sym] = v if @valid_config_keys.include? k.to_sym }
13
+ end
14
+
15
+ # Configure through yaml file
16
+ def self.configure_with(path_to_yaml_file)
17
+ begin
18
+ config = YAML.load(IO.read(path_to_yaml_file))
19
+ rescue Errno::ENOENT
20
+ puts "YAML configuration file couldn't be found. Using defaults."; return
21
+ rescue Psych::SyntaxError
22
+ puts 'YAML configuration file contains invalid syntax. Using defaults.'; return
23
+ end
24
+
25
+ configure(config)
26
+ end
27
+
28
+ def self.config
29
+ @config
30
+ end
31
+
32
+ def self.barcodeWeb(sku)
33
+ require 'unirest'
34
+ Unirest.post('http://10.0.2.232/printer/aura.php',
35
+ parameters: { sku: sku, printer: 'Stage1' })
36
+
37
+ 'Success'
38
+ end
39
+
40
+ def self.systemPrint(sku)
41
+ require 'barby'
42
+ require 'barby/barcode/code_128'
43
+ require 'barby/outputter/html_outputter'
44
+
45
+ barcode = Barby::Code128B.new(sku)
46
+ barcode.to_html
47
+ end
48
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: AuraPrint
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Keaton Burleson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-12-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: barby
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: unirest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: A gem which manages printing between barcodeWeb and the user's machine.
42
+ email:
43
+ - keaton.burleson@me.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - lib/aura-print.rb
49
+ homepage: https://github.com/128keaton/Aura-Print
50
+ licenses:
51
+ - MIT
52
+ metadata: {}
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubyforge_project:
69
+ rubygems_version: 2.5.1
70
+ signing_key:
71
+ specification_version: 4
72
+ summary: A gem which manages printing.
73
+ test_files: []