Class: RubyXmlNfe::Prod

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml, params) ⇒ Prod

Returns a new instance of Prod.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ruby_xml_nfe/prod.rb', line 6

def initialize(xml, params)
  @xml = xml

  @cProd = params[:cProd]
  @cEAN = params[:cEAN]
  @xProd = params[:xProd]
  @ncm = params[:NCM]
  @cest = params[:CEST]
  @cfop = params[:CFOP]
  @uCom = params[:uCom]
  @qCom = params[:qCom]
  @vUnCom = params[:vUnCom]
  @vProd = params[:vProd]
  @cEANTrib = params[:cEANTrib]
  @uTrib = params[:uTrib]
  @qTrib = params[:qTrib]
  @vUnTrib = params[:vUnTrib]
  @indTot = params[:indTot]
  @xPed = params[:xPed]
  @nItemPed = params[:nItemPed]
  @nFCI = params[:nFCI]
end

Instance Attribute Details

#cEANObject (readonly)

Returns the value of attribute cEAN.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def cEAN
  @cEAN
end

#cEANTribObject (readonly)

Returns the value of attribute cEANTrib.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def cEANTrib
  @cEANTrib
end

#cestObject (readonly)

Returns the value of attribute cest.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def cest
  @cest
end

#cfopObject (readonly)

Returns the value of attribute cfop.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def cfop
  @cfop
end

#cProdObject (readonly)

Returns the value of attribute cProd.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def cProd
  @cProd
end

#indTotObject (readonly)

Returns the value of attribute indTot.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def indTot
  @indTot
end

#ncmObject (readonly)

Returns the value of attribute ncm.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def ncm
  @ncm
end

#nFCIObject (readonly)

Returns the value of attribute nFCI.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def nFCI
  @nFCI
end

#nItemPedObject (readonly)

Returns the value of attribute nItemPed.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def nItemPed
  @nItemPed
end

#qComObject (readonly)

Returns the value of attribute qCom.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def qCom
  @qCom
end

#qTribObject (readonly)

Returns the value of attribute qTrib.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def qTrib
  @qTrib
end

#uComObject (readonly)

Returns the value of attribute uCom.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def uCom
  @uCom
end

#uTribObject (readonly)

Returns the value of attribute uTrib.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def uTrib
  @uTrib
end

#vProdObject (readonly)

Returns the value of attribute vProd.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def vProd
  @vProd
end

#vUnComObject (readonly)

Returns the value of attribute vUnCom.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def vUnCom
  @vUnCom
end

#vUnTribObject (readonly)

Returns the value of attribute vUnTrib.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def vUnTrib
  @vUnTrib
end

#xmlObject (readonly)

Returns the value of attribute xml.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def xml
  @xml
end

#xPedObject (readonly)

Returns the value of attribute xPed.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def xPed
  @xPed
end

#xProdObject (readonly)

Returns the value of attribute xProd.



3
4
5
# File 'lib/ruby_xml_nfe/prod.rb', line 3

def xProd
  @xProd
end

Instance Method Details

#buildObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ruby_xml_nfe/prod.rb', line 29

def build
  xml.prod do
    xml.cProd cProd
    xml.cEAN cEAN
    xml.xProd xProd
    xml.NCM ncm
    xml.CEST cest if cest
    xml.CFOP cfop
    xml.uCom uCom
    xml.qCom qCom
    xml.vUnCom vUnCom
    xml.vProd vProd
    xml.cEANTrib cEANTrib
    xml.uTrib uTrib
    xml.qTrib qTrib
    xml.vUnTrib vUnTrib
    xml.indTot indTot
    xml.xPed xPed if xPed
    xml.nItemPed nItemPed if nItemPed
    xml.nFCI nFCI if nFCI
  end
end