Sha256: 1e55706a2548e0a87983c12d261d89f1b6606f6cad6259ea773845104898d11e
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
module CrowdFlower class Worker < Base attr_reader :job def initialize( job ) super job.connection @job = job connect end def resource_uri "/jobs/#{@job.id}/workers" end def bonus( worker_id, amount, reason=nil ) params = { :amount => amount, :reason => reason } connection.post( "#{resource_uri}/#{worker_id}/bonus", :body => params ) end def reject( worker_id ) connection.put( "#{resource_uri}/#{worker_id}/reject", :headers => { "Content-Length" => "0" } ) end def notify( worker_id, message ) params = { :message => message } connection.post( "#{resource_uri}/#{worker_id}/notify", :body => params ) end def flag( worker_id, reason = nil, persist = false ) params = { :reason => reason, :persist => persist } connection.put( "#{resource_uri}/#{worker_id}/flag", :body => params, :headers => { "Content-Length" => "0" }) end def deflag(worker_id, reason) connection.put( "#{resource_uri}/#{worker_id}/deflag", :body => { :reason => reason }, :headers => { "Content-Length" => "0" }) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
crowdflower-0.12.0 | lib/crowdflower/worker.rb |
crowdflower-0.11.0 | lib/crowdflower/worker.rb |