Class: Facturapi::Services::Responses::Procesar

Inherits:
Object
  • Object
show all
Defined in:
lib/facturapi/services/responses/procesar.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#responseObject (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

#errorObject



15
16
17
# File 'lib/facturapi/services/responses/procesar.rb', line 15

def error
  response.css('Documento>Error').text
end

#fechaObject



27
28
29
# File 'lib/facturapi/services/responses/procesar.rb', line 27

def fecha
  Time.strptime(response.css('Documento>Fecha').text, '%FT%T')
end

#folioObject



19
20
21
# File 'lib/facturapi/services/responses/procesar.rb', line 19

def folio
  response.css('Documento>Folio').text.to_i
end

#tipo_dteObject



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

Returns:

  • (Boolean)


11
12
13
# File 'lib/facturapi/services/responses/procesar.rb', line 11

def valid?
  response.css('WSPLANO>Resultado').text == 'True'
end