class Nfe::Services::Regress::RetInutNFe

Attributes

id[RW]

Public Instance Methods

parse!(xml) click to toggle source
# File lib/nfe/services/regress/retInutNFe.rb, line 29
def parse!(xml)
  doc = Nokogiri::XML(xml)

  if doc.css("infInut").attribute("Id").present?
    @id = doc.css("infInut").attribute("Id").text
  end

  parse_elements doc
end
to_xml() click to toggle source
# File lib/nfe/services/regress/retInutNFe.rb, line 39
def to_xml
  xml = Builder::XmlMarkup.new

  xml.retInutNFe(versao: versao) do |root|
    attributes = {}
    attributes[:Id] = @id if @id.present?

    root.infInut(attributes) do |node|
      add_elements node
    end
  end

  xml.target!
end