3
4
5
6
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
|
# File 'lib/backend.rb', line 3
def self.send_now(payload, options)
uri = URI(options[:url])
http = Net::HTTP.new(uri.hostname, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
http.read_timeout = options[:network_timeout]
begin
req = CustomPost.new(uri.path,
{
'content-type': 'application/nd-json',
'x-ft-api-key': options[:api_key]
})
req.body = payload
Thread.new {
request = http.request(req)
}
rescue StandardError => e
Firetail.logger.info "Firetail HTTP Request failed (#{e.message})"
end
end
|