Class: Cfdi40::XmlLoader
- Inherits:
-
Object
- Object
- Cfdi40::XmlLoader
- Defined in:
- lib/cfdi40/xml_loader.rb
Instance Attribute Summary collapse
-
#cfdi ⇒ Object
readonly
Returns the value of attribute cfdi.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#xml_doc ⇒ Object
readonly
Returns the value of attribute xml_doc.
Instance Method Summary collapse
-
#initialize(xml_string, mode) ⇒ XmlLoader
constructor
A new instance of XmlLoader.
Constructor Details
#initialize(xml_string, mode) ⇒ XmlLoader
Returns a new instance of XmlLoader.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cfdi40/xml_loader.rb', line 9 def initialize(xml_string, mode) @xml_doc = Nokogiri::XML(xml_string) @mode = mode # TODO. validar versión del CFDI definido en xml_doc @cfdi = Cfdi40::Comprobante.new @cfdi.load_from_ng_node(xml_doc.root) @cfdi.load_cert load_emisor load_receptor load_conceptos load_impuestos load_pagos load_tfd @cfdi.lock if readonly? @cfdi.loaded_xml = xml_string @cfdi end |
Instance Attribute Details
#cfdi ⇒ Object (readonly)
Returns the value of attribute cfdi.
7 8 9 |
# File 'lib/cfdi40/xml_loader.rb', line 7 def cfdi @cfdi end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
7 8 9 |
# File 'lib/cfdi40/xml_loader.rb', line 7 def mode @mode end |
#xml_doc ⇒ Object (readonly)
Returns the value of attribute xml_doc.
7 8 9 |
# File 'lib/cfdi40/xml_loader.rb', line 7 def xml_doc @xml_doc end |