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, app_key, timeout) ⇒ Object

Parameters:

  • dogfile (String)
  • api_key (String|Object)
  • app_key (String|Object)
  • timeout (Integer)


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

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

#create(&block) ⇒ Object

Parameters:

  • block (Proc)


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

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