Class: Barkdog::Client

Inherits:
Object
  • Object
show all
Includes:
Logger::Helper
Defined in:
lib/barkdog/client.rb

Instance Method Summary collapse

Methods included from Logger::Helper

#log

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/barkdog/client.rb', line 4

def initialize(options = {})
  @options = options

  api_key, app_key = @options.values_at(:api_key, :application_key)
  raise 'API Key does not exist' unless api_key
  raise 'Application Key does not exist' unless app_key

  # api_key, application_key=nil, host=nil, device=nil, silent=true, timeout=nil
  # We force silent to false so any exceptions get propated back out and we fail loudly.
  @dog = Dogapi::Client.new(api_key, app_key, nil, nil, false, @options[:datadog_timeout])
  @driver = Barkdog::Driver.new(@dog, @options)
end

Instance Method Details

#apply(file) ⇒ Object



22
23
24
# File 'lib/barkdog/client.rb', line 22

def apply(file)
  walk(file)
end

#export(export_options = {}) ⇒ Object



17
18
19
20
# File 'lib/barkdog/client.rb', line 17

def export(export_options = {})
  exported = Barkdog::Exporter.export(@dog, @options)
  Barkdog::DSL.convert(exported, @options)
end