Class: Casper::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/casper-client.rb

Constant Summary collapse

DEFAULT_HOST =
'http://casper.jrs-labs.com:8080'

Class Method Summary collapse

Class Method Details

.build(options = {}, &block) ⇒ Object



11
12
13
14
15
16
# File 'lib/casper-client.rb', line 11

def self.build(options={}, &block)
  options = {:host => DEFAULT_HOST}.merge!(options)
  report = Report.new
  report.instance_eval(&block)
  RestClient.post options[:host], report.to_json, :content_type => :json, :accept => :json
end

.report(options = {}) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/casper-client.rb', line 18

def self.report options={}
  Client.build options do |report| 
    report.template = options[:template]
    report.xml = options[:xml]
    report.xpath = options[:xpath]
  end
end