Class: DogapiDemo::V1::ServiceCheckService

Inherits:
APIService
  • Object
show all
Defined in:
lib/dogapi-demo/v1/service_check.rb

Constant Summary collapse

API_VERSION =
'v1'

Instance Method Summary collapse

Methods inherited from APIService

#connect, #initialize, #request, #suppress_error_if_silent

Constructor Details

This class inherits a constructor from DogapiDemo::APIService

Instance Method Details

#service_check(check, host, status, options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/dogapi-demo/v1/service_check.rb', line 10

def service_check(check, host, status, options = {})
  begin
    params = {
      :api_key => @api_key,
      :application_key => @application_key
    }

    body = {
      'check' => check,
      'host_name' => host,
      'status' => status
    }.merge options

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