Class: Snitcher::API::Snitch
- Inherits:
-
Object
- Object
- Snitcher::API::Snitch
- Defined in:
- lib/snitcher/api/snitch.rb
Instance Attribute Summary collapse
-
#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.
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/snitcher/api/snitch.rb', line 58 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"] @check_in_url = payload["check_in_url"] @checked_in_at = payload["checked_in_at"] end |
Instance Attribute Details
#check_in_url ⇒ String
Returns url used to check-in in the Snitch as healthy.
24 25 26 |
# File 'lib/snitcher/api/snitch.rb', line 24 def check_in_url @check_in_url end |
#checked_in_at ⇒ String
Returns when the Snitch last checked_in.
16 17 18 |
# File 'lib/snitcher/api/snitch.rb', line 16 def checked_in_at @checked_in_at end |
#created_at ⇒ String
Returns when the Snitch was created.
27 28 29 |
# File 'lib/snitcher/api/snitch.rb', line 27 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”.
21 22 23 |
# File 'lib/snitcher/api/snitch.rb', line 21 def interval @interval end |
#name ⇒ String
Returns useful name for the Snitch to help identify it.
6 7 8 |
# File 'lib/snitcher/api/snitch.rb', line 6 def name @name end |
#notes ⇒ String
Returns generic notes for the Snitch. Useful for specifying actions to take when a Snitch stops reporting.
31 32 33 |
# File 'lib/snitcher/api/snitch.rb', line 31 def notes @notes end |
#status ⇒ String
Returns the current reporting status of the Snitch. One of “pending”, “healthy”, “paused”, “failed”, or “errored”.
13 14 15 |
# File 'lib/snitcher/api/snitch.rb', line 13 def status @status end |
#tags ⇒ Array<String>
Returns list of tags on the Snitch.
9 10 11 |
# File 'lib/snitcher/api/snitch.rb', line 9 def @tags end |
#token ⇒ String
Returns unique token used to identify a Snitch.
3 4 5 |
# File 'lib/snitcher/api/snitch.rb', line 3 def token @token end |