nfe_reader 1.0.2 → 1.0.3
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 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 045adfe5a0e11fa9b1a661523ffa243276c0afac
|
4
|
+
data.tar.gz: 674f22af409a640a8e504e1e5ab66d8f6185587f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0a54ed483a156ba868daf2a36136bdae9b01ab7a22a0defcdea28bd2ab92453c0041a32dcea1c4de66491a869764ab4f27483f253f4bcadf6d76e5728d19bbe
|
7
|
+
data.tar.gz: 705395d6f7a1e32c16bd9c5f9c002d40171f379470b690213eccc1d44efa88ddf8878a336f2a4c83eac84da443cef74a55ff203d8902cd57d2f5dcb6d6bc166d
|
data/lib/nfe_reader/version.rb
CHANGED
data/lib/nfe_reader.rb
CHANGED
@@ -14,17 +14,10 @@ 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, :error, :trace
|
18
18
|
|
19
19
|
def initialize(file)
|
20
|
-
xml = Nokogiri::XML(file)
|
21
|
-
|
22
|
-
xml = xml.to_hash
|
23
|
-
|
24
|
-
if xml[:nfeProc].nil?
|
25
|
-
@valid = false
|
26
|
-
return
|
27
|
-
end
|
20
|
+
xml = Nokogiri::XML(file).to_hash
|
28
21
|
|
29
22
|
# Versao da NFe
|
30
23
|
@version = xml[:nfeProc][:versao]
|
@@ -127,10 +120,16 @@ module Nfe
|
|
127
120
|
@cane = Nfe::Cane.new(xml[:cana])
|
128
121
|
end
|
129
122
|
|
130
|
-
|
123
|
+
rescue => exception
|
124
|
+
@error = exception
|
125
|
+
@trace = exception.backtrace
|
131
126
|
ensure
|
132
127
|
file.close if file.respond_to? :close
|
133
128
|
end
|
129
|
+
|
130
|
+
def error?
|
131
|
+
!error.nil?
|
132
|
+
end
|
134
133
|
end
|
135
134
|
end
|
136
135
|
end
|