Simple API client for Dead Man's Snitch
To check in for one of your snitches:
Snitcher.snitch("c2354d53d2")You also may provide a message with the check in:
Snitcher.snitch("c2354d53d2", message: "Finished in 23.8 seconds.")Errors can be reported by providing the status option. A status of nil,
0, or "" are all considered a success. Any other status is treated as a
failure.
Snitcher.snitch("c2354d53d2", status: 1)The default timeout of 5 seconds can be overridden:
Snitcher.snitch("c2354d53d2", timeout: 10)Initialize the API client directly with your api key:
require "snitcher/api"
client = Snitcher::API::Client.new("my_awesome_key")Dead Man's Snitch exposes the DEADMANSSNITCH_API_KEY environment variable for
accessing the API.
require "snitcher/api"
client = Snitcher::API::Client.new(ENV["DEADMANSSNITCH_API_KEY"])client.snitchesReturns an array of Snitches.
token = "c2354d53d2"
client.snitch(token)Returns a Snitch.
client.snitches(tags: ["critical", "sales"])Returns an array of Snitches.
Both :name and :interval are required. Optional attributes include :notes,
and :tags. For a full list see the API documentation.
attributes = {
name: "Nightly User Data Backups",
interval: "daily",
notes: "User login and usage data",
tags: ["users", "critical"],
}
client.create_snitch(attributes)Returns the newly-created Snitch.
You only need to pass the update_snitch function the attributes you want to change. The rest of a Snitch's attributes will remain the same.
token = "c2354d53d2"
attrs = { "name": "Important Nightly User Data Backups" }
client.update_snitch(token, attrs)Returns the edited Snitch.
This function adds tags to a Snitch, retaining whatever tags it already has.
token = "c2354d53d2"
tags = ["spring_campaign", "support"]
client.add_tags(token, tags)Returns an array of all of the Snitch's tags.
This function is for deleting a single tag from a Snitch.
token = "c2354d53d2"
tag = "support"
client.remove_tag(token, tag)Returns an array of all of the Snitch's remaining tags.
token = "c2354d53d2"
client.update_snitch(token, tags: [ "production", "critical" ])token = "c2354d53d2"
client.update_snitch(token, tags: [])token = "c2354d53d2"
client.pause_snitch(token)Returns a nil object.
token = "c2354d53d2"
client.delete_snitch(token)Returns a nil object.
Snitcher is open source and contributions from the community are encouraged! No contribution is too small. Please consider:
- adding features
- squashing bugs
- updating documentation
- fixing typos
For the best chance of having your changes merged, please:
- fork the project
- push your changes, with tests
- submit a pull request with at least one animated GIF
A big thank you to Randy Schmidt for dreaming up Dead Man's Snitch in the first place and for entrusting its future to Collective Idea.
See LICENSE.txt for details.




