Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rename 'assignments' accessor/mutator to 'max_assignment' for consist…

…ency with its real name (MaxAssignments) and to remove confusion between it and the other property named 'assignments'
  • Loading branch information...
commit 3a1d6ee03c8813963b81bf1ad062563be286176c 1 parent dd1ffba
@alexch authored
View
2  README.markdown
@@ -22,7 +22,7 @@ Let's say you have a form at "http://myapp.com/turkers/add_tags" where Turkers c
RTurk.setup(YourAWSAccessKeyId, YourAWSAccessKey, :sandbox => true)
hit = RTurk::Hit.create(:title => "Add some tags to a photo") do |hit|
- hit.assignments = 2
+ hit.max_assignments = 2
hit.description = 'blah'
hit.question("http://myapp.com/turkers/add_tags",
:frame_height => 1000) # pixels for iframe
View
2  examples/create_hit.rb
@@ -6,7 +6,7 @@
hit = RTurk::Hit.create(:title => 'Write a tweet for me') do |hit|
hit.description = 'Simply write a witty twitter update for my account'
hit.reward = 0.05
- hit.assignments = 1
+ hit.max_assignments = 1
hit.question("http://mpercival.com.s3.amazonaws.com/newtweet.html")
end
View
2  lib/rturk/adapters/hit.rb
@@ -10,7 +10,7 @@ module RTurk
#
# RTurk.setup(YourAWSAccessKeyId, YourAWSAccessKey, :sandbox => true)
# hit = RTurk::Hit.create(:title => "Add some tags to a photo") do |hit|
- # hit.assignments = 2
+ # hit.max_assignments = 2
# hit.question("http://myapp.com/turkers/add_tags")
# hit.reward = 0.05
# hit.qualifications.approval_rate, {:gt => 80}
View
4 lib/rturk/operations/create_hit.rb
@@ -2,7 +2,7 @@
module RTurk
class CreateHIT < RegisterHITType
- attr_accessor :hit_type_id, :assignments, :lifetime, :annotation
+ attr_accessor :hit_type_id, :max_assignments, :lifetime, :annotation
def parse(response)
RTurk::CreateHITResponse.new(response)
@@ -27,7 +27,7 @@ def question_form(text)
def to_params
super.merge(
'HITTypeId' => hit_type_id,
- 'MaxAssignments' => (assignments || 1),
+ 'MaxAssignments' => (max_assignments || 1),
'Question' => question.to_params,
'LifetimeInSeconds' => (lifetime || 3600),
'RequesterAnnotation' => annotation
View
12 spec/operations/create_hit_spec.rb
@@ -12,13 +12,13 @@
it "should let me build and send a hit" do
hit = RTurk::CreateHIT.new(:title => "Look at some pictures from 4Chan") do |hit|
- hit.assignments = 5
+ hit.max_assignments = 5
hit.description = 'blah'
hit.question("http://mpercival.com", :frame_height => 600)
hit.reward = 0.05
hit.qualifications.add :approval_rate, {:gt => 80}
end
- hit.assignments.should eql(5)
+ hit.max_assignments.should eql(5)
response = hit.request
response.hit_id.should_not be_nil
end
@@ -42,7 +42,7 @@
it "should let me create a hit" do
response = RTurk::CreateHIT(:title => "Look at some pictures from 4Chan") do |hit|
- hit.assignments = 5
+ hit.max_assignments = 5
hit.description = 'blah'
hit.question("http://mpercival.com", :test => 'b')
hit.reward = 0.05
@@ -54,7 +54,7 @@
it "should let me create a hit with just option arguments" do
hit = RTurk::CreateHIT.new(:title => "Look at some pictures from 4Chan",
:description => "Pics from the b-tards",
- :assignments => 5,
+ :max_assignments => 5,
:reward => nil,
:question => 'http://mpercival.com?picture=1',
:qualifications => [
@@ -62,14 +62,14 @@
[:adult, true]
]
)
- hit.assignments.should eql(5)
+ hit.max_assignments.should eql(5)
hit.qualifications.qualifications.size.should eql(2)
lambda{hit.request}.should raise_error RTurk::MissingParameters
end
it "should rerturn a CreateHITResponse after the request" do
response = RTurk::CreateHIT(:title => "Look at some pictures from 4Chan") do |hit|
- hit.assignments = 5
+ hit.max_assignments = 5
hit.description = "foo"
hit.question("http://mpercival.com", :test => 'b')
hit.reward = 0.05
Please sign in to comment.
Something went wrong with that request. Please try again.