Created
October 31, 2009 01:10
-
-
Save newtonapple/222873 to your computer and use it in GitHub Desktop.
An example of RegisterHITType
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Initial implementation can be found here: http://github.com/newtonapple/rturk | |
# API Doc: http://docs.amazonwebservices.com/AWSMechTurk/latest/AWSMechanicalTurkRequester/ | |
RTurk.setup(AWSAccessKeyId, AWSAccessKey, :sandbox => true) | |
hit_type = RTurk.RegisterHITType(:title => "Python") do |hit_type| | |
hit_type.assignments = 500 | |
hit_type.description = "Python Programming!" | |
hit_type.question("http://localhost:3000/mturk") | |
hit_type.keywords = 'python, programming' | |
hit_type.reward = 0.10 | |
hit_type.qualifications.add :approval_rate, { :gt => 85 } | |
end | |
# note: attributes cannot be overridden see API spec. | |
hits = [] | |
2.times do |i| | |
hits << RTurk::Hit.create(:title => "Python#{i}") do |hit| | |
hit.hit_type_id = hit_type.type_id | |
hit.lifetime = 3600 | |
hit.assignments = 500 | |
hit.description = "Python Programming #{i}!" | |
hit.question("http://localhost:3000/mturk") | |
hit.keywords = "python, programming" | |
hit.reward = 0.10 | |
hit.qualifications.add :approval_rate, { :gt => 80 + i } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment