thecore_print_commons 2.1.6 → 2.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/api/printer.rb +6 -3
- 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: ff7cb53138fab8c991338c6f585d2bc547ea34dd6c4458ce4d2fda798980db9b
|
4
|
+
data.tar.gz: b3d1a389e3019373b61c5776747909ccacd309294b0b3ed3e9fa94a850845237
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cecd2553a802eb1cf908730bc636e3987c651bdbbf1cda33e0c521c26ff9e40c4397101688c1ee331b7faf2946d21b2d4687f614a3348ede4a705039a8654518
|
7
|
+
data.tar.gz: 0f9b85e7ea6019c63a5115f2e53d9a335710b796b539155e5354933b4792c55340b8883388640f09bf98026081e17aa531c18001ff6664eb6566cb4efd998927
|
@@ -34,11 +34,14 @@ module Api::Printer
|
|
34
34
|
# single_text = "#{printer.print_template.template.gsub("%DESCRIPTION%", item.description)}"
|
35
35
|
# text = single_text * params[:quantity].to_i
|
36
36
|
# # Preso l'ordine mi recupero l'item e ne stampo la quantità richiesta
|
37
|
-
# ::PrintWorker.perform_async(
|
37
|
+
# ::PrintWorker.perform_async('192.168.0.1', 9100, "We all love DJ")
|
38
38
|
|
39
39
|
printer = Printer.find(params[:id])
|
40
|
-
|
41
|
-
|
40
|
+
base_template = printer.print_template.template.dup
|
41
|
+
result = printer.print_template.translation_matrix.lines.map(&:strip).inject(base_template) do |base_template, replacement|
|
42
|
+
base_template.gsub("$#{replacement}", params[replacement]) unless replacement.blank? && params[replacement].blank?
|
43
|
+
end
|
44
|
+
::PrintWorker.perform_async(printer.ip, printer.port, result)
|
42
45
|
{ info: "Print job sent in background to #{printer.ip} on port #{printer.port}" }
|
43
46
|
end
|
44
47
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_print_commons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore_background_jobs
|