Module: HaystackWorker::Jobs

Included in:
HaystackWorker
Defined in:
lib/haystack_worker/jobs.rb

Instance Method Summary collapse

Instance Method Details

#request_jobObject



2
3
4
# File 'lib/haystack_worker/jobs.rb', line 2

def request_job
  respond_with(nil, [])
end

#respond_with(id, results) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/haystack_worker/jobs.rb', line 6

def respond_with(id, results)
  path = job_path(id)
  data = data_for(results)

  json = Net::HTTP.post_form(path, data).body
  hash = JSON.parse(json)

  [hash['id'], ranges_for(hash)]
end