Class: Dogapi::V1::DashService

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

#create_dashboard(title, description, graphs, template_variables = nil, read_only = false) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dogapi/v1/dash.rb', line 12

def create_dashboard(title, description, graphs, template_variables = nil, read_only = false)
  body = {
    :title => title,
    :description => description,
    :graphs => graphs,
    :template_variables => (template_variables or []),
    :read_only => read_only
  }

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

#delete_dashboard(dash_id) ⇒ Object



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

def delete_dashboard(dash_id)
  request(Net::HTTP::Delete, "/api/#{API_VERSION}/dash/#{dash_id}", nil, nil, false)
end

#get_dashboard(dash_id) ⇒ Object



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

def get_dashboard(dash_id)
  request(Net::HTTP::Get, "/api/#{API_VERSION}/dash/#{dash_id}", nil, nil, false)
end

#get_dashboardsObject



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

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

#update_dashboard(dash_id, title, description, graphs, template_variables = nil, read_only = false) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/dogapi/v1/dash.rb', line 24

def update_dashboard(dash_id, title, description, graphs, template_variables = nil, read_only = false)
  body = {
    :title => title,
    :description => description,
    :graphs => graphs,
    :template_variables => (template_variables or []),
    :read_only => read_only
  }

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