class Dogapi::V1::AlertService

Constants

API_VERSION

Public Instance Methods

alert(query, options = {}) click to toggle source
# File lib/dogapi/v1/alert.rb, line 10
def alert(query, options = {})
  begin
    params = {
      :api_key => @api_key,
      :application_key => @application_key
    }

    body = {
      'query' => query,
    }.merge options

    request(Net::HTTP::Post, "/api/#{API_VERSION}/alert", params, body, true)
  rescue Exception => e
    suppress_error_if_silent e
  end
end
delete_alert(alert_id) click to toggle source
# File lib/dogapi/v1/alert.rb, line 57
def delete_alert(alert_id)
  begin
    params = {
      :api_key => @api_key,
      :application_key => @application_key
    }

    request(Net::HTTP::Delete, "/api/#{API_VERSION}/alert/#{alert_id}", params, nil, false)
  rescue Exception => e
    suppress_error_if_silent e
  end
end
get_alert(alert_id) click to toggle source
# File lib/dogapi/v1/alert.rb, line 44
def get_alert(alert_id)
  begin
    params = {
      :api_key => @api_key,
      :application_key => @application_key
    }

    request(Net::HTTP::Get, "/api/#{API_VERSION}/alert/#{alert_id}", params, nil, false)
  rescue Exception => e
    suppress_error_if_silent e
  end
end
get_all_alerts() click to toggle source
# File lib/dogapi/v1/alert.rb, line 70
def get_all_alerts()
  begin
    params = {
      :api_key => @api_key,
      :application_key => @application_key
    }

    request(Net::HTTP::Get, "/api/#{API_VERSION}/alert", params, nil, false)
  rescue Exception => e
    suppress_error_if_silent e
  end
end
mute_alerts() click to toggle source
# File lib/dogapi/v1/alert.rb, line 83
def mute_alerts()
  begin
    params = {
      :api_key => @api_key,
      :application_key => @application_key
    }

    request(Net::HTTP::Post, "/api/#{API_VERSION}/mute_alerts", params, nil, false)
  rescue Exception => e
    suppress_error_if_silent e
  end
end
unmute_alerts() click to toggle source
# File lib/dogapi/v1/alert.rb, line 96
def unmute_alerts()
  begin
    params = {
      :api_key => @api_key,
      :application_key => @application_key
    }

    request(Net::HTTP::Post, "/api/#{API_VERSION}/unmute_alerts", params, nil, false)
  rescue Exception => e
    suppress_error_if_silent e
  end
end
update_alert(alert_id, query, options) click to toggle source
# File lib/dogapi/v1/alert.rb, line 27
def update_alert(alert_id, query, options)
  begin
    params = {
      :api_key => @api_key,
      :application_key => @application_key
    }

    body = {
      'query' => query,
    }.merge options

    request(Net::HTTP::Put, "/api/#{API_VERSION}/alert/#{alert_id}", params, body, true)
  rescue Exception => e
    suppress_error_if_silent e
  end
end