Class: FE::Document::Reference
- Inherits:
-
Object
- Object
- FE::Document::Reference
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/facturacr/document/reference.rb
Constant Summary collapse
- REFERENCE_CODES =
{ "01" => "Anula Documento de referencia", "02" => "Corrige texto documento de referencia", "03" => "Corrige monto", "04" => "Referencia a otro documento", "05" => "Sustituye comprobante provisional por contingencia", "99" => "Otros" }
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#date ⇒ Object
Returns the value of attribute date.
-
#document_type ⇒ Object
Returns the value of attribute document_type.
-
#number ⇒ Object
Returns the value of attribute number.
-
#reason ⇒ Object
Returns the value of attribute reason.
Instance Method Summary collapse
- #build_xml(node) ⇒ Object
-
#initialize(args = {}) ⇒ Reference
constructor
A new instance of Reference.
Constructor Details
#initialize(args = {}) ⇒ Reference
Returns a new instance of Reference.
25 26 27 28 29 30 31 |
# File 'lib/facturacr/document/reference.rb', line 25 def initialize(args={}) @document_type = args[:document_type] @number = args[:number] @date = args[:date] @code = args[:code] @reason = args[:reason] end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
8 9 10 |
# File 'lib/facturacr/document/reference.rb', line 8 def code @code end |
#date ⇒ Object
Returns the value of attribute date.
8 9 10 |
# File 'lib/facturacr/document/reference.rb', line 8 def date @date end |
#document_type ⇒ Object
Returns the value of attribute document_type.
8 9 10 |
# File 'lib/facturacr/document/reference.rb', line 8 def document_type @document_type end |
#number ⇒ Object
Returns the value of attribute number.
8 9 10 |
# File 'lib/facturacr/document/reference.rb', line 8 def number @number end |
#reason ⇒ Object
Returns the value of attribute reason.
8 9 10 |
# File 'lib/facturacr/document/reference.rb', line 8 def reason @reason end |
Instance Method Details
#build_xml(node) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/facturacr/document/reference.rb', line 33 def build_xml(node) raise "Reference Invalid: #{errors.}" unless valid? node = Nokogiri::XML::Builder.new if node.nil? node.InformacionReferencia do |xml| xml.TipoDoc @document_type xml.Numero @number xml.FechaEmision @date.xmlschema xml.Codigo @code xml.Razon @reason end end |