Skip to content

Instantly share code, notes, and snippets.

@rtekie
Created August 26, 2012 03:29
Show Gist options
  • Save rtekie/3473580 to your computer and use it in GitHub Desktop.
Save rtekie/3473580 to your computer and use it in GitHub Desktop.
Ruby example of using API to notify CronSentry upon a job completion
# Ruby example of using API to notify CronSentry upon a job completion
# For API documentation please go to http://www.cronsentry.com/help#api
require 'open-uri'
require 'rest_client'
# set POST variables
url = 'http://api.cronsentry.com/api/v1/notifications'
api_key = 'YOUR_API_KEY'
job_name = URI::encode('Your job name')
status = 1
message = URI::encode('Please change me')
# do POST
response = RestClient.post( url,
{
:api_key => api_key,
:job_name => job_name,
:status => status,
:message => message
})
# check response
puts "Response code: #{response.code}"
puts "Response body: #{response.body}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment