Sha256: e3b505fcda58119e36099e8b80b6ac7a98723b27c90356ce5d6da125911cd12a
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
module CrowdFlower class Unit < Base attr_reader :job def initialize(job) super job.connection @job = job connect end def resource_uri "/jobs/#{@job.id}/units" end def all(page = 1, limit = 1000) connection.get(resource_uri, {:query => {:limit => limit, :page => page}}) end def get(id) connection.get("#{resource_uri}/#{id}") end def ping connection.get("#{resource_uri}/ping") end def judgments(id) connection.get("#{resource_uri}/#{id}/judgments") end def create(data, gold = false) connection.post(resource_uri, {:body => {:unit => {:data => data.to_json, :golden => gold}}}) end def copy(unit_id, job_id, data = {}) connection.get("#{resource_uri}/#{unit_id}/copy", {:query => {:unit => {:job_id => job_id, :data => data}}}) end def split(on, with = " ") connection.get("#{resource_uri}/split", {:query => {:on => on, :with => with}}) end def cancel(unit_id) connection.post("#{resource_uri}/#{unit_id}/cancel.json") end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
crowdflower-0.6.2 | lib/crowdflower/unit.rb |
crowdflower-0.6.1 | lib/crowdflower/unit.rb |
crowdflower-0.6.0 | lib/crowdflower/unit.rb |