Class: CrowdFlower::Judgment

Inherits:
Base
  • Object
show all
Defined in:
lib/crowdflower/judgment.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#last_response

Instance Method Summary collapse

Methods inherited from Base

connect, #connect, connect!, connect_config!, connect_domain!, connection, #connection, delete, get, post, put, verify_response

Constructor Details

#initialize(job) ⇒ Judgment

Returns a new instance of Judgment.



5
6
7
8
9
# File 'lib/crowdflower/judgment.rb', line 5

def initialize(job)
  super job.connection
  @job = job
  connect
end

Instance Attribute Details

#jobObject (readonly)

Returns the value of attribute job.



3
4
5
# File 'lib/crowdflower/judgment.rb', line 3

def job
  @job
end

Instance Method Details

#all(page = 1, limit = 100, latest = true) ⇒ Object

Pull every judgment



16
17
18
19
# File 'lib/crowdflower/judgment.rb', line 16

def all(page = 1, limit = 100, latest = true)
  opts = connection.version == 2 ? {:unseen => latest} : {:latest => latest}
  connection.get(resource_uri, {:query => {:limit => limit, :page => page}.merge(opts)})
end

#get(id) ⇒ Object



21
22
23
# File 'lib/crowdflower/judgment.rb', line 21

def get(id)
  connection.get("#{resource_uri}/#{id}")
end

#resource_uriObject



11
12
13
# File 'lib/crowdflower/judgment.rb', line 11

def resource_uri
  "/jobs/#{@job.id}/judgments"
end