Class: Facturapi::Service::Procesar
- Inherits:
-
Object
- Object
- Facturapi::Service::Procesar
- Defined in:
- lib/facturapi/service/procesar.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#dte ⇒ Object
Returns the value of attribute dte.
Instance Method Summary collapse
-
#initialize(dte) ⇒ Procesar
constructor
A new instance of Procesar.
- #send ⇒ Object
Constructor Details
#initialize(dte) ⇒ Procesar
Returns a new instance of Procesar.
7 8 9 10 |
# File 'lib/facturapi/service/procesar.rb', line 7 def initialize(dte) @dte = dte @client = Facturapi::Client.new end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/facturapi/service/procesar.rb', line 5 def client @client end |
#dte ⇒ Object
Returns the value of attribute dte.
4 5 6 |
# File 'lib/facturapi/service/procesar.rb', line 4 def dte @dte end |
Instance Method Details
#send ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/facturapi/service/procesar.rb', line 12 def send file = Base64.strict_encode64(dte.as_node.to_s) params = { file: file, formato: 2 } response = client.call(:procesar, params) Nokogiri::XML(response) # doc = Nokogiri::XML(response) # ok = doc.css('WSPLANO>Resultado').text # mensaje = doc.css('WSPLANO>Mensaje').text # error = doc.css('Documento>Error').text end |