Class: Snoopy::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ Client



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

def initialize(attrs)
  @savon = Savon.client(attrs)
end

Instance Attribute Details

#savonObject

Returns the value of attribute savon.



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

def savon
  @savon
end

Instance Method Details

#call(service, args = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/snoopy_afip/client.rb', line 9

def call service, args={}
  Timeout::timeout(Snoopy.open_timeout) do
    savon.call(service, args).body
  end
rescue Timeout::Error
  raise Snoopy::Exception::ServerTimeout.new
rescue => e
  raise Snoopy::Exception::ClientError.new(e.message)
end