Class: Facturapi::Client
- Inherits:
-
Object
- Object
- Facturapi::Client
- Defined in:
- lib/facturapi/client.rb
Class Method Summary collapse
- .call(method, params = {}) ⇒ Object
- .client ⇒ Object
- .operations ⇒ Object
- .xml(method, params = {}) ⇒ Object
Class Method Details
.call(method, params = {}) ⇒ Object
6 7 8 9 |
# File 'lib/facturapi/client.rb', line 6 def call(method, params = {}) params[:login] ||= login client.call(method, message: params) end |
.client ⇒ Object
17 18 19 20 21 |
# File 'lib/facturapi/client.rb', line 17 def client @client ||= Savon.client( wsdl: 'http://ws1.facturacion.cl/WSDS/wsplano.asmx?wsdl' ) end |
.operations ⇒ Object
23 24 25 |
# File 'lib/facturapi/client.rb', line 23 def operations client.operations end |
.xml(method, params = {}) ⇒ Object
11 12 13 14 15 |
# File 'lib/facturapi/client.rb', line 11 def xml(method, params = {}) ops = client.operation(method) params[:login] ||= login Nokogiri::XML(ops.build(message: params).to_s).to_s end |