Class: DogapiDemo::V1::SnapshotService

Inherits:
APIService
  • Object
show all
Defined in:
lib/dogapi-demo/v1/snapshot.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

#snapshot(metric_query, start_ts, end_ts, event_query = nil) ⇒ Object



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

def snapshot(metric_query, start_ts, end_ts, event_query=nil)
  begin
    params = {
      :api_key => @api_key,
      :application_key => @application_key,
      :metric_query => metric_query,
      :start => start_ts,
      :end => end_ts,
      :event_query => event_query
    }

    request(Net::HTTP::Get, "/api/#{API_VERSION}/graph/snapshot", params, nil, false)
  rescue Exception => e
    suppress_error_if_silent e
  end
end