Class: Nfe::Models::Taxes::PISCOFINS
- Inherits:
-
Object
- Object
- Nfe::Models::Taxes::PISCOFINS
- Includes:
- ActiveModel::Model
- Defined in:
- lib/nfe/models/taxes/PISCOFINS.rb
Instance Attribute Summary collapse
-
#cst ⇒ Object
Returns the value of attribute cst.
-
#qBCProd ⇒ Object
Returns the value of attribute qBCProd.
-
#tax ⇒ Object
Returns the value of attribute tax.
-
#vAliqProd ⇒ Object
Returns the value of attribute vAliqProd.
-
#value ⇒ Object
Returns the value of attribute value.
-
#vBC ⇒ Object
Returns the value of attribute vBC.
Instance Method Summary collapse
-
#initialize(type) ⇒ PISCOFINS
constructor
A new instance of PISCOFINS.
- #parse!(xml) ⇒ Object
- #present? ⇒ Boolean
- #to_xml ⇒ Object
Constructor Details
#initialize(type) ⇒ PISCOFINS
17 18 19 20 21 22 23 |
# File 'lib/nfe/models/taxes/PISCOFINS.rb', line 17 def initialize(type) if type == "cofins" @type = "COFINS" else @type = "PIS" end end |
Instance Attribute Details
#cst ⇒ Object
Returns the value of attribute cst.
7 8 9 |
# File 'lib/nfe/models/taxes/PISCOFINS.rb', line 7 def cst @cst end |
#qBCProd ⇒ Object
Returns the value of attribute qBCProd.
7 8 9 |
# File 'lib/nfe/models/taxes/PISCOFINS.rb', line 7 def qBCProd @qBCProd end |
#tax ⇒ Object
Returns the value of attribute tax.
7 8 9 |
# File 'lib/nfe/models/taxes/PISCOFINS.rb', line 7 def tax @tax end |
#vAliqProd ⇒ Object
Returns the value of attribute vAliqProd.
7 8 9 |
# File 'lib/nfe/models/taxes/PISCOFINS.rb', line 7 def vAliqProd @vAliqProd end |
#value ⇒ Object
Returns the value of attribute value.
7 8 9 |
# File 'lib/nfe/models/taxes/PISCOFINS.rb', line 7 def value @value end |
#vBC ⇒ Object
Returns the value of attribute vBC.
7 8 9 |
# File 'lib/nfe/models/taxes/PISCOFINS.rb', line 7 def vBC @vBC end |
Instance Method Details
#parse!(xml) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/nfe/models/taxes/PISCOFINS.rb', line 30 def parse!(xml) doc = Nokogiri::XML(xml) reset_values parse_when_aliq(doc) parse_when_qtde(doc) parse_when_nt(doc) parse_when_outr(doc) end |
#present? ⇒ Boolean
25 26 27 28 |
# File 'lib/nfe/models/taxes/PISCOFINS.rb', line 25 def present? @cst.present? || @vBC.present? || @tax.present? || @qBCProd.present? || @vAliqProd.present? || @qBCProd.present? end |
#to_xml ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/nfe/models/taxes/PISCOFINS.rb', line 40 def to_xml xml = Builder::XmlMarkup.new to_xml_when_aliq(xml) to_xml_when_qtde(xml) to_xml_when_nt(xml) to_xml_when_outr(xml) xml.target! end |