24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/exceptional/remote.rb', line 24
def call_remote(url, data)
config = Exceptional::Config
optional_proxy = Net::HTTP::Proxy(config.http_proxy_host,
config.http_proxy_port,
config.http_proxy_username,
config.http_proxy_password)
client = optional_proxy.new(config.remote_host, config.remote_port)
client.open_timeout = config.http_open_timeout
client.read_timeout = config.http_read_timeout
client.use_ssl = config.ssl_enabled?
begin
response = client.post(url, data)
case response
when Net::HTTPSuccess
Exceptional.logger.info('Successful')
return true
else
Exceptional.logger.error('Failed')
end
rescue Exception => e
Exceptional.logger.error('Problem notifying Exceptional about the error')
Exceptional.logger.error(e)
end
nil
end
|