Class: Dogapi::V2::DashboardListService

Inherits:
APIService
  • Object
show all
Defined in:
lib/dogapi/v2/dashboard_list.rb

Overview

Dashboard List API

Constant Summary collapse

API_VERSION =
'v2'
RESOURCE_NAME =
'dashboard/lists/manual'
SUB_RESOURCE_NAME =
'dashboards'

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

#add_items(resource_id, dashboards) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/dogapi/v2/dashboard_list.rb', line 25

def add_items(resource_id, dashboards)
  body = {
    dashboards: dashboards
  }

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

#delete_items(resource_id, dashboards) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/dogapi/v2/dashboard_list.rb', line 53

def delete_items(resource_id, dashboards)
  body = {
    dashboards: dashboards
  }

  request(
    Net::HTTP::Delete,
    "/api/#{API_VERSION}/#{RESOURCE_NAME}/#{resource_id}/#{SUB_RESOURCE_NAME}",
    nil,
    body,
    true
  )
end

#get_items(resource_id) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/dogapi/v2/dashboard_list.rb', line 15

def get_items(resource_id)
  request(
    Net::HTTP::Get,
    "/api/#{API_VERSION}/#{RESOURCE_NAME}/#{resource_id}/#{SUB_RESOURCE_NAME}",
    nil,
    nil,
    false
  )
end

#update_items(resource_id, dashboards) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/dogapi/v2/dashboard_list.rb', line 39

def update_items(resource_id, dashboards)
  body = {
    dashboards: dashboards
  }

  request(
    Net::HTTP::Put,
    "/api/#{API_VERSION}/#{RESOURCE_NAME}/#{resource_id}/#{SUB_RESOURCE_NAME}",
    nil,
    body,
    true
  )
end