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
49
|
# 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?
client.verify_mode = OpenSSL::SSL::VERIFY_NONE if config.ssl?
begin
response = client.post(url, data)
case response
when Net::HTTPSuccess
Exceptional.logger.info( "#{url} - #{response.message}")
return true
else
Exceptional.logger.error("#{url} - #{response.code} - #{response.message}")
end
rescue Exception => e
Exceptional.logger.error('Problem notifying Exceptional about the error')
Exceptional.logger.error(e)
end
nil
end
|