Class: Chronatog::Client::Fake

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

Instance Method Summary collapse

Instance Method Details

#create_job(callback_url, schedule) ⇒ Object



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

def create_job(callback_url, schedule)
  job_url = "/jobs/#{Object.new.object_id}"
  created = {'callback_url' => callback_url, 'schedule' => schedule, 'url' => job_url }
  jobs[job_url] = created
  JSON::parse(created.to_json)
end

#destroy_job(job_url) ⇒ Object



26
27
28
# File 'lib/chronatog/client.rb', line 26

def destroy_job(job_url)
  jobs.delete(job_url)
end

#get_job(job_url) ⇒ Object



34
35
36
# File 'lib/chronatog/client.rb', line 34

def get_job(job_url)
  JSON::parse(jobs[job_url].to_json)
end

#list_jobsObject



30
31
32
# File 'lib/chronatog/client.rb', line 30

def list_jobs
  JSON::parse(jobs.values.to_json)
end