ruby-aws 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.gemtest +0 -0
  3. data/History.txt +75 -0
  4. data/LICENSE.txt +202 -0
  5. data/Manifest.txt +72 -0
  6. data/NOTICE.txt +4 -0
  7. data/README.txt +105 -0
  8. data/Rakefile +33 -0
  9. data/bin/ruby-aws +9 -0
  10. data/lib/amazon/util.rb +10 -0
  11. data/lib/amazon/util/binder.rb +48 -0
  12. data/lib/amazon/util/data_reader.rb +169 -0
  13. data/lib/amazon/util/filter_chain.rb +79 -0
  14. data/lib/amazon/util/hash_nesting.rb +93 -0
  15. data/lib/amazon/util/lazy_results.rb +59 -0
  16. data/lib/amazon/util/logging.rb +23 -0
  17. data/lib/amazon/util/paginated_iterator.rb +70 -0
  18. data/lib/amazon/util/proactive_results.rb +116 -0
  19. data/lib/amazon/util/threadpool.rb +129 -0
  20. data/lib/amazon/util/user_data_store.rb +100 -0
  21. data/lib/amazon/webservices/mechanical_turk.rb +123 -0
  22. data/lib/amazon/webservices/mechanical_turk_requester.rb +274 -0
  23. data/lib/amazon/webservices/mturk/mechanical_turk_error_handler.rb +150 -0
  24. data/lib/amazon/webservices/mturk/question_generator.rb +58 -0
  25. data/lib/amazon/webservices/util/amazon_authentication_relay.rb +72 -0
  26. data/lib/amazon/webservices/util/command_line.rb +157 -0
  27. data/lib/amazon/webservices/util/convenience_wrapper.rb +90 -0
  28. data/lib/amazon/webservices/util/filter_proxy.rb +45 -0
  29. data/lib/amazon/webservices/util/mock_transport.rb +70 -0
  30. data/lib/amazon/webservices/util/request_signer.rb +42 -0
  31. data/lib/amazon/webservices/util/rest_transport.rb +120 -0
  32. data/lib/amazon/webservices/util/soap_simplifier.rb +48 -0
  33. data/lib/amazon/webservices/util/soap_transport.rb +20 -0
  34. data/lib/amazon/webservices/util/soap_transport_header_handler.rb +27 -0
  35. data/lib/amazon/webservices/util/unknown_result_exception.rb +27 -0
  36. data/lib/amazon/webservices/util/validation_exception.rb +55 -0
  37. data/lib/amazon/webservices/util/xml_simplifier.rb +61 -0
  38. data/lib/ruby-aws.rb +19 -0
  39. data/lib/ruby-aws/version.rb +6 -0
  40. data/run_rcov.sh +1 -0
  41. data/samples/mturk/best_image/BestImage.rb +61 -0
  42. data/samples/mturk/best_image/best_image.properties +39 -0
  43. data/samples/mturk/best_image/best_image.question +82 -0
  44. data/samples/mturk/blank_slate/BlankSlate.rb +63 -0
  45. data/samples/mturk/blank_slate/BlankSlate_multithreaded.rb +67 -0
  46. data/samples/mturk/helloworld/MTurkHelloWorld.rb +56 -0
  47. data/samples/mturk/helloworld/mturk.yml +8 -0
  48. data/samples/mturk/review_policy/ReviewPolicy.rb +139 -0
  49. data/samples/mturk/review_policy/review_policy.question +30 -0
  50. data/samples/mturk/reviewer/Reviewer.rb +103 -0
  51. data/samples/mturk/reviewer/mturk.yml +8 -0
  52. data/samples/mturk/simple_survey/SimpleSurvey.rb +90 -0
  53. data/samples/mturk/simple_survey/simple_survey.question +30 -0
  54. data/samples/mturk/site_category/SiteCategory.rb +87 -0
  55. data/samples/mturk/site_category/externalpage.htm +71 -0
  56. data/samples/mturk/site_category/site_category.input +6 -0
  57. data/samples/mturk/site_category/site_category.properties +45 -0
  58. data/samples/mturk/site_category/site_category.question +9 -0
  59. data/test/mturk/test_changehittypeofhit.rb +130 -0
  60. data/test/mturk/test_error_handler.rb +137 -0
  61. data/test/mturk/test_mechanical_turk_requester.rb +178 -0
  62. data/test/mturk/test_mock_mechanical_turk_requester.rb +205 -0
  63. data/test/test_ruby-aws.rb +24 -0
  64. data/test/unit/test_binder.rb +89 -0
  65. data/test/unit/test_data_reader.rb +135 -0
  66. data/test/unit/test_exceptions.rb +32 -0
  67. data/test/unit/test_hash_nesting.rb +99 -0
  68. data/test/unit/test_lazy_results.rb +89 -0
  69. data/test/unit/test_mock_transport.rb +132 -0
  70. data/test/unit/test_paginated_iterator.rb +58 -0
  71. data/test/unit/test_proactive_results.rb +108 -0
  72. data/test/unit/test_question_generator.rb +55 -0
  73. data/test/unit/test_threadpool.rb +50 -0
  74. data/test/unit/test_user_data_store.rb +80 -0
  75. metadata +238 -0
  76. metadata.gz.sig +0 -0
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <QuestionForm xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionForm.xsd">
3
+ <Question>
4
+ <QuestionIdentifier>q1</QuestionIdentifier>
5
+ <QuestionContent>
6
+ <Text>What is 1 + 1?</Text>
7
+ </QuestionContent>
8
+ <AnswerSpecification>
9
+ <FreeTextAnswer/>
10
+ </AnswerSpecification>
11
+ </Question>
12
+ <Question>
13
+ <QuestionIdentifier>q2</QuestionIdentifier>
14
+ <QuestionContent>
15
+ <Text>What is 2 + 2?</Text>
16
+ </QuestionContent>
17
+ <AnswerSpecification>
18
+ <FreeTextAnswer/>
19
+ </AnswerSpecification>
20
+ </Question>
21
+ <Question>
22
+ <QuestionIdentifier>q3</QuestionIdentifier>
23
+ <QuestionContent>
24
+ <Text>What color is the sky?</Text>
25
+ </QuestionContent>
26
+ <AnswerSpecification>
27
+ <FreeTextAnswer/>
28
+ </AnswerSpecification>
29
+ </Question>
30
+ </QuestionForm>
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Copyright:: Copyright (c) 2007 Amazon Technologies, Inc.
4
+ # License:: Apache License, Version 2.0
5
+
6
+ begin ; require 'rubygems' ; rescue LoadError ; end
7
+
8
+ # The Reviewer sample application will retrieve the completed assignments for a given HIT,
9
+ # output the results and approve the assignment.
10
+ #
11
+ # mturk.yml is used to configure default settings ( must be in the same directory as Reviewer.rb )
12
+ # You will need to have the HIT ID of an existing HIT that has been accepted, completed and
13
+ # submitted by a worker.
14
+ # Or you can use the .success file generated from bulk loading several HITs (i.e. Site Category sample application).
15
+ #
16
+ # The following concepts are covered:
17
+ # - Retrieve results for a HIT
18
+ # - Output results for several HITs to a file
19
+ # - Approve assignments
20
+
21
+ require 'ruby-aws'
22
+ @mturk = Amazon::WebServices::MechanicalTurkRequester.new :Config => File.join( File.dirname(__FILE__), 'mturk.yml' )
23
+
24
+ # Prints the submitted results of HITs when provided with a .success file.
25
+ # successFile:: The .success file containing the HIT ID and HIT Type ID
26
+ # outputFile:: The output file to write the submitted results to
27
+ def printResults( successFile, outputFile)
28
+
29
+ # Loads the .success file containing the HIT IDs and HIT Type IDs of HITs to be retrieved.
30
+ success = Amazon::Util::DataReader.load( successFile, :Tabular )
31
+
32
+ # Retrieves the submitted results of the specified HITs from Mechanical Turk
33
+ results = @mturk.getHITResults(success)
34
+
35
+ # parse answers to they're easier to digest
36
+ results.each { |assignment| assignment[:Answers] = @mturk.simplifyAnswer( assignment[:Answer] ) }
37
+
38
+ # Writes the submitted results to the defined output file.
39
+ # The output file is a tab delimited file containing all relevant details
40
+ # of the HIT and assignments. The submitted results are included as the last set of fields
41
+ # and are represented as tab separated question/answer pairs
42
+ Amazon::Util::DataReader.save( outputFile, results, :Tabular )
43
+ puts "Results have been written to: #{outputFile}"
44
+
45
+ end
46
+
47
+ # Prints the submitted results of a HIT when provided with a HIT ID.
48
+ # hitId:: The HIT ID of the HIT to be retrieved.
49
+ def reviewAnswers( hitId )
50
+ assignments = @mturk.getAssignmentsForHITAll( :HITId => hitId, :AssignmentStatus => 'Submitted')
51
+
52
+ puts "--[Reviewing HITs]----------"
53
+ puts " HIT Id: #{hitId}"
54
+
55
+ assignments.each do |assignment|
56
+
57
+ # By default, answers are specified in XML
58
+ answerXML = assignment[:Answer]
59
+
60
+ # Calling a convenience method that will parse the answer XML and extract out the question/answer pairs.
61
+ answers = @mturk.simplifyAnswer( answerXML )
62
+
63
+ answers.each do |id,answer|
64
+ assignmentId = assignment[:AssignmentId]
65
+ puts "Got an answer \"#{answer}\" for \"#{id}\" from worker #{assignment[:WorkerId]}"
66
+ end
67
+
68
+ # Approving the assignment
69
+ @mturk.approveAssignment(:AssignmentId => assignment[:AssignmentId], :RequesterFeedback => "Well Done!")
70
+ puts "Approved."
71
+
72
+ end
73
+ puts "--[End Reviewing HITs]----------"
74
+ end
75
+
76
+ require 'optparse'
77
+ hitsToReview = []
78
+ opts = OptionParser.new
79
+ opts.on( '--review HITId', 'Review Answers for a single HIT ( can be specified multiple times)') {|hit| hitsToReview << hit ; @review = true }
80
+ opts.on( '--results', 'Print Results using input and output files') { @getResults = true }
81
+ opts.on( '--input FILE', 'Input File to get results') {|file| @inputFile = file }
82
+ opts.on( '--output FILE', 'Output File to save results') {|file| @outputFile = file }
83
+
84
+ begin
85
+ opts.parse ARGV
86
+ raise "Please, either --review or --results, not both" if @review && @getResults
87
+ raise "Pick something to do ( either --review or --results )" unless @review || @getResults
88
+ if @getResults
89
+ raise "missing input file" unless @inputFile
90
+ raise "missing output file" unless @outputFile
91
+ raise "input file does not exist: #{@inputFile}" unless File.exists? @inputFile
92
+ end
93
+ rescue => e
94
+ puts e.message
95
+ puts opts.to_s
96
+ exit
97
+ end
98
+
99
+ if @getResults
100
+ printResults( @inputFile, @outputFile )
101
+ elsif @review
102
+ hitsToReview.each {|h| reviewAnswers(h) }
103
+ end
@@ -0,0 +1,8 @@
1
+ # Your AWSAccessKeyId ( leave commented to use global default )
2
+ # AWSAccessKeyId: <need access key id>
3
+
4
+ # Your AWSAccessKey ( leave commented to use global default )
5
+ # AWSAccessKey: <need access key>
6
+
7
+ # Host to talk to ( Prod or Sandbox )
8
+ Host: Sandbox
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Copyright:: Copyright (c) 2007 Amazon Technologies, Inc.
4
+ # License:: Apache License, Version 2.0
5
+
6
+ begin ; require 'rubygems' ; rescue LoadError ; end
7
+
8
+ # The Simple Survey sample application will create a HIT asking a worker to indicate their
9
+ # political party preferences.
10
+ #
11
+ # mturk.properties must be found in the current file path.
12
+ #
13
+ # The following concepts are covered:
14
+ # - File based QuestionForm HIT loading
15
+ # - Using a locale qualification
16
+
17
+ require 'ruby-aws'
18
+ @mturk = Amazon::WebServices::MechanicalTurkRequester.new
19
+
20
+
21
+ # Check to see if your account has sufficient funds
22
+ def hasEnoughFunds?
23
+ available = @mturk.availableFunds
24
+ puts "Got account balance: %.2f" % available
25
+ return available > 0.055
26
+ end
27
+
28
+ def getHITUrl( hitTypeId )
29
+ if @mturk.host =~ /sandbox/
30
+ "http://workersandbox.mturk.com/mturk/preview?groupId=#{hitTypeId}" # Sandbox Url
31
+ else
32
+ "http://mturk.com/mturk/preview?groupId=#{hitTypeId}" # Production Url
33
+ end
34
+ end
35
+
36
+ # Creates the simple survey.
37
+ def createSimpleSurvey
38
+ title = "What is your political preference?"
39
+ description = "This is a simple survey HIT created by the Amazon Mechanical Turk SDK for Ruby."
40
+ numAssignments = 1
41
+ reward = { :Amount => 0.05, :CurrencyCode => 'USD' }
42
+ keywords = "sample, SDK, survey"
43
+ assignmentDurationInSeconds = 60 * 60 # 1 hour
44
+ autoApprovalDelayInSeconds = 60 * 60 # 1 hour
45
+ lifetimeInSeconds = 60 * 60 # 1 hour
46
+ requesterAnnotation = "sample#survey"
47
+
48
+ # Defining the location of the externalized question (QuestionForm) file.
49
+ rootDir = File.dirname $0
50
+ questionFile = rootDir + "/simple_survey.question"
51
+
52
+
53
+ # This is an example of creating a qualification.
54
+ # This is a built-in qualification -- user must be based in the US
55
+ qualReq = { :QualificationTypeId => Amazon::WebServices::MechanicalTurkRequester::LOCALE_QUALIFICATION_TYPE_ID,
56
+ :Comparator => 'EqualTo',
57
+ :LocaleValue => {:Country => 'US'}, }
58
+
59
+ # The create HIT method takes in an array of QualificationRequirements since a HIT can have multiple qualifications.
60
+ qualReqs = [qualReq]
61
+
62
+ # Loading the question (QuestionForm) file
63
+ question = File.read( questionFile )
64
+
65
+ # Creating the HIT and loading it into Mechanical Turk
66
+ hit = @mturk.createHIT( :Title => title,
67
+ :Description => description,
68
+ :Keywords => keywords,
69
+ :Question => question,
70
+ :Reward => reward,
71
+ :AssignmentDurationInSeconds => assignmentDurationInSeconds,
72
+ :AutoApprovalDelayInSeconds => autoApprovalDelayInSeconds,
73
+ :LifetimeInSeconds => lifetimeInSeconds,
74
+ :MaxAssignments => numAssignments,
75
+ :RequesterAnnotation => requesterAnnotation,
76
+ :QualificationRequirement => qualReqs )
77
+
78
+ puts "Created HIT: #{hit[:HITId]}"
79
+ puts "Url: #{getHITUrl( hit[:HITTypeId] )}"
80
+
81
+ # Demonstrates how a HIT can be retrieved if you know its HIT ID
82
+ hit2 = @mturk.getHIT(:HITId => hit[:HITId])
83
+
84
+ puts "Retrieved HIT: #{hit2[:HITId]}"
85
+
86
+ puts "Oops! The HIT Ids shoud match: #{hit[:HITId]}, #{hit2[:HITId]}" unless hit[:HITId] == hit2[:HITId]
87
+
88
+ end
89
+
90
+ createSimpleSurvey if hasEnoughFunds?
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <QuestionForm xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionForm.xsd">
3
+ <Question>
4
+ <QuestionIdentifier>1</QuestionIdentifier>
5
+ <QuestionContent>
6
+ <Text>What is your political party affiliation?</Text>
7
+ </QuestionContent>
8
+ <AnswerSpecification>
9
+ <SelectionAnswer>
10
+ <MinSelectionCount>1</MinSelectionCount>
11
+ <MaxSelectionCount>1</MaxSelectionCount>
12
+ <StyleSuggestion>radiobutton</StyleSuggestion>
13
+ <Selections>
14
+ <Selection>
15
+ <SelectionIdentifier>republican</SelectionIdentifier>
16
+ <Text>Republican</Text>
17
+ </Selection>
18
+ <Selection>
19
+ <SelectionIdentifier>democrat</SelectionIdentifier>
20
+ <Text>Democrat</Text>
21
+ </Selection>
22
+ <Selection>
23
+ <SelectionIdentifier>noneoftheabove</SelectionIdentifier>
24
+ <Text>None of the Above</Text>
25
+ </Selection>
26
+ </Selections>
27
+ </SelectionAnswer>
28
+ </AnswerSpecification>
29
+ </Question>
30
+ </QuestionForm>
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Copyright:: Copyright (c) 2007 Amazon Technologies, Inc.
4
+ # License:: Apache License, Version 2.0
5
+
6
+ begin ; require 'rubygems' ; rescue LoadError ; end
7
+
8
+ # The Site Category sample application will create 5 HITs asking workers to categorize websites into predefined categories.
9
+ #
10
+ # The following concepts are covered:
11
+ # - Bulk load HITs using an input file
12
+ # - File based HIT loading
13
+
14
+ require 'ruby-aws'
15
+ @mturk = Amazon::WebServices::MechanicalTurkRequester.new
16
+
17
+ # Check to see if your account has sufficient funds
18
+ def hasEnoughFunds?
19
+ available = @mturk.availableFunds
20
+ puts "Got account balance: %.2f" % available
21
+ return available > (0.055 * 5)
22
+ end
23
+
24
+ def getHITUrl( hitTypeId )
25
+ if @mturk.host =~ /sandbox/
26
+ "http://workersandbox.mturk.com/mturk/preview?groupId=#{hitTypeId}" # Sandbox Url
27
+ else
28
+ "http://mturk.com/mturk/preview?groupId=#{hitTypeId}" # Production Url
29
+ end
30
+ end
31
+
32
+ # Create the website category HITs.
33
+ def createSiteCategoryHITs
34
+
35
+ # Defining the locations of the input files
36
+ rootDir = File.dirname $0
37
+ inputFile = rootDir + "/site_category.input"
38
+ propertiesFile = rootDir + "/site_category.properties"
39
+ questionFile = rootDir + "/site_category.question"
40
+
41
+ # Loading the input file. The input file is a tab delimited file where the first row
42
+ # defines the fields/variables and the remaining rows contain the values for each HIT.
43
+ # Each row represents a unique HIT. ERB is used to merge the values into the Question template.
44
+ input = Amazon::Util::DataReader.load( inputFile, :Tabular )
45
+
46
+ # Loading the question (QuestionForm) file
47
+ question = File.read( questionFile )
48
+
49
+ # Loading the HIT properties file. The properties file defines two system qualifications that will
50
+ # be used for the HIT. The properties file can also be an ERB template. This allows the developer
51
+ # to "tie in" the input value to the results.
52
+ props = Amazon::Util::DataReader.load( propertiesFile, :Properties )
53
+
54
+ hits = [];
55
+
56
+ # Create multiple HITs using the input, properties, and question files
57
+
58
+ puts "--[Loading HITs]----------"
59
+ startTime = Time.now
60
+ puts " Start time: #{startTime}"
61
+
62
+ # The simpliest way to bulk load a large number of HITs where all details are defined in files.
63
+ # This method returns a hash with two arrays:
64
+ # - :Created is an array of successfully created HITs
65
+ # - :Failed is an array of lines we failed to create HITs with
66
+ hits = @mturk.createHITs(props, question, input);
67
+
68
+ puts "--[End Loading HITs]----------"
69
+ endTime = Time.now
70
+ puts " End time: #{endTime}"
71
+ puts "--[Done Loading HITs]----------"
72
+ puts " Total load time: #{ endTime - startTime } seconds."
73
+
74
+ hit_ids = hits[:Created].collect {|h| h[:HITId] }
75
+ hit_type_id = hits[:Created].first[:HITTypeId]
76
+
77
+ puts " Created HITs: #{hit_ids.join(' ')}"
78
+ puts " Url: #{getHITUrl( hit_type_id )}"
79
+
80
+ # We'll save the results to hits.success and hits.failure
81
+ Amazon::Util::DataReader.save( rootDir + "/hits.success", hits[:Created], :Tabular )
82
+ Amazon::Util::DataReader.save( rootDir + "/hits.failure", hits[:Failed], :Tabular )
83
+ # The .success file can be used in subsequent operations to retrieve the results that workers submitted.
84
+
85
+ end
86
+
87
+ createSiteCategoryHITs if hasEnoughFunds?
@@ -0,0 +1,71 @@
1
+ <!-- This file needs to be hosted on an external server. -->
2
+ <html>
3
+ <script language="Javascript">
4
+ //
5
+ // This method Gets URL Parameters (GUP)
6
+ //
7
+ function gup( name )
8
+ {
9
+ var regexS = "[\\?&]"+name+"=([^&#]*)";
10
+ var regex = new RegExp( regexS );
11
+ var tmpURL = window.location.href;
12
+ var results = regex.exec( tmpURL );
13
+ if( results == null )
14
+ return "";
15
+ else
16
+ return results[1];
17
+ }
18
+
19
+ //
20
+ // This method decodes the query parameters that were URL-encoded
21
+ //
22
+ function decode(strToDecode)
23
+ {
24
+ var encoded = strToDecode;
25
+ return unescape(encoded.replace(/\+/g, " "));
26
+ }
27
+
28
+ </script>
29
+ <body>
30
+ <form id="mturk_form" method="POST" action="http://www.mturk.com/mturk/externalSubmit">
31
+ <input type="hidden" id="assignmentId" name="assignmentId" value="">
32
+ <table border="0" height="100%" width="100%">
33
+ <tr><td>
34
+ <h1>What type of webpage is shown below?</h1>
35
+ <p>
36
+ <input type="radio" name="category" value="news">&nbsp;News Site<br>
37
+ <input type="radio" name="category" value="search">&nbsp;Search Engine<br>
38
+ <input type="radio" name="category" value="retail">&nbsp;Online Retailer<br>
39
+ <input type="radio" name="category" value="other" selected>&nbsp;Other<br>
40
+ <p>
41
+ <input id="submitButton" type="submit" name="Submit" value="Submit">
42
+ <p>
43
+ </td></tr>
44
+ <tr><td height="100%">
45
+ <iframe id="pageFrame" width="100%" height="100%"></iframe>
46
+ </td></tr>
47
+ </table>
48
+ </form>
49
+ <script language="Javascript">
50
+ document.getElementById('pageFrame').src = decode(gup('url'));
51
+ document.getElementById('assignmentId').value = gup('assignmentId');
52
+
53
+
54
+ //
55
+ // Check if the worker is PREVIEWING the HIT or if they've ACCEPTED the HIT
56
+ //
57
+ if (gup('assignmentId') == "ASSIGNMENT_ID_NOT_AVAILABLE")
58
+ {
59
+ // If we're previewing, disable the button and give it a helpful message
60
+ document.getElementById('submitButton').disabled = true;
61
+ document.getElementById('submitButton').value = "You must ACCEPT the HIT before you can submit the results.";
62
+ } else {
63
+ var form = document.getElementById('mturk_form');
64
+ if (document.referrer && ( document.referrer.indexOf('workersandbox') != -1) ) {
65
+ form.action = "http://workersandbox.mturk.com/mturk/externalSubmit";
66
+ }
67
+ }
68
+
69
+ </script>
70
+ </body>
71
+ </html>
@@ -0,0 +1,6 @@
1
+ urls
2
+ http://www.reuters.com/
3
+ http://www.google.com/
4
+ http://www.amazon.com/
5
+ http://www.apple.com/
6
+ http://www.yahoo.com/
@@ -0,0 +1,45 @@
1
+ ######################################
2
+ ## External HIT Properties
3
+ ######################################
4
+
5
+ Title:What website is this?
6
+ Description:Please look at this website and tell us, in simple words, what website this is.
7
+ Keywords:category, website, SDK, sample
8
+ Reward.Amount:0.05
9
+ Reward.CurrencyCode:USD
10
+ MaxAssignments:1
11
+
12
+ #Notice the use of ERB template directives here.
13
+ #This allows the input file to define the value of the HIT level annotation field.
14
+ RequesterAnnotation:<%= @urls %>
15
+
16
+ ######################################
17
+ ## HIT Timing Properties
18
+ ######################################
19
+
20
+ # this Assignment Duration value is 60 * 60 = 1 hour
21
+ AssignmentDuration:3600
22
+
23
+ # this HIT Lifetime value is 60 * 60 = 1 hour
24
+ LifetimeInSeconds:3600
25
+
26
+ # this Auto Approval period is 60 * 60 = 1 hour
27
+ AutoApprovalDelayInSeconds:3600
28
+
29
+ ######################################
30
+ ## Qualification Properties
31
+ ######################################
32
+
33
+ # In this example, two system qualifications are specified for the HIT.
34
+
35
+ # this is a built-in qualification -- user must have an approval rate of 25% or greater
36
+ QualificationRequirement.1.QualificationTypeId:000000000000000000L0
37
+ QualificationRequirement.1.Comparator:GreaterThan
38
+ QualificationRequirement.1.IntegerValue:25
39
+ QualificationRequirement.1.RequiredToPreview:false
40
+
41
+ # this is a built-in qualification -- user must have an abandonment rate of 50% or less
42
+ QualificationRequirement.2.QualificationTypeId:00000000000000000070
43
+ QualificationRequirement.2.Comparator:LessThan
44
+ QualificationRequirement.2.IntegerValue:51
45
+ QualificationRequirement.2.RequiredToPreview:true