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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9577a7166d1dfbba0ad7b57254dd3eb94cfccd4
4
- data.tar.gz: 6a2d44a5c5a7cbcbdd500d6641d53bfe0f19dee1
3
+ metadata.gz: ff10ae8650390cf9fa0ca955882f62ed351abc32
4
+ data.tar.gz: 06a54539828393245b25187749fda6f3148417fb
5
5
  SHA512:
6
- metadata.gz: 62c5560f41f0a6b05e52b5f742b4a0c5398ebb943ec4ac50f6eca6b88e1c5c9d593c20dbf216ec0101f45c1bc2ff54ef433c8ffb312860e6d7e0cb13735a564a
7
- data.tar.gz: a18eaccdafd49ffd652bba05c0fdc50d57ed98aaa218441b9545794317d575b5402286be2e447fc9f3db4cc230531136fcd8b1d516158e742dac071663a4a900
6
+ metadata.gz: 2fbdc2a228a829c53d5519d2fd91dff57ef54dd3ed86cc5309df3849cdd136d2f17a62e96cd2c51c4b0555b03d90ee779b2c5852a46e73d91be2420666030438
7
+ data.tar.gz: a812e114017bbd44ce1663541a9ed18172602fa5ef95e29d40c5b873a678b2d3ffd2c2a2ea1df14052b9d8b9459c1a756c4450897a21956e9484581f26f4d1f7
@@ -1,5 +1,5 @@
1
1
  module Nfe
2
2
  module Reader
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
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.add_dependency "nokogiri"
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.1
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: '0'
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: '0'
68
+ version: 1.6.3.1
55
69
  description: NFe XML Extractor
56
70
  email:
57
71
  - edu.bkr@gmail.com