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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff10ae8650390cf9fa0ca955882f62ed351abc32
4
- data.tar.gz: 06a54539828393245b25187749fda6f3148417fb
3
+ metadata.gz: 045adfe5a0e11fa9b1a661523ffa243276c0afac
4
+ data.tar.gz: 674f22af409a640a8e504e1e5ab66d8f6185587f
5
5
  SHA512:
6
- metadata.gz: 2fbdc2a228a829c53d5519d2fd91dff57ef54dd3ed86cc5309df3849cdd136d2f17a62e96cd2c51c4b0555b03d90ee779b2c5852a46e73d91be2420666030438
7
- data.tar.gz: a812e114017bbd44ce1663541a9ed18172602fa5ef95e29d40c5b873a678b2d3ffd2c2a2ea1df14052b9d8b9459c1a756c4450897a21956e9484581f26f4d1f7
6
+ metadata.gz: c0a54ed483a156ba868daf2a36136bdae9b01ab7a22a0defcdea28bd2ab92453c0041a32dcea1c4de66491a869764ab4f27483f253f4bcadf6d76e5728d19bbe
7
+ data.tar.gz: 705395d6f7a1e32c16bd9c5f9c002d40171f379470b690213eccc1d44efa88ddf8878a336f2a4c83eac84da443cef74a55ff203d8902cd57d2f5dcb6d6bc166d
@@ -1,5 +1,5 @@
1
1
  module Nfe
2
2
  module Reader
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
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, :valid
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
- @valid = true
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
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.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Becker