Class: Afipws::Client

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

Instance Method Summary collapse

Constructor Details

#initialize(savon_options) ⇒ Client

Returns a new instance of Client.



3
4
5
# File 'lib/afipws/client.rb', line 3

def initialize savon_options
  @savon = Savon.client savon_options.reverse_merge(soap_version: 2, ssl_version: :TLSv1_2)
end

Instance Method Details

#operationsObject



17
18
19
# File 'lib/afipws/client.rb', line 17

def operations
  @savon.operations
end

#request(action, body = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/afipws/client.rb', line 7

def request action, body = nil
  @savon.call action, message: body
rescue Savon::SOAPFault, Savon::HTTPError => e
  raise ServerError, e
rescue HTTPClient::ConnectTimeoutError => e
  raise NetworkError.new(e, retriable: true)
rescue HTTPClient::TimeoutError => e
  raise NetworkError, e
end