Class: Nfe::Models::Taxes::ICMS

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/nfe/models/taxes/ICMS.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cstObject

Returns the value of attribute cst.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def cst
  @cst
end

#modBCObject

Returns the value of attribute modBC.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def modBC
  @modBC
end

#modBCSTObject

Returns the value of attribute modBCST.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def modBCST
  @modBCST
end

#motDesICMSObject

Returns the value of attribute motDesICMS.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def motDesICMS
  @motDesICMS
end

#origObject

Returns the value of attribute orig.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def orig
  @orig
end

#pCredSNObject

Returns the value of attribute pCredSN.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def pCredSN
  @pCredSN
end

#pICMSObject

Returns the value of attribute pICMS.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def pICMS
  @pICMS
end

#pICMSSTObject

Returns the value of attribute pICMSST.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def pICMSST
  @pICMSST
end

#pMVASTObject

Returns the value of attribute pMVAST.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def pMVAST
  @pMVAST
end

#pRedBCObject

Returns the value of attribute pRedBC.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def pRedBC
  @pRedBC
end

#pRedBCSTObject

Returns the value of attribute pRedBCST.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def pRedBCST
  @pRedBCST
end

#vBCObject

Returns the value of attribute vBC.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def vBC
  @vBC
end

#vBCSTObject

Returns the value of attribute vBCST.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def vBCST
  @vBCST
end

#vBCSTRetObject

Returns the value of attribute vBCSTRet.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def vBCSTRet
  @vBCSTRet
end

#vCredICMSSNObject

Returns the value of attribute vCredICMSSN.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def vCredICMSSN
  @vCredICMSSN
end

#vICMSObject

Returns the value of attribute vICMS.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def vICMS
  @vICMS
end

#vICMSDesonObject

Returns the value of attribute vICMSDeson.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def vICMSDeson
  @vICMSDeson
end

#vICMSSTObject

Returns the value of attribute vICMSST.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def vICMSST
  @vICMSST
end

#vICMSSTRetObject

Returns the value of attribute vICMSSTRet.



19
20
21
# File 'lib/nfe/models/taxes/ICMS.rb', line 19

def vICMSSTRet
  @vICMSSTRet
end

Class Method Details

.attr_icmsObject



7
8
9
10
11
# File 'lib/nfe/models/taxes/ICMS.rb', line 7

def self.attr_icms
  [:orig, :csosn, :cst, :modBC, :vBC, :pRedBC, :pICMS, :vICMS, :modBCST,
    :pMVAST, :pRedBCST, :vBCST, :pICMSST, :vICMSST, :pCredSN,
    :vCredICMSSN, :motDesICMS, :vBCSTRet, :vICMSSTRet, :vICMSDeson]
end

.cst_typesObject



13
14
15
16
17
# File 'lib/nfe/models/taxes/ICMS.rb', line 13

def self.cst_types
  ["00", "10", "20", "30", "40", "41", "50", "51", "60",
    "70", "90", "101", "102", "103", "300", "400", "201", "202", "203", "500",
    "900"]
end

Instance Method Details

#parse!(xml) ⇒ Object



36
37
38
39
40
# File 'lib/nfe/models/taxes/ICMS.rb', line 36

def parse!(xml)
  doc = Nokogiri::XML(xml)
  reset_values
  parse_xml(doc)
end

#present?Boolean

Returns:

  • (Boolean)


29
30
31
32
33
34
# File 'lib/nfe/models/taxes/ICMS.rb', line 29

def present?
  [@orig, @cst, @modBC, @vBC, @pRedBC, @pICMS, @vICMS, @modBCST,
    @pMVAST, @pRedBCST, @vBCST, @pICMSST, @vICMSST, @pCredSN,
    @vCredICMSSN, @motDesICMS, @vBCSTRet, @vICMSSTRet].
      reduce(false) {|memo, obj| memo || obj.present?}
end

#to_xmlObject



42
43
44
45
46
47
48
# File 'lib/nfe/models/taxes/ICMS.rb', line 42

def to_xml
  xml = Builder::XmlMarkup.new

  to_object_xml(xml)

  xml.target!
end