br_danfe 0.0.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +26 -3
- data/br_danfe.gemspec +1 -0
- data/config/locales/pt-BR.yml +14 -0
- data/lib/br_danfe/cce.rb +28 -0
- data/lib/br_danfe/cce_lib/barcode.rb +24 -0
- data/lib/br_danfe/cce_lib/correction.rb +22 -0
- data/lib/br_danfe/cce_lib/document.rb +44 -0
- data/lib/br_danfe/cce_lib/footer.rb +15 -0
- data/lib/br_danfe/cce_lib/header.rb +15 -0
- data/lib/br_danfe/cce_lib/nfe_key.rb +23 -0
- data/lib/br_danfe/cce_lib/protocol.rb +23 -0
- data/lib/br_danfe/danfe.rb +16 -16
- data/lib/br_danfe/danfe_lib/cep.rb +9 -0
- data/lib/br_danfe/danfe_lib/consts.rb +6 -0
- data/lib/br_danfe/danfe_lib/cst.rb +30 -0
- data/lib/br_danfe/danfe_lib/dest.rb +86 -0
- data/lib/br_danfe/danfe_lib/det_body.rb +75 -0
- data/lib/br_danfe/danfe_lib/det_header.rb +40 -0
- data/lib/br_danfe/danfe_lib/document.rb +135 -0
- data/lib/br_danfe/danfe_lib/dup.rb +52 -0
- data/lib/br_danfe/danfe_lib/emit.rb +23 -0
- data/lib/br_danfe/danfe_lib/emit_header.rb +82 -0
- data/lib/br_danfe/danfe_lib/helper.rb +64 -0
- data/lib/br_danfe/danfe_lib/icmstot.rb +33 -0
- data/lib/br_danfe/danfe_lib/infadic.rb +80 -0
- data/lib/br_danfe/danfe_lib/issqn.rb +24 -0
- data/lib/br_danfe/danfe_lib/options.rb +24 -0
- data/lib/br_danfe/danfe_lib/phone.rb +13 -0
- data/lib/br_danfe/danfe_lib/plate.rb +9 -0
- data/lib/br_danfe/danfe_lib/ticket.rb +17 -0
- data/lib/br_danfe/danfe_lib/transp.rb +51 -0
- data/lib/br_danfe/danfe_lib/vol.rb +41 -0
- data/lib/br_danfe/danfe_lib/xml.rb +38 -0
- data/lib/br_danfe/danfe_lib/xprod.rb +48 -0
- data/lib/br_danfe/version.rb +1 -1
- data/lib/br_danfe.rb +1 -1
- data/spec/features/cce_spec.rb +28 -0
- data/spec/features/danfe_spec.rb +3 -3
- data/spec/fixtures/cce/lib/barcode#render.pdf +511 -0
- data/spec/fixtures/cce/lib/correction#render.pdf +100 -0
- data/spec/fixtures/cce/lib/document#box.pdf +55 -0
- data/spec/fixtures/cce/lib/document#box.with.block.pdf +72 -0
- data/spec/fixtures/cce/lib/document#text.align.pdf +70 -0
- data/spec/fixtures/cce/lib/document#text.pad.pdf +70 -0
- data/spec/fixtures/cce/lib/document#text.simple.pdf +70 -0
- data/spec/fixtures/cce/lib/document#text.size.pdf +70 -0
- data/spec/fixtures/cce/lib/document#text.style.pdf +70 -0
- data/spec/fixtures/cce/lib/footer#render.pdf +114 -0
- data/spec/fixtures/cce/lib/header#render.pdf +72 -0
- data/spec/fixtures/cce/lib/nfe_key#render.pdf +88 -0
- data/spec/fixtures/cce/lib/protocol#render.pdf +88 -0
- data/spec/fixtures/cce/v1.00/cce.fixture.pdf +659 -0
- data/spec/fixtures/cce/v1.00/cce.xml +1 -0
- data/spec/fixtures/{lib → nfe/lib}/dest#render-v2.00.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/dest#render-v3.10.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/dest#render-with_cnpj.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/dest#render-with_cpf.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/dest#render-with_ie.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/det_body#render-csosn.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/det_body#render-cst.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/det_body#render-fci.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/det_body#render-icms_st.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/det_header#render.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/document#lcnpj-blank.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/document#lcnpj-invalid.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/document#lcnpj-valid.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/document#lie-blank.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/document#lie-invalid.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/document#lie-valid.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/dup#render.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/emit#render.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/emit_header#render-with_logo.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/emit_header#render-without_logo.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/icmstot#render.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/infadic#render-extra_volume.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/infadic#render.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/issqn#render.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/ticket#render.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/transp#render-modfrete_0.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/transp#render-modfrete_1.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/transp#render-modfrete_2.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/transp#render-modfrete_9.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/transp#render.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/vol#render-blank-boxes.pdf +0 -0
- data/spec/fixtures/{lib → nfe/lib}/vol#render.pdf +0 -0
- data/spec/fixtures/{v2.00 → nfe/v2.00}/nfe_simples_nacional.xml +0 -0
- data/spec/fixtures/{v2.00 → nfe/v2.00}/nfe_simples_nacional.xml.fixture.pdf +0 -0
- data/spec/fixtures/{v2.00 → nfe/v2.00}/nfe_with_extra_volumes.xml +0 -0
- data/spec/fixtures/{v2.00 → nfe/v2.00}/nfe_with_extra_volumes.xml.fixture.pdf +0 -0
- data/spec/fixtures/{v2.00 → nfe/v2.00}/nfe_with_fci.xml +0 -0
- data/spec/fixtures/{v2.00 → nfe/v2.00}/nfe_with_fci.xml.fixture.pdf +0 -0
- data/spec/fixtures/{v2.00 → nfe/v2.00}/nfe_with_logo.xml +0 -0
- data/spec/fixtures/{v2.00 → nfe/v2.00}/nfe_with_ns.xml +0 -0
- data/spec/fixtures/{v2.00 → nfe/v2.00}/nfe_with_ns.xml.fixture.pdf +0 -0
- data/spec/fixtures/{v2.00 → nfe/v2.00}/nfe_without_ns.xml +0 -0
- data/spec/fixtures/{v2.00 → nfe/v2.00}/nfe_without_ns.xml.fixture.pdf +0 -0
- data/spec/fixtures/{v3.10 → nfe/v3.10}/nfe_simples_nacional.xml +0 -0
- data/spec/fixtures/{v3.10 → nfe/v3.10}/nfe_simples_nacional.xml.fixture.pdf +0 -0
- data/spec/lib/cce_lib/barcode_spec.rb +26 -0
- data/spec/lib/cce_lib/correction_spec.rb +26 -0
- data/spec/lib/cce_lib/document_spec.rb +115 -0
- data/spec/lib/cce_lib/footer_spec.rb +25 -0
- data/spec/lib/cce_lib/header_spec.rb +25 -0
- data/spec/lib/cce_lib/nfe_key_spec.rb +26 -0
- data/spec/lib/cce_lib/protocol_spec.rb +26 -0
- data/spec/lib/{cep_spec.rb → danfe_lib/cep_spec.rb} +2 -2
- data/spec/lib/{cst_spec.rb → danfe_lib/cst_spec.rb} +3 -3
- data/spec/lib/{dest_spec.rb → danfe_lib/dest_spec.rb} +4 -4
- data/spec/lib/{det_body_spec.rb → danfe_lib/det_body_spec.rb} +4 -4
- data/spec/lib/{det_header_spec.rb → danfe_lib/det_header_spec.rb} +4 -4
- data/spec/lib/{document_spec.rb → danfe_lib/document_spec.rb} +3 -3
- data/spec/lib/{dup_spec.rb → danfe_lib/dup_spec.rb} +4 -4
- data/spec/lib/{emit_header_spec.rb → danfe_lib/emit_header_spec.rb} +4 -4
- data/spec/lib/{emit_spec.rb → danfe_lib/emit_spec.rb} +4 -4
- data/spec/lib/{helper_spec.rb → danfe_lib/helper_spec.rb} +11 -11
- data/spec/lib/{icmstot_spec.rb → danfe_lib/icmstot_spec.rb} +4 -4
- data/spec/lib/{infadic_spec.rb → danfe_lib/infadic_spec.rb} +4 -4
- data/spec/lib/{issqn_spec.rb → danfe_lib/issqn_spec.rb} +4 -4
- data/spec/lib/{options_spec.rb → danfe_lib/options_spec.rb} +3 -3
- data/spec/lib/{phone_spec.rb → danfe_lib/phone_spec.rb} +3 -3
- data/spec/lib/{plate_spec.rb → danfe_lib/plate_spec.rb} +2 -2
- data/spec/lib/{ticket_spec.rb → danfe_lib/ticket_spec.rb} +4 -4
- data/spec/lib/{transp_spec.rb → danfe_lib/transp_spec.rb} +4 -4
- data/spec/lib/{vol_spec.rb → danfe_lib/vol_spec.rb} +4 -4
- data/spec/lib/{xml_spec.rb → danfe_lib/xml_spec.rb} +2 -2
- data/spec/lib/{xprod_spec.rb → danfe_lib/xprod_spec.rb} +5 -5
- metadata +242 -174
- data/lib/br_danfe/cep.rb +0 -7
- data/lib/br_danfe/consts.rb +0 -4
- data/lib/br_danfe/cst.rb +0 -28
- data/lib/br_danfe/dest.rb +0 -84
- data/lib/br_danfe/det_body.rb +0 -73
- data/lib/br_danfe/det_header.rb +0 -38
- data/lib/br_danfe/document.rb +0 -133
- data/lib/br_danfe/dup.rb +0 -50
- data/lib/br_danfe/emit.rb +0 -21
- data/lib/br_danfe/emit_header.rb +0 -80
- data/lib/br_danfe/helper.rb +0 -62
- data/lib/br_danfe/icmstot.rb +0 -31
- data/lib/br_danfe/infadic.rb +0 -78
- data/lib/br_danfe/issqn.rb +0 -22
- data/lib/br_danfe/options.rb +0 -22
- data/lib/br_danfe/phone.rb +0 -11
- data/lib/br_danfe/plate.rb +0 -7
- data/lib/br_danfe/ticket.rb +0 -15
- data/lib/br_danfe/transp.rb +0 -49
- data/lib/br_danfe/vol.rb +0 -39
- data/lib/br_danfe/xml.rb +0 -36
- data/lib/br_danfe/xprod.rb +0 -46
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
require "spec_helper"
|
|
2
2
|
|
|
3
|
-
describe BrDanfe::Plate do
|
|
3
|
+
describe BrDanfe::DanfeLib::Plate do
|
|
4
4
|
describe ".format_plate" do
|
|
5
5
|
it "returns a formated plate" do
|
|
6
6
|
plate = "ABC1234"
|
|
7
|
-
expect(BrDanfe::Plate.format(plate)).to eq "ABC-1234"
|
|
7
|
+
expect(BrDanfe::DanfeLib::Plate.format(plate)).to eq "ABC-1234"
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
10
|
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
require "spec_helper"
|
|
2
2
|
|
|
3
|
-
describe BrDanfe::Ticket do
|
|
4
|
-
let(:base_dir) { "./spec/fixtures/lib/"}
|
|
3
|
+
describe BrDanfe::DanfeLib::Ticket do
|
|
4
|
+
let(:base_dir) { "./spec/fixtures/nfe/lib/"}
|
|
5
5
|
let(:output_pdf) { "#{base_dir}output.pdf" }
|
|
6
6
|
|
|
7
|
-
let(:pdf) { BrDanfe::Document.new }
|
|
8
|
-
let(:xml) { BrDanfe::XML.new(xml_as_string) }
|
|
7
|
+
let(:pdf) { BrDanfe::DanfeLib::Document.new }
|
|
8
|
+
let(:xml) { BrDanfe::DanfeLib::XML.new(xml_as_string) }
|
|
9
9
|
|
|
10
10
|
subject { described_class.new(pdf, xml) }
|
|
11
11
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
require "spec_helper"
|
|
2
2
|
|
|
3
|
-
describe BrDanfe::Transp do
|
|
4
|
-
let(:base_dir) { "./spec/fixtures/lib/"}
|
|
3
|
+
describe BrDanfe::DanfeLib::Transp do
|
|
4
|
+
let(:base_dir) { "./spec/fixtures/nfe/lib/"}
|
|
5
5
|
let(:output_pdf) { "#{base_dir}output.pdf" }
|
|
6
6
|
|
|
7
|
-
let(:pdf) { BrDanfe::Document.new }
|
|
8
|
-
let(:xml) { BrDanfe::XML.new(xml_as_string) }
|
|
7
|
+
let(:pdf) { BrDanfe::DanfeLib::Document.new }
|
|
8
|
+
let(:xml) { BrDanfe::DanfeLib::XML.new(xml_as_string) }
|
|
9
9
|
|
|
10
10
|
subject { described_class.new(pdf, xml) }
|
|
11
11
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
require "spec_helper"
|
|
2
2
|
|
|
3
|
-
describe BrDanfe::Vol do
|
|
4
|
-
let(:base_dir) { "./spec/fixtures/lib/"}
|
|
3
|
+
describe BrDanfe::DanfeLib::Vol do
|
|
4
|
+
let(:base_dir) { "./spec/fixtures/nfe/lib/"}
|
|
5
5
|
let(:output_pdf) { "#{base_dir}output.pdf" }
|
|
6
6
|
|
|
7
|
-
let(:pdf) { BrDanfe::Document.new }
|
|
8
|
-
let(:xml) { BrDanfe::XML.new(xml_as_string) }
|
|
7
|
+
let(:pdf) { BrDanfe::DanfeLib::Document.new }
|
|
8
|
+
let(:xml) { BrDanfe::DanfeLib::XML.new(xml_as_string) }
|
|
9
9
|
|
|
10
10
|
subject { described_class.new(pdf, xml) }
|
|
11
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require "spec_helper"
|
|
2
2
|
|
|
3
|
-
describe BrDanfe::XML do
|
|
4
|
-
subject { BrDanfe::XML.new(xml_as_string) }
|
|
3
|
+
describe BrDanfe::DanfeLib::XML do
|
|
4
|
+
subject { BrDanfe::DanfeLib::XML.new(xml_as_string) }
|
|
5
5
|
|
|
6
6
|
describe "#version_310?" do
|
|
7
7
|
describe "when xml's version is 3.10" do
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "spec_helper"
|
|
4
4
|
|
|
5
|
-
describe BrDanfe::Xprod do
|
|
5
|
+
describe BrDanfe::DanfeLib::Xprod do
|
|
6
6
|
describe "#render" do
|
|
7
7
|
context "when have FCI" do
|
|
8
8
|
let(:xml_fci) do
|
|
@@ -18,7 +18,7 @@ describe BrDanfe::Xprod do
|
|
|
18
18
|
Nokogiri::XML(xml)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
subject { BrDanfe::Xprod.new(xml_fci) }
|
|
21
|
+
subject { BrDanfe::DanfeLib::Xprod.new(xml_fci) }
|
|
22
22
|
|
|
23
23
|
it "returns product + FCI" do
|
|
24
24
|
expected = "MONITOR DE ARCO ELETRICO"
|
|
@@ -52,7 +52,7 @@ describe BrDanfe::Xprod do
|
|
|
52
52
|
Nokogiri::XML(xml)
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
subject { BrDanfe::Xprod.new(xml_st) }
|
|
55
|
+
subject { BrDanfe::DanfeLib::Xprod.new(xml_st) }
|
|
56
56
|
|
|
57
57
|
it "returns product + ST" do
|
|
58
58
|
expected = "MONITOR DE ARCO ELETRICO"
|
|
@@ -77,7 +77,7 @@ describe BrDanfe::Xprod do
|
|
|
77
77
|
Nokogiri::XML(xml)
|
|
78
78
|
end
|
|
79
79
|
|
|
80
|
-
subject { BrDanfe::Xprod.new(xml_infAdProd) }
|
|
80
|
+
subject { BrDanfe::DanfeLib::Xprod.new(xml_infAdProd) }
|
|
81
81
|
|
|
82
82
|
it "returns product + infAdProd" do
|
|
83
83
|
expected = "MONITOR DE ARCO ELETRICO"
|
|
@@ -114,7 +114,7 @@ describe BrDanfe::Xprod do
|
|
|
114
114
|
Nokogiri::XML(xml)
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
-
subject { BrDanfe::Xprod.new(xml_IFC_ST_infAdProd) }
|
|
117
|
+
subject { BrDanfe::DanfeLib::Xprod.new(xml_IFC_ST_infAdProd) }
|
|
118
118
|
|
|
119
119
|
it "returns product + FCI + ST + infAdProd" do
|
|
120
120
|
expected = "MONITOR DE ARCO ELETRICO"
|