7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/workarea/ping_home_base.rb', line 7
def ping
begin
request = Net::HTTP::Post.new('/ping')
request['X-WeblincClientName'] = Workarea.config.site_name
request['X-WeblincAuthToken'] = auth_token
request.content_type = 'application/json'
request.body = Request.new.to_json
uri = URI(URL)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.start { |h| h.request(request) }
rescue Exception => e
Rails.logger.error '-------------------------------------'
Rails.logger.error "There was an error contacting #{URL}!"
Rails.logger.error e.class
Rails.logger.error e.message
Rails.logger.error '-------------------------------------'
end
end
|