Class: NFe::NotaFiscal
- Inherits:
-
EntidadeNFe
- Object
- EntidadeNFe
- NFe::NotaFiscal
- Defined in:
- lib/nfe/entidades/infNFe/nota_fiscal.rb
Instance Attribute Summary collapse
-
#dest ⇒ Object
Returns the value of attribute dest.
-
#emit ⇒ Object
Returns the value of attribute emit.
-
#ide ⇒ Object
Returns the value of attribute ide.
-
#info ⇒ Object
Returns the value of attribute info.
-
#infoProt ⇒ Object
Returns the value of attribute infoProt.
-
#prod ⇒ Object
Returns the value of attribute prod.
-
#transp ⇒ Object
Returns the value of attribute transp.
-
#veiculo ⇒ Object
Returns the value of attribute veiculo.
-
#vol ⇒ Object
Returns the value of attribute vol.
Instance Method Summary collapse
Methods inherited from EntidadeNFe
nfe_attr, #nfe_attributes, nfe_attrs, #serialize, #to_nfe, #to_nfe_xml, #to_xml, xml_accessor, #xml_to_hash
Instance Attribute Details
#dest ⇒ Object
Returns the value of attribute dest.
8 9 10 |
# File 'lib/nfe/entidades/infNFe/nota_fiscal.rb', line 8 def dest @dest end |
#emit ⇒ Object
Returns the value of attribute emit.
7 8 9 |
# File 'lib/nfe/entidades/infNFe/nota_fiscal.rb', line 7 def emit @emit end |
#ide ⇒ Object
Returns the value of attribute ide.
6 7 8 |
# File 'lib/nfe/entidades/infNFe/nota_fiscal.rb', line 6 def ide @ide end |
#info ⇒ Object
Returns the value of attribute info.
13 14 15 |
# File 'lib/nfe/entidades/infNFe/nota_fiscal.rb', line 13 def info @info end |
#infoProt ⇒ Object
Returns the value of attribute infoProt.
14 15 16 |
# File 'lib/nfe/entidades/infNFe/nota_fiscal.rb', line 14 def infoProt @infoProt end |
#prod ⇒ Object
Returns the value of attribute prod.
9 10 11 |
# File 'lib/nfe/entidades/infNFe/nota_fiscal.rb', line 9 def prod @prod end |
#transp ⇒ Object
Returns the value of attribute transp.
10 11 12 |
# File 'lib/nfe/entidades/infNFe/nota_fiscal.rb', line 10 def transp @transp end |
#veiculo ⇒ Object
Returns the value of attribute veiculo.
11 12 13 |
# File 'lib/nfe/entidades/infNFe/nota_fiscal.rb', line 11 def veiculo @veiculo end |
#vol ⇒ Object
Returns the value of attribute vol.
12 13 14 |
# File 'lib/nfe/entidades/infNFe/nota_fiscal.rb', line 12 def vol @vol end |
Instance Method Details
#initializer ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/nfe/entidades/infNFe/nota_fiscal.rb', line 16 def initializer #@versao_processo_emissao = Nfe::Config::Params::VERSAO_PADRAO @ide = NFe::IdentificacaoNFe.new @emit = NFe::Emitente.new @emit.endereco_emitente = NFe::EnderecoEmitente.new @dest = NFe::Destinatario.new @dest.endereco_destinatario = NFe::EnderecoDesinatario.new @prod = [] @transp = NFe::Transportadora.new @veiculo = NFe::Veiculo.new @vol = NFe::Volume.new @info = NFe::Info.new @infoProt = NFe::InfoProtocolo.new @versao = '2.0' #criar uma constante em params da versao da NF-e end |
#load_xml_serealize(file) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/nfe/entidades/infNFe/nota_fiscal.rb', line 32 def load_xml_serealize(file) doc = Nokogiri::XML(File.open(file)) self.ide = NFe::IdentificacaoNFe.new self.emit = NFe::Emitente.new self.dest = NFe::Destinatario.new self.emit.endereco_emitente = NFe::EnderecoEmitente.new self.transp = NFe::Transportadora.new self.veiculo = NFe::Veiculo.new self.vol = NFe::Volume.new self.info = NFe::Info.new self.infoProt = NFe::InfoProtocolo.new produto = Produto.new produto.xml_to_hash(file) self.ide.serialize(@ide.xml_to_hash(doc.elements.css('ide'))) self.emit.serialize(@emit.xml_to_hash(doc.elements.css('emit'))) self.emit.endereco_emitente = NFe::EnderecoEmitente.new.xml_to_hash(doc.elements.css('emit')) self.dest.serialize(@dest.xml_to_hash(doc.elements.css('dest'))) self.dest.endereco_destinatario = NFe::EnderecoDestinatario.new.xml_to_hash(doc.elements.css('dest')) self.transp.serialize(@transp.xml_to_hash(doc.elements.css('transp/transporta'))) self.veiculo.serialize(@veiculo.xml_to_hash(doc.elements.css('transp/veicTransp'))) self.vol.serialize(@vol.xml_to_hash(doc.elements.css('transp/vol'))) self.info.serialize(@info.xml_to_hash(doc.elements.css('infAdic'))) self.infoProt.serialize(@infoProt.xml_to_hash(doc.elements.css('protNFe/infProt'))) self.prod = produto.all_products self end |