Class: RubyXmlNfe::Imposto

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml, params) ⇒ Imposto

Returns a new instance of Imposto.



11
12
13
14
15
16
17
18
# File 'lib/ruby_xml_nfe/imposto.rb', line 11

def initialize(xml, params)
  @xml = xml
  @icms_params = params[:ICMS]
  @ipi_params = params[:IPI]
  @ii_params = params[:II]
  @pis_params = params[:PIS]
  @cofins_params = params[:COFINS]
end

Instance Attribute Details

#cofins_paramsObject (readonly)

Returns the value of attribute cofins_params.



9
10
11
# File 'lib/ruby_xml_nfe/imposto.rb', line 9

def cofins_params
  @cofins_params
end

#icms_paramsObject (readonly)

Returns the value of attribute icms_params.



9
10
11
# File 'lib/ruby_xml_nfe/imposto.rb', line 9

def icms_params
  @icms_params
end

#ii_paramsObject (readonly)

Returns the value of attribute ii_params.



9
10
11
# File 'lib/ruby_xml_nfe/imposto.rb', line 9

def ii_params
  @ii_params
end

#ipi_paramsObject (readonly)

Returns the value of attribute ipi_params.



9
10
11
# File 'lib/ruby_xml_nfe/imposto.rb', line 9

def ipi_params
  @ipi_params
end

#pis_paramsObject (readonly)

Returns the value of attribute pis_params.



9
10
11
# File 'lib/ruby_xml_nfe/imposto.rb', line 9

def pis_params
  @pis_params
end

#xmlObject (readonly)

Returns the value of attribute xml.



9
10
11
# File 'lib/ruby_xml_nfe/imposto.rb', line 9

def xml
  @xml
end

Instance Method Details

#buildObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/ruby_xml_nfe/imposto.rb', line 20

def build
  xml.imposto do
    icms = RubyXmlNfe::Icms.new(xml, icms_params)
    icms.build

    if ipi_params
      ipi = RubyXmlNfe::Ipi.new(xml, ipi_params)
      ipi.build
    end

    if ii_params
      ii = RubyXmlNfe::Ii.new(xml, ii_params)
      ii.build
    end

    if pis_params
      pis = RubyXmlNfe::Pis.new(xml, pis_params)
      pis.build
    end

    if cofins_params
      cofins = RubyXmlNfe::Cofins.new(xml, cofins_params)
      cofins.build
    end
  end
end