Class: Updown::Check
- Inherits:
-
Object
- Object
- Updown::Check
- Defined in:
- lib/updown/check.rb
Instance Attribute Summary collapse
-
#alias ⇒ Object
Returns the value of attribute alias.
-
#apdex_t ⇒ Object
Returns the value of attribute apdex_t.
-
#down ⇒ Object
Returns the value of attribute down.
-
#down_since ⇒ Object
Returns the value of attribute down_since.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#error ⇒ Object
Returns the value of attribute error.
-
#last_check_at ⇒ Object
Returns the value of attribute last_check_at.
-
#last_status ⇒ Object
Returns the value of attribute last_status.
-
#metrics ⇒ Object
Returns the value of attribute metrics.
-
#next_check_at ⇒ Object
Returns the value of attribute next_check_at.
-
#period ⇒ Object
Returns the value of attribute period.
-
#published ⇒ Object
Returns the value of attribute published.
-
#ssl_error ⇒ Object
Returns the value of attribute ssl_error.
-
#ssl_tested_at ⇒ Object
Returns the value of attribute ssl_tested_at.
-
#ssl_valid ⇒ Object
Returns the value of attribute ssl_valid.
-
#token ⇒ Object
Returns the value of attribute token.
-
#uptime ⇒ Object
Returns the value of attribute uptime.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #destroy ⇒ Object
- #downtimes(page: 1) ⇒ Object
- #get_metrics(filters = {}) ⇒ Object
-
#initialize(json) ⇒ Check
constructor
A new instance of Check.
- #update(attributes = {}) ⇒ Object
Constructor Details
#initialize(json) ⇒ Check
Returns a new instance of Check.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/updown/check.rb', line 21 def initialize(json) @token = json['token'] @url = json['url'] @alias = json['alias'] @last_status = json['last_status'] @enabled = json['enabled'] @period = json['period'] @apdex_t = json['apdex_t'] @published = json['published'] @uptime = json['uptime'] @down = json['down'] @error = json['error'] @metrics = json['metrics'] @down_since = Time.parse(json['down_since']) if json['down_since'] @last_check_at = Time.parse(json['last_check_at']) if json['last_check_at'] @next_check_at = Time.parse(json['next_check_at']) if json['next_check_at'] if ssl = json['ssl'] @ssl_tested_at = Time.parse(ssl['tested_at']) if ssl['tested_at'] @ssl_valid = ssl['valid'] @ssl_error = ssl['error'] end end |
Instance Attribute Details
#alias ⇒ Object
Returns the value of attribute alias.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def alias @alias end |
#apdex_t ⇒ Object
Returns the value of attribute apdex_t.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def apdex_t @apdex_t end |
#down ⇒ Object
Returns the value of attribute down.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def down @down end |
#down_since ⇒ Object
Returns the value of attribute down_since.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def down_since @down_since end |
#enabled ⇒ Object
Returns the value of attribute enabled.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def enabled @enabled end |
#error ⇒ Object
Returns the value of attribute error.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def error @error end |
#last_check_at ⇒ Object
Returns the value of attribute last_check_at.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def last_check_at @last_check_at end |
#last_status ⇒ Object
Returns the value of attribute last_status.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def last_status @last_status end |
#metrics ⇒ Object
Returns the value of attribute metrics.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def metrics @metrics end |
#next_check_at ⇒ Object
Returns the value of attribute next_check_at.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def next_check_at @next_check_at end |
#period ⇒ Object
Returns the value of attribute period.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def period @period end |
#published ⇒ Object
Returns the value of attribute published.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def published @published end |
#ssl_error ⇒ Object
Returns the value of attribute ssl_error.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def ssl_error @ssl_error end |
#ssl_tested_at ⇒ Object
Returns the value of attribute ssl_tested_at.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def ssl_tested_at @ssl_tested_at end |
#ssl_valid ⇒ Object
Returns the value of attribute ssl_valid.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def ssl_valid @ssl_valid end |
#token ⇒ Object
Returns the value of attribute token.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def token @token end |
#uptime ⇒ Object
Returns the value of attribute uptime.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def uptime @uptime end |
#url ⇒ Object
Returns the value of attribute url.
5 6 7 |
# File 'lib/updown/check.rb', line 5 def url @url end |
Class Method Details
.all ⇒ Object
7 8 9 10 11 |
# File 'lib/updown/check.rb', line 7 def self.all Updown::Call.checks.map do |check| Check.new check end end |
.create(url, attributes = {}) ⇒ Object
13 14 15 |
# File 'lib/updown/check.rb', line 13 def self.create(url, attributes = {}) Check.new Updown::Call.create_check(attributes.merge(url: url)) end |
Instance Method Details
#destroy ⇒ Object
56 57 58 |
# File 'lib/updown/check.rb', line 56 def destroy Updown::Call.destroy_check(@token)['deleted'] end |
#downtimes(page: 1) ⇒ Object
44 45 46 |
# File 'lib/updown/check.rb', line 44 def downtimes page: 1 Downtime.find(@token, page: page) end |
#get_metrics(filters = {}) ⇒ Object
48 49 50 |
# File 'lib/updown/check.rb', line 48 def get_metrics filters = {} Updown::Call.metrics(@token, filters) end |
#update(attributes = {}) ⇒ Object
52 53 54 |
# File 'lib/updown/check.rb', line 52 def update(attributes={}) Check.new Updown::Call.update_check(@token, attributes) end |