br_danfe 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/br_danfe/danfe.rb +1 -1
- data/lib/br_danfe/danfe_lib/emit_header.rb +4 -4
- data/lib/br_danfe/danfe_lib/options.rb +1 -1
- data/lib/br_danfe/version.rb +1 -1
- data/spec/features/danfe_spec.rb +1 -1
- data/spec/lib/danfe_lib/emit_header_spec.rb +2 -2
- data/spec/lib/danfe_lib/options_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2f5317a482b552f18b98288189e62ebb8543ced
|
4
|
+
data.tar.gz: 998323f1c9d60ac76a97463116583a075bc195d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23fc0c24cabdb273990ad058525c42a79aa9eba5613c42a75f16dd8dc4c9a3256bece7da8cc12c89c454103f34a811eac31529ba53e4c831d842b667c0437f48
|
7
|
+
data.tar.gz: 0c4a632de0771b144e63981b8bbd8f3e34498a94d0d51961eb3b9fcbda8b83f498ebabec1ef33756e36961f8589bb9d0c99c1597c06468f85f5070001350a2c3
|
data/lib/br_danfe/danfe.rb
CHANGED
@@ -58,7 +58,7 @@ module BrDanfe
|
|
58
58
|
|
59
59
|
def repeat_on_each_page
|
60
60
|
DanfeLib::Ticket.new(@pdf, @xml).render
|
61
|
-
DanfeLib::EmitHeader.new(@pdf, @xml, @options.
|
61
|
+
DanfeLib::EmitHeader.new(@pdf, @xml, @options.logo).render
|
62
62
|
DanfeLib::Emit.new(@pdf, @xml).render
|
63
63
|
DanfeLib::Dest.new(@pdf, @xml).render
|
64
64
|
DanfeLib::Dup.new(@pdf, @xml).render
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module BrDanfe
|
2
2
|
module DanfeLib
|
3
3
|
class EmitHeader
|
4
|
-
def initialize(pdf, xml,
|
4
|
+
def initialize(pdf, xml, logo)
|
5
5
|
@pdf = pdf
|
6
6
|
@xml = xml
|
7
|
-
@
|
7
|
+
@logo = logo
|
8
8
|
end
|
9
9
|
|
10
10
|
def render
|
@@ -21,13 +21,13 @@ module BrDanfe
|
|
21
21
|
@pdf.ibox 3.92, 7.46, 0.75, 4.22, "", @xml["emit/xNome"],
|
22
22
|
{ size: 12, align: :center, border: 0, style: :bold }
|
23
23
|
|
24
|
-
if @
|
24
|
+
if @logo.blank?
|
25
25
|
@pdf.ibox 3.92, 7.46, 1.25, 5.42, "", address, { align: :left, border: 0 }
|
26
26
|
else
|
27
27
|
@pdf.ibox 3.92, 7.46, 3.25, 5.42, "", address,
|
28
28
|
{ size: 8, align: :left, border: 0 }
|
29
29
|
|
30
|
-
@pdf.image @
|
30
|
+
@pdf.image @logo, at: [1.0.cm, Helper.invert(5.42.cm)],
|
31
31
|
width: 2.cm
|
32
32
|
end
|
33
33
|
end
|
data/lib/br_danfe/version.rb
CHANGED
data/spec/features/danfe_spec.rb
CHANGED
@@ -26,7 +26,7 @@ describe BrDanfe::Danfe do
|
|
26
26
|
expect(File.exist?(output_pdf)).to be_falsey
|
27
27
|
|
28
28
|
danfe = BrDanfe::Danfe.new(File.read("#{base_dir}nfe_simples_nacional.xml"))
|
29
|
-
danfe.options.
|
29
|
+
danfe.options.logo = "spec/fixtures/logo.png"
|
30
30
|
danfe.options.products_unit_price_precision = 4
|
31
31
|
danfe.options.products_quantity_precision = 4
|
32
32
|
|
@@ -60,9 +60,9 @@ describe BrDanfe::DanfeLib::EmitHeader do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
context "with logo" do
|
63
|
-
let(:
|
63
|
+
let(:logo) { "spec/fixtures/logo.png" }
|
64
64
|
|
65
|
-
subject { described_class.new(pdf, xml,
|
65
|
+
subject { described_class.new(pdf, xml, logo) }
|
66
66
|
|
67
67
|
it "renders xml to the pdf" do
|
68
68
|
expect(File.exist?(output_pdf)).to be_falsey
|
@@ -3,17 +3,17 @@ require "spec_helper"
|
|
3
3
|
describe BrDanfe::DanfeLib::Options do
|
4
4
|
it "returns the default config set in the code" do
|
5
5
|
options = BrDanfe::DanfeLib::Options.new
|
6
|
-
expect(options.
|
6
|
+
expect(options.logo).to eq("")
|
7
7
|
expect(options.products_unit_price_precision).to eq(2)
|
8
8
|
expect(options.products_quantity_precision).to eq(2)
|
9
9
|
end
|
10
10
|
|
11
11
|
it "returns the config set in params" do
|
12
|
-
custom_options = {
|
12
|
+
custom_options = { logo: "/fake/path/file.png",
|
13
13
|
products_unit_price_precision: 3, products_quantity_precision: 4 }
|
14
14
|
|
15
15
|
options = BrDanfe::DanfeLib::Options.new(custom_options)
|
16
|
-
expect(options.
|
16
|
+
expect(options.logo).to eq("/fake/path/file.png")
|
17
17
|
expect(options.products_unit_price_precision).to eq(3)
|
18
18
|
expect(options.products_quantity_precision).to eq(4)
|
19
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: br_danfe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ASSEINFO
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|