Class: Nfe::Services::Regress::RetEvento
- Inherits:
-
Object
- Object
- Nfe::Services::Regress::RetEvento
- Extended by:
- Enumerize
- Includes:
- ActiveModel::Model, Helpers::XmlModel::NfeModel
- Defined in:
- lib/nfe/services/regress/retEvento.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#signature ⇒ Object
Returns the value of attribute signature.
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.
24 25 26 |
# File 'lib/nfe/services/regress/retEvento.rb', line 24 def id @id end |
#signature ⇒ Object
Returns the value of attribute signature.
24 25 26 |
# File 'lib/nfe/services/regress/retEvento.rb', line 24 def signature @signature end |
Instance Method Details
#parse!(xml) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/nfe/services/regress/retEvento.rb', line 30 def parse!(xml) doc = Nokogiri::XML(xml) parse_elements doc if doc.css("infEvento").attribute("Id").present? @id = doc.css("infEvento").attribute("Id").text end signature = doc.xpath("//ds:Signature", ds: Models::Signature.namespace) @signature.parse!(signature.to_xml) if signature.present? end |
#to_xml ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/nfe/services/regress/retEvento.rb', line 43 def to_xml xml = Builder::XmlMarkup.new xml.retEvento(versao: versao) do |root| attributes = {} attributes[:Id] = id if id.present? root.infEvento(attributes) do |node| add_elements node end end xml.target! end |