Class: BrNfe::Product::Reader::Nfe

Inherits:
ActiveModelBase show all
Defined in:
lib/br_nfe/product/reader/nfe.rb

Instance Attribute Summary

Attributes inherited from ActiveModelBase

#reference

Instance Method Summary collapse

Methods inherited from ActiveModelBase

#assign_attributes, #default_values

Constructor Details

#initialize(xml) ⇒ Nfe

Returns a new instance of Nfe.



5
6
7
8
9
10
11
12
# File 'lib/br_nfe/product/reader/nfe.rb', line 5

def initialize xml
  @xml = Nokogiri::XML xml
  @xml_version = find_xml_version
  @xml_nfe = @xml.css("NFe")
  @invoice = BrNfe::Product::NotaFiscal.new
  populate_invoice!
  @invoice
end

Instance Method Details

#invoiceObject



13
14
15
# File 'lib/br_nfe/product/reader/nfe.rb', line 13

def invoice
  @invoice
end

#xml_versionObject



17
18
19
# File 'lib/br_nfe/product/reader/nfe.rb', line 17

def xml_version
  @xml_version
end