Class: Dogapi::ClientV2

Inherits:
Object
  • Object
show all
Defined in:
lib/dogapi/facade.rb

Overview

A simple DogAPI client supporting the version 2.

See Dogapi::V2 for the thick underlying clients

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, application_key = nil, host = nil, device = nil, silent = true, timeout = nil, endpoint = nil, skip_ssl_validation = false) ⇒ ClientV2

Returns a new instance of ClientV2.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/dogapi/facade.rb', line 16

def initialize(api_key, application_key=nil, host=nil, device=nil, silent=true,
               timeout=nil, endpoint=nil, skip_ssl_validation=false)

  if api_key
    @api_key = api_key
  else
    raise 'Please provide an API key to submit your data'
  end

  @application_key = application_key
  @datadog_host = endpoint || Dogapi.find_datadog_host()
  @host = host || Dogapi.find_localhost()
  @device = device

  @dashboard_list_service_v2 = Dogapi::V2::DashboardListService.new(
    @api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation
  )

end

Instance Attribute Details

#datadog_hostObject

Returns the value of attribute datadog_host.



15
16
17
# File 'lib/dogapi/facade.rb', line 15

def datadog_host
  @datadog_host
end

Instance Method Details

#add_items_to_dashboard_list(dashboard_list_id, dashboards) ⇒ Object



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

def add_items_to_dashboard_list(dashboard_list_id, dashboards)
  @dashboard_list_service_v2.add_items(dashboard_list_id, dashboards)
end

#delete_items_from_dashboard_list(dashboard_list_id, dashboards) ⇒ Object



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

def delete_items_from_dashboard_list(dashboard_list_id, dashboards)
  @dashboard_list_service_v2.delete_items(dashboard_list_id, dashboards)
end

#get_items_of_dashboard_list(dashboard_list_id) ⇒ Object



48
49
50
# File 'lib/dogapi/facade.rb', line 48

def get_items_of_dashboard_list(dashboard_list_id)
  @dashboard_list_service_v2.get_items(dashboard_list_id)
end

#update_items_of_dashboard_list(dashboard_list_id, dashboards) ⇒ Object



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

def update_items_of_dashboard_list(dashboard_list_id, dashboards)
  @dashboard_list_service_v2.update_items(dashboard_list_id, dashboards)
end