class Snitcher::API::Snitch

Attributes

alert_email[RW]

alert_email is a list of email addresses that will be notified when this Snitch goes missing, errors, or becomes healthy again. When this is set, only the email addresses in the list will be notified. When the list is empty then all team members will be alerted by default.

@return [Array<String>] override list of email addresses

check_in_url[RW]

@return [String] url used to check-in in the Snitch as healthy.

checked_in_at[RW]

@return [String] when the Snitch last checked_in

created_at[RW]

@return [String] when the Snitch was created.

interval[RW]

@return [String] how often Dead Man's Snitch expects to hear from the

Snitch. One of "15_minute", "30_minute", "hourly", "daily", "weekly", or
"monthly".
name[RW]

@return [String] useful name for the Snitch to help identify it.

notes[RW]

@return [String] generic notes for the Snitch. Useful for specifying actions

to take when a Snitch stops reporting.
status[RW]

@return [String] the current reporting status of the Snitch. One of

"pending", "healthy", "paused", "failed", or "errored".
tags[RW]

@return [Array<String>] list of tags on the Snitch.

token[RW]

@return [String] unique token used to identify a Snitch.

Public Class Methods

new(payload) click to toggle source

Create a new Snitch from an API response.

@example

payload = {
  "token" => "c2354d53d3",
  "href" => "/v1/snitches/c2354d53d3",
  "name" => "Daily Backups",
  "alert_email" => [],
  "tags" => [
    "production",
    "critical"
  ],
  "status" => "pending",
  "checked_in_at" => "",
  "type": {
    "interval" => "daily"
  },
  "check_in_url" => "https://nosnch.in/c2354d53d3",
  "created_at" => "2015-08-15T12:15:00.234Z",
  "notes" => "Important user data.",
}

Snitcher::API::Snitch.new(payload)
# => #<Snitcher::API::Snitch...>

@return Snitcher::API::Snitch

# File lib/snitcher/api/snitch.rb, line 69
def initialize(payload)
  @token     = payload["token"]
  @name      = payload["name"]
  @tags      = payload["tags"]
  @status    = payload["status"]
  @interval  = payload["type"]["interval"]
  @notes     = payload["notes"]

  @created_at    = payload["created_at"]
  @alert_email   = payload["alert_email"] || []
  @check_in_url  = payload["check_in_url"]
  @checked_in_at = payload["checked_in_at"]
end