Module: Mackerel::REST::Alert

Included in:
Client
Defined in:
lib/mackerel/alert.rb

Instance Method Summary collapse

Instance Method Details

#close_alert(alertId, reason) ⇒ Object



40
41
42
43
44
45
# File 'lib/mackerel/alert.rb', line 40

def close_alert(alertId, reason)
  command = ApiCommand.new(:post, "/api/v0/alerts/#{alertId}/close", @api_key)
  command.body = { reason: reason.to_s }.to_json
  data = command.execute(client)
  Mackerel::Alert.new(data)
end

#get_alertsObject



34
35
36
37
38
# File 'lib/mackerel/alert.rb', line 34

def get_alerts()
  command = ApiCommand.new(:get, "/api/v0/alerts", @api_key)
  data = command.execute(client)
  data["alerts"].map { |a| Mackerel::Alert.new(a) }
end