lib/sappy/account.rb in abcde-sappy-0.1.0 vs lib/sappy/account.rb in abcde-sappy-0.1.1
- old
+ new
@@ -27,18 +27,12 @@
authenticate
end
end
def refresh!
- response = request('accountinfo')
- @available_monitors = response.available_monitors
- @setup_monitors = response.setup_monitors
- @sms_alerts = response.sms_alerts
- response = request('summarystatistics')
- @up_monitors = response.up
- @down_monitors = response.down
- @inactive_monitors = response.inactive
+ refresh_account_info
+ refresh_summary_statistics
end
def monitors(ids = [])
params = ids.any? ? { "MonitorId" => ids.join(',') } : {}
response = request('monitors', params)
@@ -57,8 +51,22 @@
private
def authenticate
response = request('auth', "Email" => @username, "Password" => @password)
@authkey = response.key
+ end
+
+ def refresh_account_info
+ response = request('accountinfo')
+ @available_monitors = response.available_monitors
+ @setup_monitors = response.setup_monitors
+ @sms_alerts = response.sms_alerts
+ end
+
+ def refresh_summary_statistics
+ response = request('summarystatistics')
+ @up_monitors = response.up
+ @down_monitors = response.down
+ @inactive_monitors = response.inactive
end
end
end