Class: Facturapi::Services::Responses::Procesar
- Inherits:
-
Object
- Object
- Facturapi::Services::Responses::Procesar
- Defined in:
- lib/facturapi/services/responses/procesar.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #error ⇒ Object
- #fecha ⇒ Object
- #folio ⇒ Object
-
#initialize(response) ⇒ Procesar
constructor
A new instance of Procesar.
- #tipo_dte ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Procesar
Returns a new instance of Procesar.
7 8 9 |
# File 'lib/facturapi/services/responses/procesar.rb', line 7 def initialize(response) @response = Nokogiri::XML(response) end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/facturapi/services/responses/procesar.rb', line 5 def response @response end |
Instance Method Details
#error ⇒ Object
15 16 17 |
# File 'lib/facturapi/services/responses/procesar.rb', line 15 def error response.css('Documento>Error').text end |
#fecha ⇒ Object
27 28 29 |
# File 'lib/facturapi/services/responses/procesar.rb', line 27 def fecha Time.strptime(response.css('Documento>Fecha').text, '%FT%T') end |
#folio ⇒ Object
19 20 21 |
# File 'lib/facturapi/services/responses/procesar.rb', line 19 def folio response.css('Documento>Folio').text.to_i end |
#tipo_dte ⇒ Object
23 24 25 |
# File 'lib/facturapi/services/responses/procesar.rb', line 23 def tipo_dte response.css('Documento>TipoDte').text.to_i end |
#valid? ⇒ Boolean
11 12 13 |
# File 'lib/facturapi/services/responses/procesar.rb', line 11 def valid? response.css('WSPLANO>Resultado').text == 'True' end |