Module: Zeus::AlertsInterface
Overview
Interface for dealing with alerts api calls
Instance Method Summary collapse
-
#create_alert(alert_data) ⇒ Zeus::APIClient::Result
create alert.
-
#delete_alert(alert_id) ⇒ Zeus::APIClient::Result
delete alert.
-
#disable_alerts(alert_id_array) ⇒ Zeus::APIClient::Result
disable alerts.
-
#enable_alerts(alert_id_array) ⇒ Zeus::APIClient::Result
enable alerts.
-
#get_alert(alert_id) ⇒ Zeus::APIClient::Result
get alert.
-
#get_alerts(metric = nil) ⇒ Zeus::APIClient::Result
get alerts.
-
#modify_alert(alert_id, alert_data) ⇒ Zeus::APIClient::Result
modify alert.
Instance Method Details
#create_alert(alert_data) ⇒ Zeus::APIClient::Result
create alert
40 41 42 43 44 45 46 |
# File 'lib/zeus/api_client/alerts_interface.rb', line 40 def create_alert(alert_data) alert_data[:token] = @access_token response = post("/alerts/#{@access_token}", alert_data) Result.new(response) rescue => e Result.new(e.response) end |
#delete_alert(alert_id) ⇒ Zeus::APIClient::Result
delete alert
101 102 103 104 105 106 |
# File 'lib/zeus/api_client/alerts_interface.rb', line 101 def delete_alert(alert_id) response = delete("/alerts/#{@access_token}/#{alert_id}") Result.new(response) rescue => e Result.new(e.response) end |
#disable_alerts(alert_id_array) ⇒ Zeus::APIClient::Result
disable alerts
126 127 128 129 130 131 132 133 134 |
# File 'lib/zeus/api_client/alerts_interface.rb', line 126 def disable_alerts(alert_id_array) params = { id: alert_id_array } begin response = post("/alerts/#{@access_token}/disable", params) Result.new(response) rescue => e Result.new(e.response) end end |
#enable_alerts(alert_id_array) ⇒ Zeus::APIClient::Result
enable alerts
112 113 114 115 116 117 118 119 120 |
# File 'lib/zeus/api_client/alerts_interface.rb', line 112 def enable_alerts(alert_id_array) params = { id: alert_id_array } begin response = post("/alerts/#{@access_token}/enable", params) Result.new(response) rescue => e Result.new(e.response) end end |
#get_alert(alert_id) ⇒ Zeus::APIClient::Result
get alert
90 91 92 93 94 95 |
# File 'lib/zeus/api_client/alerts_interface.rb', line 90 def get_alert(alert_id) response = get("/alerts/#{@access_token}/#{alert_id}") Result.new(response) rescue => e Result.new(e.response) end |
#get_alerts(metric = nil) ⇒ Zeus::APIClient::Result
get alerts
76 77 78 79 80 81 82 83 84 |
# File 'lib/zeus/api_client/alerts_interface.rb', line 76 def get_alerts(metric = nil) params = { metric: metric } begin response = get("/alerts/#{@access_token}", params) Result.new(response) rescue => e Result.new(e.response) end end |
#modify_alert(alert_id, alert_data) ⇒ Zeus::APIClient::Result
modify alert
64 65 66 67 68 69 70 |
# File 'lib/zeus/api_client/alerts_interface.rb', line 64 def modify_alert(alert_id, alert_data) alert_data[:token] = @access_token response = put("/alerts/#{@access_token}/#{alert_id}", alert_data) Result.new(response) rescue => e Result.new(e.response) end |