Class: Snitcher::API::Snitch
- Inherits:
-
Object
- Object
- Snitcher::API::Snitch
- Defined in:
- lib/snitcher/api/snitch.rb
Instance Attribute Summary collapse
-
#alert_email ⇒ Array<String>
alert_email is a list of email addresses that will be notified when this Snitch goes missing, errors, or becomes healthy again.
-
#check_in_url ⇒ String
Url used to check-in in the Snitch as healthy.
-
#checked_in_at ⇒ String
When the Snitch last checked_in.
-
#created_at ⇒ String
When the Snitch was created.
-
#interval ⇒ String
How often Dead Man’s Snitch expects to hear from the Snitch.
-
#name ⇒ String
Useful name for the Snitch to help identify it.
-
#notes ⇒ String
Generic notes for the Snitch.
-
#status ⇒ String
The current reporting status of the Snitch.
-
#tags ⇒ Array<String>
List of tags on the Snitch.
-
#token ⇒ String
Unique token used to identify a Snitch.
Instance Method Summary collapse
-
#initialize(payload) ⇒ Object
constructor
Create a new Snitch from an API response.
Constructor Details
#initialize(payload) ⇒ Object
Create a new Snitch from an API response.
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# 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 |
Instance Attribute Details
#alert_email ⇒ Array<String>
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.
23 24 25 |
# File 'lib/snitcher/api/snitch.rb', line 23 def alert_email @alert_email end |
#check_in_url ⇒ String
Returns url used to check-in in the Snitch as healthy.
34 35 36 |
# File 'lib/snitcher/api/snitch.rb', line 34 def check_in_url @check_in_url end |
#checked_in_at ⇒ String
Returns when the Snitch last checked_in.
26 27 28 |
# File 'lib/snitcher/api/snitch.rb', line 26 def checked_in_at @checked_in_at end |
#created_at ⇒ String
Returns when the Snitch was created.
37 38 39 |
# File 'lib/snitcher/api/snitch.rb', line 37 def created_at @created_at end |
#interval ⇒ String
Returns how often Dead Man’s Snitch expects to hear from the Snitch. One of “15_minute”, “30_minute”, “hourly”, “daily”, “weekly”, or “monthly”.
31 32 33 |
# File 'lib/snitcher/api/snitch.rb', line 31 def interval @interval end |
#name ⇒ String
Returns useful name for the Snitch to help identify it.
8 9 10 |
# File 'lib/snitcher/api/snitch.rb', line 8 def name @name end |
#notes ⇒ String
Returns generic notes for the Snitch. Useful for specifying actions to take when a Snitch stops reporting.
41 42 43 |
# File 'lib/snitcher/api/snitch.rb', line 41 def notes @notes end |
#status ⇒ String
Returns the current reporting status of the Snitch. One of “pending”, “healthy”, “paused”, “failed”, or “errored”.
15 16 17 |
# File 'lib/snitcher/api/snitch.rb', line 15 def status @status end |
#tags ⇒ Array<String>
Returns list of tags on the Snitch.
11 12 13 |
# File 'lib/snitcher/api/snitch.rb', line 11 def @tags end |
#token ⇒ String
Returns unique token used to identify a Snitch.
5 6 7 |
# File 'lib/snitcher/api/snitch.rb', line 5 def token @token end |