Sha256: 6949dad354850061e223c4c173f125a86686277499eb4cf5e1b11502ed9ac577

Contents?: true

Size: 692 Bytes

Versions: 1

Compression:

Stored size: 692 Bytes

Contents

require_relative 'model/config'
require_relative 'model/client'

module DogWatch
  ##
  # Manage the execution of the Dogfile
  ##
  class DogFile
    # @param [String] dogfile
    # @param [String|Object] api_key
    # @param [String|Object] app_key
    # @param [Integer] timeout
    def configure(dogfile, api_key, app_key, timeout)
      @dogfile = dogfile
      @config = DogWatch::Model::Config.new(api_key, app_key, timeout)
    end

    # @param [Proc] block
    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dogwatch-1.1.0 lib/dogwatch/dogfile.rb