7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/ratis/request.rb', line 7
def self.get(action, params = {})
begin
raise Errors::ConfigError, 'It appears that Ratis.configure has not been called or properly setup' unless Ratis.config.valid?
params.merge!({ 'Appid' => Ratis.config.appid })
endpoint(Ratis.config.endpoint)
namespace(Ratis.config.namespace)
client.http.read_timeout = Ratis.config.timeout
response = client.request action, :soap_action => "#{Ratis.config.namespace}##{action}", :xmlns => Ratis.config.namespace do
soap.body = params unless params.blank?
end
response
rescue Errno::ECONNREFUSED => e
raise Errors::NetworkError.new 'Refused request to ATIS SOAP server', e
rescue Savon::SOAP::Fault => e
raise Errors::SoapError.new e
rescue Timeout::Error => e
msg = "Request to ATIS SOAP server timed out after #{ Ratis.config.timeout }s"
raise Errors::NetworkError.new msg, e
end
end
|