sapos-print 1.1.1 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +27 -27
- data/lib/sapos/print/cli.rb +3 -0
- data/lib/sapos/print/configuration.rb +3 -2
- data/lib/sapos/print/printer.rb +5 -0
- data/lib/sapos/print/q_reader.rb +9 -6
- data/lib/sapos/print/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 397a8d310cfc4a8f6299f7e3ec9157290c0a840c2738ff5e2208c8aeb45337ec
|
4
|
+
data.tar.gz: 98c4ed59f8606fce18446340d077f1e41930c256a3278f7b27b713b9c654040d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61fe8e46842eb10bd29985d11a5ec1dc64207c5778979ee612460e8d0678a5c0a2e26f86407aaf82ee3e853919318033f6bde8ac9904ae5baa3fdcce5c1df9e9
|
7
|
+
data.tar.gz: 3426f8b36537d04b3106278173862690cf0f0e934f59c0d97834df5d8152f6cf3f4263107b04db95f27967904db99eb7111399d1a0cbb42110a55664160afb77
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sapos-print (1.1.
|
4
|
+
sapos-print (1.1.1)
|
5
5
|
activesupport (~> 6.1)
|
6
6
|
awesome_print
|
7
7
|
json
|
@@ -26,38 +26,38 @@ GEM
|
|
26
26
|
concurrent-ruby (~> 1.1.5)
|
27
27
|
domain_name (0.5.20190701)
|
28
28
|
unf (>= 0.0.5, < 1.0.0)
|
29
|
-
dry-configurable (
|
30
|
-
dry-core (~>
|
29
|
+
dry-configurable (0.16.1)
|
30
|
+
dry-core (~> 0.6)
|
31
31
|
zeitwerk (~> 2.6)
|
32
|
-
dry-
|
32
|
+
dry-container (0.11.0)
|
33
33
|
concurrent-ruby (~> 1.0)
|
34
|
-
|
35
|
-
dry-inflector (1.0.0)
|
36
|
-
dry-initializer (3.1.1)
|
37
|
-
dry-logic (1.5.0)
|
34
|
+
dry-core (0.9.1)
|
38
35
|
concurrent-ruby (~> 1.0)
|
39
|
-
dry-core (~> 1.0, < 2)
|
40
36
|
zeitwerk (~> 2.6)
|
41
|
-
dry-
|
37
|
+
dry-inflector (0.2.1)
|
38
|
+
dry-initializer (3.0.4)
|
39
|
+
dry-logic (1.2.0)
|
40
|
+
concurrent-ruby (~> 1.0)
|
41
|
+
dry-core (~> 0.5, >= 0.5)
|
42
|
+
dry-schema (1.8.0)
|
42
43
|
concurrent-ruby (~> 1.0)
|
43
|
-
dry-configurable (~>
|
44
|
-
dry-core (~>
|
44
|
+
dry-configurable (~> 0.13, >= 0.13.0)
|
45
|
+
dry-core (~> 0.5, >= 0.5)
|
45
46
|
dry-initializer (~> 3.0)
|
46
|
-
dry-logic (
|
47
|
-
dry-types (
|
48
|
-
|
49
|
-
dry-types (1.7.1)
|
47
|
+
dry-logic (~> 1.0)
|
48
|
+
dry-types (~> 1.5)
|
49
|
+
dry-types (1.5.1)
|
50
50
|
concurrent-ruby (~> 1.0)
|
51
|
-
dry-
|
52
|
-
dry-
|
53
|
-
dry-
|
54
|
-
|
55
|
-
dry-validation (1.
|
51
|
+
dry-container (~> 0.3)
|
52
|
+
dry-core (~> 0.5, >= 0.5)
|
53
|
+
dry-inflector (~> 0.1, >= 0.1.2)
|
54
|
+
dry-logic (~> 1.0, >= 1.0.2)
|
55
|
+
dry-validation (1.7.0)
|
56
56
|
concurrent-ruby (~> 1.0)
|
57
|
-
dry-
|
57
|
+
dry-container (~> 0.7, >= 0.7.1)
|
58
|
+
dry-core (~> 0.5, >= 0.5)
|
58
59
|
dry-initializer (~> 3.0)
|
59
|
-
dry-schema (
|
60
|
-
zeitwerk (~> 2.6)
|
60
|
+
dry-schema (~> 1.8, >= 1.8.0)
|
61
61
|
http-accept (1.7.0)
|
62
62
|
http-cookie (1.0.5)
|
63
63
|
domain_name (~> 0.5)
|
@@ -68,7 +68,7 @@ GEM
|
|
68
68
|
mime-types (3.4.1)
|
69
69
|
mime-types-data (~> 3.2015)
|
70
70
|
mime-types-data (3.2023.0218.1)
|
71
|
-
minitest (5.18.
|
71
|
+
minitest (5.18.0)
|
72
72
|
netrc (0.11.0)
|
73
73
|
public_suffix (5.0.1)
|
74
74
|
pubnub (4.8.0)
|
@@ -85,13 +85,13 @@ GEM
|
|
85
85
|
mime-types (>= 1.16, < 4.0)
|
86
86
|
netrc (~> 0.8)
|
87
87
|
thor (1.2.2)
|
88
|
-
timers (4.3.
|
88
|
+
timers (4.3.3)
|
89
89
|
tzinfo (2.0.6)
|
90
90
|
concurrent-ruby (~> 1.0)
|
91
91
|
unf (0.1.4)
|
92
92
|
unf_ext
|
93
93
|
unf_ext (0.0.8.2)
|
94
|
-
zeitwerk (2.6.
|
94
|
+
zeitwerk (2.6.7)
|
95
95
|
|
96
96
|
PLATFORMS
|
97
97
|
arm64-darwin-21
|
data/lib/sapos/print/cli.rb
CHANGED
@@ -37,10 +37,13 @@ module Sapos
|
|
37
37
|
config[:user_id] = user_id
|
38
38
|
config[:duplicate_control] = ask("¿Control Duplicados por MSGID?", limited_to: ["si", "no"])
|
39
39
|
config[:printers] = [config[:printer]]
|
40
|
+
config[:interfaces] = [config[:interface]]
|
40
41
|
|
41
42
|
while yes?("¿Tiene impresoras adicionales?")
|
42
43
|
name = ask("Nombre de la impresora adicional: ")
|
44
|
+
interface = ask("Interfaz de la impresora adicional: ", limited_to: ["text", "escp"])
|
43
45
|
config[:printers] << name
|
46
|
+
config[:interfaces] << interface
|
44
47
|
end
|
45
48
|
if yes?("¿Esta seguro que desea guardar la configuración?")
|
46
49
|
Sapos::Print::Configuration.write(config)
|
@@ -6,7 +6,7 @@ module Sapos
|
|
6
6
|
module Print
|
7
7
|
class Configuration
|
8
8
|
|
9
|
-
attr_accessor :printer, :adapter, :interface, :q, :key, :emv_path, :emv_terminal, :user_id, :verbose, :duplicate_control, :cache, :printers, :
|
9
|
+
attr_accessor :printer, :adapter, :interface, :q, :key, :emv_path, :emv_terminal, :user_id, :verbose, :duplicate_control, :cache, :printers, :interfaces
|
10
10
|
|
11
11
|
def self.write(args = {})
|
12
12
|
config_file = "#{Sapos::Print.app_directory}/config.yml"
|
@@ -20,6 +20,7 @@ module Sapos
|
|
20
20
|
result = YAML.load(template.result(binding))
|
21
21
|
@printer = result[:printer]
|
22
22
|
@printers = result[:printers] || []
|
23
|
+
@interfaces = result[:interfaces] || []
|
23
24
|
@adapter = result[:adapter]
|
24
25
|
@interface = result[:interface]
|
25
26
|
@q = result[:q]
|
@@ -52,7 +53,7 @@ module Sapos
|
|
52
53
|
end
|
53
54
|
|
54
55
|
def to_h
|
55
|
-
{printer: @printer, adapter: @adapter, interface: @interface, q: @q, key: @key, emv_path: @emv_path, emv_terminal: @emv_terminal, user_id: @user_id, duplicate_control: @duplicate_control, printers: @printers }
|
56
|
+
{printer: @printer, adapter: @adapter, interface: @interface, q: @q, key: @key, emv_path: @emv_path, emv_terminal: @emv_terminal, user_id: @user_id, duplicate_control: @duplicate_control, printers: @printers, interfaces: @interfaces }
|
56
57
|
end
|
57
58
|
end
|
58
59
|
end
|
data/lib/sapos/print/printer.rb
CHANGED
data/lib/sapos/print/q_reader.rb
CHANGED
@@ -21,21 +21,23 @@ module Sapos
|
|
21
21
|
document_number = nil
|
22
22
|
|
23
23
|
puts msg.inspect if reader.config.verbose
|
24
|
-
|
24
|
+
|
25
|
+
printer_name = nil
|
25
26
|
if msg.is_a?(Hash)
|
26
27
|
print_control = msg['print_control']
|
27
28
|
document_number = msg['document_number']
|
29
|
+
printer_name = msg["printer"]
|
28
30
|
msg = msg['document']
|
29
31
|
end
|
30
32
|
|
31
33
|
document = Base64.decode64(msg)
|
32
34
|
|
33
35
|
current_printer = reader.printer
|
34
|
-
|
35
|
-
if
|
36
|
-
|
37
|
-
current_printer = reader.printers[msg['printer']]
|
36
|
+
|
37
|
+
if printer_name && reader.printers[printer_name]
|
38
|
+
current_printer = reader.printers[printer_name]
|
38
39
|
end
|
40
|
+
puts "Printer Config: #{current_printer.to_h}" if reader.config.verbose
|
39
41
|
|
40
42
|
if !current_printer.print(document: document, print_control: print_control, document_number: document_number, id: msgid, printer: printer_name)
|
41
43
|
puts "Printer Error"
|
@@ -59,9 +61,10 @@ module Sapos
|
|
59
61
|
@config = QReader.printer_config
|
60
62
|
@printer = Printer.new(@config)
|
61
63
|
@printers = {}
|
62
|
-
@config.printers.
|
64
|
+
@config.printers.each_with_index do |printer, idx|
|
63
65
|
config = @config.dup
|
64
66
|
config.printer = printer
|
67
|
+
config.interface = @config.interfaces[idx]
|
65
68
|
@printers[printer] = Printer.new(config)
|
66
69
|
end
|
67
70
|
@pubnub = Pubnub.new(subscribe_key: @config.key, user_id: @config.user_id, ssl: true)
|
data/lib/sapos/print/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sapos-print
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josef Sauter
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|