class Nfe::Models::Taxes::PISCOFINSOutr
Attributes
tax[RW]
value[RW]
Public Class Methods
csts()
click to toggle source
# File lib/nfe/models/taxes/PISCOFINSOutr.rb, line 15 def self.csts ["49", "50", "51", "52", "53", "54", "55", "56", "60", "61", "62", "63", "64", "65", "66", "67", "70", "71", "72", "73", "74", "75", "98", "99"] end
new(xml_tax, xml_value)
click to toggle source
# File lib/nfe/models/taxes/PISCOFINSOutr.rb, line 60 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/PISCOFINSOutr.rb, line 66 def parse!(xml) doc = Nokogiri::XML(xml) parse_elements doc @tax = doc.css(@xml_tax).present? ? doc.css(@xml_tax).text.to_f : nil @value = doc.css(@xml_value).text.to_f end
to_xml()
click to toggle source
# File lib/nfe/models/taxes/PISCOFINSOutr.rb, line 74 def to_xml xml = Builder::XmlMarkup.new add_elements xml, :cst, :vBC xml.tag!(@xml_tax) { |node| node << "%0.2f" % @tax } if @tax.present? add_elements xml, :qBCProd, :vAliqProd xml.tag!(@xml_value) { |node| node << "%0.2f" % @value } xml.target! end