Class: Nfe::Services::Dispatch::ConsSitNFe

Inherits:
Object
  • Object
show all
Extended by:
Enumerize
Includes:
ActiveModel::Model
Defined in:
lib/nfe/services/dispatch/consSitNFe.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(environment, uf, versao, chNFe) ⇒ ConsSitNFe

Returns a new instance of ConsSitNFe.



22
23
24
25
26
27
# File 'lib/nfe/services/dispatch/consSitNFe.rb', line 22

def initialize(environment, uf, versao, chNFe)
  @tpAmb = environment
  @uf = uf
  @versao = versao
  @chNFe = chNFe
end

Instance Attribute Details

#chNFeObject

Returns the value of attribute chNFe.



7
8
9
# File 'lib/nfe/services/dispatch/consSitNFe.rb', line 7

def chNFe
  @chNFe
end

#ufObject

Returns the value of attribute uf.



7
8
9
# File 'lib/nfe/services/dispatch/consSitNFe.rb', line 7

def uf
  @uf
end

#versaoObject

Returns the value of attribute versao.



7
8
9
# File 'lib/nfe/services/dispatch/consSitNFe.rb', line 7

def versao
  @versao
end

Instance Method Details

#to_xmlObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/nfe/services/dispatch/consSitNFe.rb', line 29

def to_xml
  xml = Builder::XmlMarkup.new

  xml.consSitNFe(xmlns: Models::NFe.namespace, versao: versao ) do |cons|
    cons.tpAmb tpAmb_value
    cons.xServ "CONSULTAR"
    cons.chNFe @chNFe
  end

  xml.target!
end