Class: Facturapi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/facturapi/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeClient

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

#clientObject

Returns the value of attribute client.



5
6
7
# File 'lib/facturapi/client.rb', line 5

def client
  @client
end

#loginObject (readonly)

Returns the value of attribute login.



6
7
8
# File 'lib/facturapi/client.rb', line 6

def 
  @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] ||= 
  puts params
  response = @client.call(method, message: params)
  response.body[:procesar_response][:procesar_result]
end