Class: DogWatch::DogFile

Inherits:
Object
  • Object
show all
Defined in:
lib/dogwatch/dogfile.rb

Overview

Manage the execution of the Dogfile

Instance Method Summary collapse

Instance Method Details

#configure(dogfile, api_key = nil, app_key = nil) ⇒ Object

Parameters:

  • dogfile (String)
  • api_key (String|Object) (defaults to: nil)
  • app_key (String|Object) (defaults to: nil)


12
13
14
15
# File 'lib/dogwatch/dogfile.rb', line 12

def configure(dogfile, api_key = nil, app_key = nil)
  @dogfile = dogfile
  @config = DogWatch::Model::Config.new(api_key, app_key)
end

#create(&block) ⇒ Object

Parameters:

  • block (Proc)


18
19
20
21
22
23
24
25
# File 'lib/dogwatch/dogfile.rb', line 18

def create(&block)
  monitor = instance_eval(IO.read(@dogfile), @dogfile, 1)
  monitor.config = @config
  monitor.client

  monitor.get
  monitor.responses.each { |r| block.call(r) }
end