Class: Facturapi::Client
- Inherits:
-
Object
- Object
- Facturapi::Client
- Defined in:
- lib/facturapi/client.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#login ⇒ Object
readonly
Returns the value of attribute login.
Instance Method Summary collapse
- #call(method, params = {}) ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/facturapi/client.rb', line 8 def initialize @login = { 'Usuario' => Facturapi.config.fact_user, 'Rut' => Facturapi.config.fact_rut, 'Clave' => Facturapi.config.fact_password, 'Puerto' => Facturapi.config.fact_port } @client = Savon.client( wsdl: 'http://ws1.facturacion.cl/WSDS/wsplano.asmx?wsdl' ) end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
5 6 7 |
# File 'lib/facturapi/client.rb', line 5 def client @client end |
#login ⇒ Object (readonly)
Returns the value of attribute login.
6 7 8 |
# File 'lib/facturapi/client.rb', line 6 def login @login end |
Instance Method Details
#call(method, params = {}) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/facturapi/client.rb', line 20 def call(method, params = {}) params[:login] ||= login puts params response = @client.call(method, message: params) response.body[:procesar_response][:procesar_result] end |