Class: Nfe::Services::Regress::RetInutNFe
- Inherits:
-
Object
- Object
- Nfe::Services::Regress::RetInutNFe
- Extended by:
- Enumerize
- Includes:
- ActiveModel::Model, Helpers::XmlModel::NfeModel
- Defined in:
- lib/nfe/services/regress/retInutNFe.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
Methods included from Helpers::XmlModel::NfeModel
#add_elements, #check_present, included, #parse_elements, #present?, #validate_optional_attributes, #validate_required_attributes
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
23 24 25 |
# File 'lib/nfe/services/regress/retInutNFe.rb', line 23 def id @id end |
Instance Method Details
#parse!(xml) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# 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 ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# 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 |