nfe_reader 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nfe_reader/version.rb +1 -1
- data/lib/nfe_reader.rb +9 -2
- data/nfe-reader.gemspec +2 -1
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff10ae8650390cf9fa0ca955882f62ed351abc32
|
4
|
+
data.tar.gz: 06a54539828393245b25187749fda6f3148417fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fbdc2a228a829c53d5519d2fd91dff57ef54dd3ed86cc5309df3849cdd136d2f17a62e96cd2c51c4b0555b03d90ee779b2c5852a46e73d91be2420666030438
|
7
|
+
data.tar.gz: a812e114017bbd44ce1663541a9ed18172602fa5ef95e29d40c5b873a678b2d3ffd2c2a2ea1df14052b9d8b9459c1a756c4450897a21956e9484581f26f4d1f7
|
data/lib/nfe_reader/version.rb
CHANGED
data/lib/nfe_reader.rb
CHANGED
@@ -14,13 +14,18 @@ module Nfe
|
|
14
14
|
:header, :provider, :customer, :products, :collection, :transport,
|
15
15
|
:purchase, :cane, :export, :delivery, :removal,:enviroment,
|
16
16
|
:version_app, :key, :date, :protocol, :digest, :status, :description,
|
17
|
-
:total, :authorizations
|
17
|
+
:total, :authorizations, :valid
|
18
18
|
|
19
19
|
def initialize(file)
|
20
20
|
xml = Nokogiri::XML(file)
|
21
21
|
|
22
22
|
xml = xml.to_hash
|
23
23
|
|
24
|
+
if xml[:nfeProc].nil?
|
25
|
+
@valid = false
|
26
|
+
return
|
27
|
+
end
|
28
|
+
|
24
29
|
# Versao da NFe
|
25
30
|
@version = xml[:nfeProc][:versao]
|
26
31
|
# Assinatura
|
@@ -121,8 +126,10 @@ module Nfe
|
|
121
126
|
if xml[:cana]
|
122
127
|
@cane = Nfe::Cane.new(xml[:cana])
|
123
128
|
end
|
129
|
+
|
130
|
+
@valid = true
|
124
131
|
ensure
|
125
|
-
file.close
|
132
|
+
file.close if file.respond_to? :close
|
126
133
|
end
|
127
134
|
end
|
128
135
|
end
|
data/nfe-reader.gemspec
CHANGED
@@ -20,5 +20,6 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.6"
|
22
22
|
spec.add_development_dependency "rake"
|
23
|
-
spec.
|
23
|
+
spec.add_development_dependency "turn", "~> 0.9.7"
|
24
|
+
spec.add_dependency "nokogiri", "~> 1.6.3.1"
|
24
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nfe_reader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Becker
|
@@ -38,20 +38,34 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: turn
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.9.7
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.9.7
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: nokogiri
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
61
|
+
version: 1.6.3.1
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
68
|
+
version: 1.6.3.1
|
55
69
|
description: NFe XML Extractor
|
56
70
|
email:
|
57
71
|
- edu.bkr@gmail.com
|