class Nfe::Models::Taxes::PISCOFINSAliq
Attributes
cst[RW]
tax[RW]
vBC[RW]
value[RW]
Public Class Methods
csts()
click to toggle source
# File lib/nfe/models/taxes/PISCOFINSAliq.rb, line 9 def self.csts ["01", "02"] end
new(xml_tax, xml_value)
click to toggle source
# File lib/nfe/models/taxes/PISCOFINSAliq.rb, line 35 def initialize(xml_tax, xml_value) @xml_tax = xml_tax @xml_value = xml_value end
Public Instance Methods
parse!(xml)
click to toggle source
# File lib/nfe/models/taxes/PISCOFINSAliq.rb, line 40 def parse!(xml) doc = Nokogiri::XML(xml) @cst = doc.css("CST").text.to_s @vBC = doc.css("vBC").text.to_f @tax = doc.css(@xml_tax).text.to_f @value = doc.css(@xml_value).text.to_f end
to_xml()
click to toggle source
# File lib/nfe/models/taxes/PISCOFINSAliq.rb, line 49 def to_xml xml = Builder::XmlMarkup.new xml.CST "%2.2d" % @cst xml.vBC "%0.2f" % @vBC xml.tag!(@xml_tax) { |node| node << "%0.2f" % @tax } xml.tag!(@xml_value) { |node| node << "%0.2f" % @value } xml.target! end