br_danfe 0.11.1 → 0.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +1 -0
- data/.rubocop.yml +113 -0
- data/Gemfile.lock +40 -19
- data/Rakefile +3 -3
- data/br_danfe.gemspec +7 -7
- data/lib/br_danfe.rb +14 -14
- data/lib/br_danfe/cce.rb +1 -0
- data/lib/br_danfe/cce_lib/barcode.rb +3 -2
- data/lib/br_danfe/cce_lib/correction.rb +3 -2
- data/lib/br_danfe/cce_lib/document.rb +15 -5
- data/lib/br_danfe/cce_lib/footer.rb +1 -1
- data/lib/br_danfe/cce_lib/header.rb +1 -1
- data/lib/br_danfe/cce_lib/nfe_key.rb +4 -3
- data/lib/br_danfe/cce_lib/protocol.rb +4 -3
- data/lib/br_danfe/danfe.rb +17 -17
- data/lib/br_danfe/danfe_lib/cep.rb +1 -1
- data/lib/br_danfe/danfe_lib/cst.rb +8 -6
- data/lib/br_danfe/danfe_lib/dest.rb +21 -23
- data/lib/br_danfe/danfe_lib/det_body.rb +20 -20
- data/lib/br_danfe/danfe_lib/document.rb +49 -36
- data/lib/br_danfe/danfe_lib/dup.rb +11 -10
- data/lib/br_danfe/danfe_lib/emit_header.rb +38 -34
- data/lib/br_danfe/danfe_lib/helper.rb +23 -23
- data/lib/br_danfe/danfe_lib/icmstot.rb +12 -12
- data/lib/br_danfe/danfe_lib/infadic.rb +1 -0
- data/lib/br_danfe/danfe_lib/issqn.rb +6 -6
- data/lib/br_danfe/danfe_lib/options.rb +6 -5
- data/lib/br_danfe/danfe_lib/phone.rb +2 -2
- data/lib/br_danfe/danfe_lib/ticket.rb +6 -4
- data/lib/br_danfe/danfe_lib/transp.rb +27 -26
- data/lib/br_danfe/danfe_lib/vol.rb +9 -8
- data/lib/br_danfe/danfe_lib/xml.rb +6 -6
- data/lib/br_danfe/danfe_lib/xprod.rb +22 -23
- data/lib/br_danfe/uf.rb +1 -4
- data/lib/br_danfe/version.rb +1 -1
- data/spec/features/cce_spec.rb +6 -6
- data/spec/features/danfe_spec.rb +25 -25
- data/spec/fixtures/cce/lib/barcode#render.pdf +5 -1
- data/spec/fixtures/cce/lib/correction#render.pdf +6 -2
- data/spec/fixtures/cce/lib/document#box.pdf +5 -1
- data/spec/fixtures/cce/lib/document#box.with.block.pdf +6 -2
- data/spec/fixtures/cce/lib/document#text.align.pdf +6 -2
- data/spec/fixtures/cce/lib/document#text.pad.pdf +6 -2
- data/spec/fixtures/cce/lib/document#text.simple.pdf +6 -2
- data/spec/fixtures/cce/lib/document#text.size.pdf +6 -2
- data/spec/fixtures/cce/lib/document#text.style.pdf +6 -2
- data/spec/fixtures/cce/lib/footer#render.pdf +6 -2
- data/spec/fixtures/cce/lib/header#render.pdf +6 -2
- data/spec/fixtures/cce/lib/nfe_key#render.pdf +7 -3
- data/spec/fixtures/cce/lib/protocol#render.pdf +7 -3
- data/spec/fixtures/cce/v1.00/cce.fixture.pdf +7 -3
- data/spec/fixtures/nfe/lib/dest#render-v2.00.pdf +7 -3
- data/spec/fixtures/nfe/lib/dest#render-v3.10.pdf +7 -3
- data/spec/fixtures/nfe/lib/dest#render-v4.00.pdf +7 -3
- data/spec/fixtures/nfe/lib/dest#render-with-address-bigger.pdf +7 -3
- data/spec/fixtures/nfe/lib/dest#render-with_cnpj.pdf +7 -3
- data/spec/fixtures/nfe/lib/dest#render-with_cpf.pdf +7 -3
- data/spec/fixtures/nfe/lib/dest#render-with_ie.pdf +7 -3
- data/spec/fixtures/nfe/lib/dest#render-without-address-complement.pdf +7 -3
- data/spec/fixtures/nfe/lib/det_body#render-csosn.pdf +383 -379
- data/spec/fixtures/nfe/lib/det_body#render-cst.pdf +233 -229
- data/spec/fixtures/nfe/lib/det_body#render-fci.pdf +158 -154
- data/spec/fixtures/nfe/lib/det_body#render-icms_st.pdf +158 -154
- data/spec/fixtures/nfe/lib/det_body#render-quantity_with_custom_precision.pdf +158 -154
- data/spec/fixtures/nfe/lib/det_body#render-three_pages.pdf +3697 -3685
- data/spec/fixtures/nfe/lib/det_body#render-two_pages.pdf +3540 -3532
- data/spec/fixtures/nfe/lib/det_body#render-unit_price_with_custom_precision.pdf +158 -154
- data/spec/fixtures/nfe/lib/det_body#render-with_infadprod.pdf +158 -154
- data/spec/fixtures/nfe/lib/det_body#render-with_issqn.pdf +1665 -1657
- data/spec/fixtures/nfe/lib/det_body#render-without_issqn.pdf +1665 -1657
- data/spec/fixtures/nfe/lib/document#lcnpj-blank.pdf +6 -2
- data/spec/fixtures/nfe/lib/document#lcnpj-invalid.pdf +6 -2
- data/spec/fixtures/nfe/lib/document#lcnpj-valid.pdf +6 -2
- data/spec/fixtures/nfe/lib/document#lie-blank-uf-invalid.pdf +6 -2
- data/spec/fixtures/nfe/lib/document#lie-blank.pdf +6 -2
- data/spec/fixtures/nfe/lib/document#lie-invalid.pdf +6 -2
- data/spec/fixtures/nfe/lib/document#lie-valid.pdf +6 -2
- data/spec/fixtures/nfe/lib/dup#render.pdf +8 -4
- data/spec/fixtures/nfe/lib/emit_header#render-second_page.pdf +9 -5
- data/spec/fixtures/nfe/lib/emit_header#render-with_logo.pdf +9 -5
- data/spec/fixtures/nfe/lib/emit_header#render-without_logo.pdf +7 -3
- data/spec/fixtures/nfe/lib/icmstot#render.pdf +7 -3
- data/spec/fixtures/nfe/lib/infadic#render-all_the_informations.pdf +8 -4
- data/spec/fixtures/nfe/lib/infadic#render-difal.pdf +7 -3
- data/spec/fixtures/nfe/lib/infadic#render-extra_volume.pdf +8 -4
- data/spec/fixtures/nfe/lib/infadic#render-with_complementary_information.pdf +7 -3
- data/spec/fixtures/nfe/lib/infadic#render-with_fisco_additional_information.pdf +7 -3
- data/spec/fixtures/nfe/lib/infadic#render-with_street_data.pdf +7 -3
- data/spec/fixtures/nfe/lib/infadic#render.pdf +7 -3
- data/spec/fixtures/nfe/lib/infadic_vol#render-extra_volume.pdf +7 -3
- data/spec/fixtures/nfe/lib/issqn#render-with_issqn.pdf +7 -3
- data/spec/fixtures/nfe/lib/issqn#render-with_one_issqn_value.pdf +7 -3
- data/spec/fixtures/nfe/lib/issqn#render-without_issqn.pdf +5 -1
- data/spec/fixtures/nfe/lib/ticket#render.pdf +6 -2
- data/spec/fixtures/nfe/lib/transp#render-modfrete_0.pdf +7 -3
- data/spec/fixtures/nfe/lib/transp#render-modfrete_1.pdf +7 -3
- data/spec/fixtures/nfe/lib/transp#render-modfrete_2.pdf +7 -3
- data/spec/fixtures/nfe/lib/transp#render-modfrete_3.pdf +7 -3
- data/spec/fixtures/nfe/lib/transp#render-modfrete_4.pdf +7 -3
- data/spec/fixtures/nfe/lib/transp#render-modfrete_9.pdf +7 -3
- data/spec/fixtures/nfe/lib/transp#render.pdf +7 -3
- data/spec/fixtures/nfe/lib/vol#render-blank-boxes.pdf +6 -2
- data/spec/fixtures/nfe/lib/vol#render.pdf +6 -2
- data/spec/fixtures/nfe/v2.00/custom_options.fixture.pdf +317 -313
- data/spec/fixtures/nfe/v2.00/nfe_simples_nacional.xml.fixture.pdf +315 -311
- data/spec/fixtures/nfe/v2.00/nfe_with_extra_volumes.xml.fixture.pdf +1297 -1289
- data/spec/fixtures/nfe/v2.00/nfe_with_fci.xml.fixture.pdf +165 -161
- data/spec/fixtures/nfe/v2.00/nfe_with_ns.xml.fixture.pdf +1297 -1289
- data/spec/fixtures/nfe/v2.00/nfe_without_ns.xml.fixture.pdf +314 -310
- data/spec/fixtures/nfe/v3.10/nfe_simples_nacional.xml.fixture.pdf +765 -761
- data/spec/fixtures/nfe/v3.10/with_footer.fixture.pdf +1222 -1214
- data/spec/fixtures/nfe/v3.10/with_issqn.fixture.pdf +1222 -1214
- data/spec/fixtures/nfe/v3.10/with_three_pages.fixture.pdf +4004 -3992
- data/spec/fixtures/nfe/v3.10/without_issqn.fixture.pdf +1522 -1514
- data/spec/lib/cce_lib/barcode_spec.rb +5 -5
- data/spec/lib/cce_lib/correction_spec.rb +5 -5
- data/spec/lib/cce_lib/document_spec.rb +23 -23
- data/spec/lib/cce_lib/footer_spec.rb +4 -4
- data/spec/lib/cce_lib/header_spec.rb +4 -4
- data/spec/lib/cce_lib/nfe_key_spec.rb +5 -5
- data/spec/lib/cce_lib/protocol_spec.rb +5 -5
- data/spec/lib/danfe_lib/cep_spec.rb +5 -5
- data/spec/lib/danfe_lib/cst_spec.rb +8 -8
- data/spec/lib/danfe_lib/dest_spec.rb +23 -23
- data/spec/lib/danfe_lib/det_body_spec.rb +26 -26
- data/spec/lib/danfe_lib/document_spec.rb +25 -25
- data/spec/lib/danfe_lib/dup_spec.rb +4 -4
- data/spec/lib/danfe_lib/emit_header_spec.rb +13 -13
- data/spec/lib/danfe_lib/helper_spec.rb +74 -74
- data/spec/lib/danfe_lib/icmstot_spec.rb +4 -4
- data/spec/lib/danfe_lib/infadic_spec.rb +6 -13
- data/spec/lib/danfe_lib/infadic_vol_spec.rb +1 -4
- data/spec/lib/danfe_lib/issqn_spec.rb +11 -11
- data/spec/lib/danfe_lib/logo_options_spec.rb +18 -18
- data/spec/lib/danfe_lib/options_spec.rb +7 -7
- data/spec/lib/danfe_lib/phone_spec.rb +10 -10
- data/spec/lib/danfe_lib/plate_spec.rb +9 -9
- data/spec/lib/danfe_lib/ticket_spec.rb +4 -4
- data/spec/lib/danfe_lib/transp_spec.rb +10 -10
- data/spec/lib/danfe_lib/vol_spec.rb +7 -7
- data/spec/lib/danfe_lib/xml_spec.rb +5 -5
- data/spec/lib/danfe_lib/xprod_spec.rb +48 -50
- data/spec/lib/uf_spec.rb +12 -12
- data/spec/support/have_same_content_of.rb +6 -6
- metadata +40 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1de518d313ceb76285fe9d9a589c48c540bf07fe76f9bcc72692db92e8217973
|
4
|
+
data.tar.gz: 54b2de6012f183a7157ade8e1deae69c2b3209eabdf908c7b81aafc9baa127b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa8a9756f5436acf1580bf6f183e742c3c2335bd8e6884200d094780d0ba12542ce42d4e2dd25641b36774a480f1eb22590fdee2f06e34511279ab99f8ece74c
|
7
|
+
data.tar.gz: f92b7ea6440380459596aa37fb7e2647b36daf0a049bc0e0841343a59797d5f5de4266818dbc4fb5b3254a6ba944e2e289a74b019d36120221bfcca29245685a
|
data/.codeclimate.yml
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
require: rubocop-performance
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.5.1
|
5
|
+
Exclude:
|
6
|
+
- 'config/**/*'
|
7
|
+
- 'spec/spec_helper.rb'
|
8
|
+
- !ruby/regexp /old_and_unused\.rb$/
|
9
|
+
DisplayCopNames: true
|
10
|
+
DisplayStyleGuide: true
|
11
|
+
|
12
|
+
Bundler/OrderedGems:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Layout/HashAlignment:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Layout/ParameterAlignment:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Layout/FirstArrayElementIndentation:
|
22
|
+
EnforcedStyle: consistent
|
23
|
+
|
24
|
+
Layout/SpaceBeforeBlockBraces:
|
25
|
+
EnforcedStyleForEmptyBraces: space
|
26
|
+
|
27
|
+
Metrics/ClassLength:
|
28
|
+
Max: 230
|
29
|
+
Exclude:
|
30
|
+
- 'app/models/invoice_product.rb'
|
31
|
+
|
32
|
+
Metrics/CyclomaticComplexity:
|
33
|
+
Max: 8
|
34
|
+
|
35
|
+
Metrics/PerceivedComplexity:
|
36
|
+
Max: 8
|
37
|
+
|
38
|
+
Metrics/MethodLength:
|
39
|
+
Max: 19
|
40
|
+
|
41
|
+
Metrics/BlockLength:
|
42
|
+
Exclude:
|
43
|
+
- 'spec/**/*.rb'
|
44
|
+
- 'lib/tasks/export_nfes_to_portal.rake'
|
45
|
+
- 'lib/tasks/karma.rake'
|
46
|
+
- 'lib/tasks/backup_restore.rake'
|
47
|
+
|
48
|
+
Style/DateTime:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
Style/Documentation:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Style/FormatStringToken:
|
55
|
+
EnforcedStyle: unannotated
|
56
|
+
|
57
|
+
Style/GuardClause:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
Style/IfUnlessModifier:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Style/SymbolArray:
|
64
|
+
EnforcedStyle: brackets
|
65
|
+
|
66
|
+
Style/HashEachMethods:
|
67
|
+
Enabled: true
|
68
|
+
|
69
|
+
Style/HashTransformKeys:
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
Style/HashTransformValues:
|
73
|
+
Enabled: true
|
74
|
+
|
75
|
+
Layout/LineLength:
|
76
|
+
Max: 150
|
77
|
+
|
78
|
+
Lint/AmbiguousBlockAssociation:
|
79
|
+
Exclude:
|
80
|
+
- 'spec/**/*'
|
81
|
+
|
82
|
+
Metrics/ModuleLength:
|
83
|
+
Max: 118
|
84
|
+
|
85
|
+
Metrics/AbcSize:
|
86
|
+
Max: 50
|
87
|
+
|
88
|
+
Style/FrozenStringLiteralComment:
|
89
|
+
EnforcedStyle: never
|
90
|
+
|
91
|
+
Naming/RescuedExceptionsVariableName:
|
92
|
+
Enabled: false
|
93
|
+
|
94
|
+
Naming/HeredocDelimiterNaming:
|
95
|
+
Enabled: false
|
96
|
+
|
97
|
+
Naming/HeredocDelimiterCase:
|
98
|
+
Enabled: false
|
99
|
+
|
100
|
+
Naming/MethodParameterName:
|
101
|
+
Enabled: false
|
102
|
+
|
103
|
+
Naming/MethodName:
|
104
|
+
Enabled: false
|
105
|
+
|
106
|
+
Naming/VariableName:
|
107
|
+
Enabled: false
|
108
|
+
|
109
|
+
Style/ClassAndModuleChildren:
|
110
|
+
Enabled: false
|
111
|
+
|
112
|
+
Metrics/ParameterLists:
|
113
|
+
Enabled: false
|
data/Gemfile.lock
CHANGED
@@ -1,27 +1,28 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
br_danfe (0.11.
|
4
|
+
br_danfe (0.11.2)
|
5
5
|
barby (= 0.5.1)
|
6
|
-
br_documents (>= 0.
|
6
|
+
br_documents (>= 0.1.3)
|
7
7
|
i18n (>= 0.8.6)
|
8
8
|
nokogiri (>= 1.8)
|
9
|
-
prawn (
|
9
|
+
prawn (~> 2.0)
|
10
10
|
prawn-table (= 0.2.2)
|
11
11
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
-
activemodel (6.0.
|
16
|
-
activesupport (= 6.0.
|
17
|
-
activesupport (6.0.
|
15
|
+
activemodel (6.0.2.1)
|
16
|
+
activesupport (= 6.0.2.1)
|
17
|
+
activesupport (6.0.2.1)
|
18
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
19
|
i18n (>= 0.7, < 2)
|
20
20
|
minitest (~> 5.1)
|
21
21
|
tzinfo (~> 1.1)
|
22
|
-
zeitwerk (~> 2.
|
22
|
+
zeitwerk (~> 2.2)
|
23
|
+
ast (2.4.0)
|
23
24
|
barby (0.5.1)
|
24
|
-
br_documents (0.1.
|
25
|
+
br_documents (0.1.3)
|
25
26
|
activemodel (>= 4.0.0)
|
26
27
|
i18n (>= 0.6.5)
|
27
28
|
byebug (3.5.1)
|
@@ -29,23 +30,29 @@ GEM
|
|
29
30
|
debugger-linecache (~> 1.2)
|
30
31
|
slop (~> 3.6)
|
31
32
|
columnize (0.9.0)
|
32
|
-
concurrent-ruby (1.1.
|
33
|
+
concurrent-ruby (1.1.6)
|
33
34
|
debugger-linecache (1.2.0)
|
34
35
|
diff-lcs (1.3)
|
35
36
|
docile (1.3.2)
|
36
|
-
i18n (1.
|
37
|
+
i18n (1.8.2)
|
37
38
|
concurrent-ruby (~> 1.0)
|
39
|
+
jaro_winkler (1.5.4)
|
38
40
|
json (2.2.0)
|
39
41
|
mini_portile2 (2.4.0)
|
40
|
-
minitest (5.
|
41
|
-
nokogiri (1.10.
|
42
|
+
minitest (5.14.0)
|
43
|
+
nokogiri (1.10.9)
|
42
44
|
mini_portile2 (~> 2.4.0)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
parallel (1.19.1)
|
46
|
+
parser (2.7.0.4)
|
47
|
+
ast (~> 2.4.0)
|
48
|
+
pdf-core (0.7.0)
|
49
|
+
prawn (2.2.2)
|
50
|
+
pdf-core (~> 0.7.0)
|
51
|
+
ttfunk (~> 1.5)
|
47
52
|
prawn-table (0.2.2)
|
48
53
|
prawn (>= 1.3.0, < 3.0.0)
|
54
|
+
psych (3.1.0)
|
55
|
+
rainbow (3.0.0)
|
49
56
|
rake (12.0.0)
|
50
57
|
rspec (3.6.0)
|
51
58
|
rspec-core (~> 3.6.0)
|
@@ -60,6 +67,17 @@ GEM
|
|
60
67
|
diff-lcs (>= 1.2.0, < 2.0)
|
61
68
|
rspec-support (~> 3.6.0)
|
62
69
|
rspec-support (3.6.0)
|
70
|
+
rubocop (0.67.0)
|
71
|
+
jaro_winkler (~> 1.5.1)
|
72
|
+
parallel (~> 1.10)
|
73
|
+
parser (>= 2.5, != 2.5.1.1)
|
74
|
+
psych (>= 3.1.0)
|
75
|
+
rainbow (>= 2.2.2, < 4.0)
|
76
|
+
ruby-progressbar (~> 1.7)
|
77
|
+
unicode-display_width (>= 1.4.0, < 1.6)
|
78
|
+
rubocop-performance (1.1.0)
|
79
|
+
rubocop (>= 0.67.0)
|
80
|
+
ruby-progressbar (1.10.1)
|
63
81
|
simplecov (0.17.0)
|
64
82
|
docile (~> 1.1)
|
65
83
|
json (>= 1.8, < 3)
|
@@ -67,10 +85,11 @@ GEM
|
|
67
85
|
simplecov-html (0.10.1)
|
68
86
|
slop (3.6.0)
|
69
87
|
thread_safe (0.3.6)
|
70
|
-
ttfunk (1.
|
71
|
-
tzinfo (1.2.
|
88
|
+
ttfunk (1.6.2.1)
|
89
|
+
tzinfo (1.2.6)
|
72
90
|
thread_safe (~> 0.1)
|
73
|
-
|
91
|
+
unicode-display_width (1.5.0)
|
92
|
+
zeitwerk (2.3.0)
|
74
93
|
|
75
94
|
PLATFORMS
|
76
95
|
ruby
|
@@ -80,6 +99,8 @@ DEPENDENCIES
|
|
80
99
|
byebug (= 3.5.1)
|
81
100
|
rake (= 12.0.0)
|
82
101
|
rspec (= 3.6.0)
|
102
|
+
rubocop (= 0.67.0)
|
103
|
+
rubocop-performance (~> 1.1.0)
|
83
104
|
simplecov (= 0.17.0)
|
84
105
|
simplecov-html (= 0.10.1)
|
85
106
|
|
data/Rakefile
CHANGED
data/br_danfe.gemspec
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
1
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
2
|
require 'br_danfe/version'
|
5
3
|
|
6
4
|
Gem::Specification.new do |spec|
|
@@ -14,20 +12,22 @@ Gem::Specification.new do |spec|
|
|
14
12
|
|
15
13
|
spec.files = `git ls-files`.split("\n")
|
16
14
|
spec.test_files = `git ls-files -- { test,spec,features }/*`.split("\n")
|
17
|
-
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
15
|
+
spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
18
16
|
spec.require_paths = ['lib']
|
19
|
-
spec.required_ruby_version = '>= 2.1'
|
17
|
+
spec.required_ruby_version = '>= 2.5.1'
|
20
18
|
|
21
19
|
spec.add_dependency 'barby', '0.5.1'
|
22
|
-
spec.add_dependency 'br_documents', '>= 0.
|
20
|
+
spec.add_dependency 'br_documents', '>= 0.1.3'
|
23
21
|
spec.add_dependency 'i18n', '>= 0.8.6'
|
24
22
|
spec.add_dependency 'nokogiri', '>= 1.8'
|
25
|
-
spec.add_dependency 'prawn', '2.
|
23
|
+
spec.add_dependency 'prawn', '~> 2.0'
|
26
24
|
spec.add_dependency 'prawn-table', '0.2.2'
|
27
25
|
|
28
26
|
spec.add_development_dependency 'byebug', '3.5.1'
|
29
27
|
spec.add_development_dependency 'rake', '12.0.0'
|
30
28
|
spec.add_development_dependency 'rspec', '3.6.0'
|
29
|
+
spec.add_development_dependency 'rubocop', '0.67.0'
|
30
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.1.0'
|
31
31
|
spec.add_development_dependency 'simplecov', '0.17.0'
|
32
32
|
spec.add_development_dependency 'simplecov-html', '0.10.1'
|
33
33
|
end
|
data/lib/br_danfe.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
1
|
+
require 'prawn'
|
2
|
+
require 'prawn/measurement_extensions'
|
3
|
+
require 'prawn/table'
|
4
|
+
require 'barby'
|
5
|
+
require 'barby/barcode/code_128'
|
6
|
+
require 'barby/outputter/prawn_outputter'
|
7
|
+
require 'nokogiri'
|
8
|
+
require 'yaml'
|
9
|
+
require 'ostruct'
|
10
|
+
require 'i18n'
|
11
|
+
require 'br_documents'
|
12
|
+
require 'br_danfe/danfe_lib/consts'
|
13
13
|
|
14
|
-
Dir[File.dirname(__FILE__) +
|
15
|
-
I18n.load_path << File.expand_path(
|
14
|
+
Dir[File.dirname(__FILE__) + '/**/*.rb'].sort.each { |f| require f }
|
15
|
+
I18n.load_path << File.expand_path('../config/locales/pt-BR.yml', __dir__)
|
16
16
|
Prawn::Font::AFM.hide_m17n_warning = true
|
data/lib/br_danfe/cce.rb
CHANGED
@@ -15,9 +15,10 @@ module BrDanfe
|
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
18
|
+
|
18
19
|
def nfe_key
|
19
|
-
node = @xml.css(
|
20
|
-
|
20
|
+
node = @xml.css('procEventoNFe > evento > infEvento > chNFe')
|
21
|
+
node ? node.text : ''
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
@@ -13,9 +13,10 @@ module BrDanfe
|
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
16
|
+
|
16
17
|
def correction
|
17
|
-
node = @xml.css(
|
18
|
-
|
18
|
+
node = @xml.css('procEventoNFe > evento > infEvento > detEvento > xCorrecao')
|
19
|
+
node ? node.text : ''
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
@@ -3,22 +3,31 @@ module BrDanfe
|
|
3
3
|
class Document
|
4
4
|
def initialize
|
5
5
|
@document = Prawn::Document.new(
|
6
|
-
page_size:
|
6
|
+
page_size: 'A4',
|
7
7
|
page_layout: :portrait,
|
8
8
|
left_margin: 30,
|
9
9
|
right_margin: 30,
|
10
10
|
top_margin: 30,
|
11
|
-
botton_margin: 30
|
11
|
+
botton_margin: 30
|
12
|
+
)
|
12
13
|
|
13
|
-
@document.font
|
14
|
+
@document.font 'Times-Roman'
|
14
15
|
@document.line_width = 0.3
|
15
16
|
end
|
16
17
|
|
17
18
|
def method_missing(method_name, *args, &block)
|
18
|
-
@document.
|
19
|
+
if @document.respond_to? method_name
|
20
|
+
@document.send method_name, *args, &block
|
21
|
+
else
|
22
|
+
super
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def respond_to_missing?(method_name, include_private = false)
|
27
|
+
@document.respond_to?(method_name, include_private) || super
|
19
28
|
end
|
20
29
|
|
21
|
-
def box(height:, pad:5
|
30
|
+
def box(height:, pad: 5)
|
22
31
|
bounding_box([0, cursor], width: page_width, height: height) do
|
23
32
|
pad(pad) { indent(pad) { yield if block_given? } }
|
24
33
|
stroke_bounds
|
@@ -36,6 +45,7 @@ module BrDanfe
|
|
36
45
|
end
|
37
46
|
|
38
47
|
private
|
48
|
+
|
39
49
|
def page_width
|
40
50
|
page.dimensions[2] - (page.margins[:left] + page.margins[:right])
|
41
51
|
end
|
@@ -8,15 +8,16 @@ module BrDanfe
|
|
8
8
|
|
9
9
|
def render
|
10
10
|
@pdf.box(height: 36) do
|
11
|
-
@pdf.text I18n.t(
|
11
|
+
@pdf.text I18n.t('cce.key'), size: 8, style: :bold
|
12
12
|
@pdf.text nfe_key, pad: 5
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
17
|
+
|
17
18
|
def nfe_key
|
18
|
-
node = @xml.css(
|
19
|
-
|
19
|
+
node = @xml.css('procEventoNFe > evento > infEvento > chNFe')
|
20
|
+
node ? node.text : ''
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|