Class: Dogapi::V1::AlertService

Inherits:
APIService show all
Defined in:
lib/dogapi/v1/alert.rb

Constant Summary collapse

API_VERSION =
'v1'

Instance Attribute Summary

Attributes inherited from APIService

#api_key, #application_key

Instance Method Summary collapse

Methods inherited from APIService

#connect, #handle_redirect, #handle_response, #initialize, #prepare_params, #prepare_request, #request, #should_set_api_and_app_keys_in_params?, #suppress_error_if_silent

Constructor Details

This class inherits a constructor from Dogapi::APIService

Instance Method Details

#alert(query, options = {}) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/dogapi/v1/alert.rb', line 12

def alert(query, options = {})
  body = {
    'query' => query,
  }.merge options

  request(Net::HTTP::Post, "/api/#{API_VERSION}/alert", nil, body, true)
end

#delete_alert(alert_id) ⇒ Object



32
33
34
# File 'lib/dogapi/v1/alert.rb', line 32

def delete_alert(alert_id)
  request(Net::HTTP::Delete, "/api/#{API_VERSION}/alert/#{alert_id}", nil, nil, false)
end

#get_alert(alert_id) ⇒ Object



28
29
30
# File 'lib/dogapi/v1/alert.rb', line 28

def get_alert(alert_id)
  request(Net::HTTP::Get, "/api/#{API_VERSION}/alert/#{alert_id}", nil, nil, false)
end

#get_all_alertsObject



36
37
38
# File 'lib/dogapi/v1/alert.rb', line 36

def get_all_alerts
  request(Net::HTTP::Get, "/api/#{API_VERSION}/alert", nil, nil, false)
end

#mute_alertsObject



40
41
42
# File 'lib/dogapi/v1/alert.rb', line 40

def mute_alerts
  request(Net::HTTP::Post, "/api/#{API_VERSION}/mute_alerts", nil, nil, false)
end

#unmute_alertsObject



44
45
46
# File 'lib/dogapi/v1/alert.rb', line 44

def unmute_alerts
  request(Net::HTTP::Post, "/api/#{API_VERSION}/unmute_alerts", nil, nil, false)
end

#update_alert(alert_id, query, options) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/dogapi/v1/alert.rb', line 20

def update_alert(alert_id, query, options)
  body = {
    'query' => query,
  }.merge options

  request(Net::HTTP::Put, "/api/#{API_VERSION}/alert/#{alert_id}", nil, body, true)
end