Class: RubyXmlNfe::Emit

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_xml_nfe/emit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml, params) ⇒ Emit

Returns a new instance of Emit.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ruby_xml_nfe/emit.rb', line 8

def initialize(xml, params)
  @xml = xml
  @cnpj = params[:CNPJ]
  @xNome = params[:xNome]
  @xFant = params[:xFant]
  @ender_emit_params = params[:enderEmit]
  @ie = params[:IE]
  @im = params[:IM]
  @cnae = params[:CNAE]
  @crt = params[:CRT]
end

Instance Attribute Details

#cnaeObject (readonly)

Returns the value of attribute cnae.



6
7
8
# File 'lib/ruby_xml_nfe/emit.rb', line 6

def cnae
  @cnae
end

#cnpjObject (readonly)

Returns the value of attribute cnpj.



6
7
8
# File 'lib/ruby_xml_nfe/emit.rb', line 6

def cnpj
  @cnpj
end

#crtObject (readonly)

Returns the value of attribute crt.



6
7
8
# File 'lib/ruby_xml_nfe/emit.rb', line 6

def crt
  @crt
end

#ender_emit_paramsObject (readonly)

Returns the value of attribute ender_emit_params.



6
7
8
# File 'lib/ruby_xml_nfe/emit.rb', line 6

def ender_emit_params
  @ender_emit_params
end

#ieObject (readonly)

Returns the value of attribute ie.



6
7
8
# File 'lib/ruby_xml_nfe/emit.rb', line 6

def ie
  @ie
end

#imObject (readonly)

Returns the value of attribute im.



6
7
8
# File 'lib/ruby_xml_nfe/emit.rb', line 6

def im
  @im
end

#xFantObject (readonly)

Returns the value of attribute xFant.



6
7
8
# File 'lib/ruby_xml_nfe/emit.rb', line 6

def xFant
  @xFant
end

#xmlObject (readonly)

Returns the value of attribute xml.



6
7
8
# File 'lib/ruby_xml_nfe/emit.rb', line 6

def xml
  @xml
end

#xNomeObject (readonly)

Returns the value of attribute xNome.



6
7
8
# File 'lib/ruby_xml_nfe/emit.rb', line 6

def xNome
  @xNome
end

Instance Method Details

#buildObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ruby_xml_nfe/emit.rb', line 20

def build
  xml.emit do
    xml.CNPJ cnpj
    xml.xNome xNome
    xml.xFant xFant

    ender_emit = RubyXmlNfe::EnderEmit.new(xml, ender_emit_params)
    ender_emit.build

    xml.IE ie
    xml.IM im if im
    xml.CNAE cnae if cnae
    xml.CRT crt
  end
end