rturk 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/README.markdown +3 -2
  2. data/Rakefile +10 -4
  3. data/VERSION +1 -1
  4. data/aws_docs/ApiReference_AnswerKeyDataStructureArticle.html +98 -0
  5. data/aws_docs/ApiReference_ApproveAssignmentOperation.html +75 -0
  6. data/aws_docs/ApiReference_AssignQualificationOperation.html +107 -0
  7. data/aws_docs/ApiReference_AssignmentDataStructureArticle.html +171 -0
  8. data/aws_docs/ApiReference_BlockWorkerOperation.html +70 -0
  9. data/aws_docs/ApiReference_ChangeHITTypeOfHITOperation.html +68 -0
  10. data/aws_docs/ApiReference_CommonParametersArticle.html +119 -0
  11. data/aws_docs/ApiReference_CreateHITOperation.html +330 -0
  12. data/aws_docs/ApiReference_CreateQualificationTypeOperation.html +190 -0
  13. data/aws_docs/ApiReference_DataStructuresArticle.html +7 -0
  14. data/aws_docs/ApiReference_DisableHITOperation.html +63 -0
  15. data/aws_docs/ApiReference_DisposeHITOperation.html +56 -0
  16. data/aws_docs/ApiReference_DisposeQualificationTypeOperation.html +52 -0
  17. data/aws_docs/ApiReference_ExtendHITOperation.html +86 -0
  18. data/aws_docs/ApiReference_ExternalQuestionArticle.html +125 -0
  19. data/aws_docs/ApiReference_ForceExpireHITOperation.html +61 -0
  20. data/aws_docs/ApiReference_FormattedContentXHTMLArticle.html +289 -0
  21. data/aws_docs/ApiReference_GetAccountBalanceOperation.html +51 -0
  22. data/aws_docs/ApiReference_GetAssignmentsForHITOperation.html +166 -0
  23. data/aws_docs/ApiReference_GetBonusPaymentsOperation.html +160 -0
  24. data/aws_docs/ApiReference_GetFileUploadURLOperation.html +75 -0
  25. data/aws_docs/ApiReference_GetHITOperation.html +89 -0
  26. data/aws_docs/ApiReference_GetHITsForQualificationTypeOperation.html +137 -0
  27. data/aws_docs/ApiReference_GetQualificationRequestsOperation.html +155 -0
  28. data/aws_docs/ApiReference_GetQualificationScoreOperation.html +68 -0
  29. data/aws_docs/ApiReference_GetQualificationTypeOperation.html +57 -0
  30. data/aws_docs/ApiReference_GetQualificationsForQualificationTypeOperation.html +134 -0
  31. data/aws_docs/ApiReference_GetRequesterStatisticOperation.html +315 -0
  32. data/aws_docs/ApiReference_GetReviewableHITsOperation.html +155 -0
  33. data/aws_docs/ApiReference_GrantBonusOperation.html +95 -0
  34. data/aws_docs/ApiReference_GrantQualificationOperation.html +69 -0
  35. data/aws_docs/ApiReference_HITDataStructureArticle.html +302 -0
  36. data/aws_docs/ApiReference_HelpOperation.html +125 -0
  37. data/aws_docs/ApiReference_LocaleDataStructureArticle.html +29 -0
  38. data/aws_docs/ApiReference_NotificationAPI_BuildingANotificationReceptor.html +36 -0
  39. data/aws_docs/ApiReference_NotificationAPI_ElementsOfANotification.html +40 -0
  40. data/aws_docs/ApiReference_NotificationDataStructureArticle.html +73 -0
  41. data/aws_docs/ApiReference_NotificationReceptorAPIArticle.html +9 -0
  42. data/aws_docs/ApiReference_NotificationReceptorAPI_RESTTransportArticle.html +39 -0
  43. data/aws_docs/ApiReference_NotificationReceptorAPI_SOAPTransportArticle.html +45 -0
  44. data/aws_docs/ApiReference_NotifyWorkersOperation.html +82 -0
  45. data/aws_docs/ApiReference_OperationsArticle.html +8 -0
  46. data/aws_docs/ApiReference_PriceDataStructureArticle.html +65 -0
  47. data/aws_docs/ApiReference_QualificationDataStructureArticle.html +89 -0
  48. data/aws_docs/ApiReference_QualificationRequestDataStructureArticle.html +102 -0
  49. data/aws_docs/ApiReference_QualificationRequirementDataStructureArticle.html +176 -0
  50. data/aws_docs/ApiReference_QualificationTypeDataStructureArticle.html +198 -0
  51. data/aws_docs/ApiReference_QuestionAnswerDataArticle.html +8 -0
  52. data/aws_docs/ApiReference_QuestionFormAnswersDataStructureArticle.html +54 -0
  53. data/aws_docs/ApiReference_QuestionFormDataStructureArticle.html +796 -0
  54. data/aws_docs/ApiReference_RegisterHITTypeOperation.html +149 -0
  55. data/aws_docs/ApiReference_RejectAssignmentOperation.html +66 -0
  56. data/aws_docs/ApiReference_RejectQualificationRequestOperation.html +61 -0
  57. data/aws_docs/ApiReference_RevokeQualificationOperation.html +78 -0
  58. data/aws_docs/ApiReference_SearchHITsOperation.html +164 -0
  59. data/aws_docs/ApiReference_SearchQualificationTypesOperation.html +211 -0
  60. data/aws_docs/ApiReference_SendTestEventNotificationOperation.html +78 -0
  61. data/aws_docs/ApiReference_SetHITAsReviewingOperation.html +73 -0
  62. data/aws_docs/ApiReference_SetHITTypeNotificationOperation.html +99 -0
  63. data/aws_docs/ApiReference_UnblockWorkerOperation.html +67 -0
  64. data/aws_docs/ApiReference_UpdateQualificationScoreOperation.html +77 -0
  65. data/aws_docs/ApiReference_UpdateQualificationTypeOperation.html +180 -0
  66. data/aws_docs/ApiReference_WsdlLocationArticle.html +95 -0
  67. data/aws_docs/ApiReference_XMLParameterValuesArticle.html +37 -0
  68. data/aws_docs/Welcome.html +125 -0
  69. data/aws_docs/WhatsNew.html +16 -0
  70. data/aws_docs/_title.html +28 -0
  71. data/aws_docs/_toc.html +749 -0
  72. data/aws_docs/aws-docs-IE.css +419 -0
  73. data/aws_docs/aws-docs.css +455 -0
  74. data/aws_docs/copyrightinfo.html +14 -0
  75. data/aws_docs/frameset.js +12 -0
  76. data/aws_docs/images/Feedback_link.gif +0 -0
  77. data/aws_docs/images/caution.png +0 -0
  78. data/aws_docs/images/home.gif +0 -0
  79. data/aws_docs/images/important.png +0 -0
  80. data/aws_docs/images/next.gif +0 -0
  81. data/aws_docs/images/note.png +0 -0
  82. data/aws_docs/images/prev.gif +0 -0
  83. data/aws_docs/images/tip.png +0 -0
  84. data/aws_docs/images/title-swoosh-logo.gif +0 -0
  85. data/aws_docs/images/toc_bullet.gif +0 -0
  86. data/aws_docs/images/toc_plus.gif +0 -0
  87. data/aws_docs/index.html +18 -0
  88. data/aws_docs/toc.js +84 -0
  89. data/lib/rturk.rb +2 -2
  90. data/lib/rturk/adapter.rb +11 -0
  91. data/lib/rturk/adapters/assignment.rb +13 -50
  92. data/lib/rturk/adapters/hit.rb +21 -9
  93. data/lib/rturk/adapters/worker.rb +23 -0
  94. data/lib/rturk/operation.rb +1 -1
  95. data/lib/rturk/operations/create_hit.rb +10 -54
  96. data/lib/rturk/operations/register_hit_type.rb +68 -0
  97. data/lib/rturk/operations/search_hits.rb +44 -0
  98. data/lib/rturk/parser.rb +8 -0
  99. data/lib/rturk/parsers/answer_parser.rb +29 -0
  100. data/lib/rturk/parsers/assignment_parser.rb +49 -0
  101. data/lib/rturk/parsers/hit_parser.rb +50 -0
  102. data/lib/rturk/{response.rb → parsers/response.rb} +7 -2
  103. data/lib/rturk/{responses → parsers/responses}/create_hit_response.rb +2 -2
  104. data/lib/rturk/{responses → parsers/responses}/get_account_balance_response.rb +0 -0
  105. data/lib/rturk/{responses → parsers/responses}/get_assignments_for_hit_response.rb +3 -3
  106. data/lib/rturk/{responses → parsers/responses}/get_hit_response.rb +9 -16
  107. data/lib/rturk/{responses → parsers/responses}/get_reviewable_hits_response.rb +3 -5
  108. data/lib/rturk/parsers/responses/register_hit_type_response.rb +17 -0
  109. data/lib/rturk/parsers/responses/search_hits_response.rb +65 -0
  110. data/lib/rturk/xml_utilities.rb +14 -3
  111. data/rturk.gemspec +112 -12
  112. data/spec/adapters/hit_spec.rb +10 -0
  113. data/spec/fake_responses/register_hit_type.xml +6 -0
  114. data/spec/fake_responses/search_hits.xml +50 -0
  115. data/spec/operations/create_hit_spec.rb +2 -2
  116. data/spec/operations/get_hit_spec.rb +1 -1
  117. data/spec/operations/register_hit_type_spec.rb +24 -0
  118. data/spec/{adapters/answers_spec.rb → parsers/answer_parser_spec.rb} +2 -2
  119. data/spec/parsers/hit_parser_spec.rb +41 -0
  120. data/spec/xml_parse_spec.rb +2 -2
  121. metadata +111 -11
  122. data/lib/rturk/adapters/answers.rb +0 -38
@@ -1,4 +1,4 @@
1
- module RTurk::XmlUtilities
1
+ module RTurk::XMLUtilities
2
2
 
3
3
  def xml_to_hash(noko_xml)
4
4
  hash = {}
@@ -15,9 +15,20 @@ module RTurk::XmlUtilities
15
15
 
16
16
  def map_content(xml_obj, hash)
17
17
  hash.each_pair do |k,v|
18
- self.send("#{k.to_s}=", xml_obj.xpath(v).inner_text)
18
+ val = xml_obj.xpath(v).inner_text.strip
19
+ if val.match(/^[0-9]+$/)
20
+ val = val.to_i
21
+ elsif val.match(/^[0-9\.]+$/)
22
+ val = val.to_f
23
+ elsif val.match(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T.+/)
24
+ val = Time.parse(val)
25
+ end
26
+ if self.respond_to?("#{k.to_s}=")
27
+ self.send("#{k.to_s}=", val)
28
+ else
29
+ self.instance_variable_set("@#{k}", val)
30
+ end
19
31
  end
20
32
  end
21
33
 
22
-
23
34
  end
data/rturk.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rturk}
8
- s.version = "2.0.2"
8
+ s.version = "2.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mark Percival"]
12
- s.date = %q{2009-10-27}
12
+ s.date = %q{2009-11-01}
13
13
  s.email = %q{mark@mpercival.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -24,15 +24,101 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "TODO.markdown",
26
26
  "VERSION",
27
+ "aws_docs/ApiReference_AnswerKeyDataStructureArticle.html",
28
+ "aws_docs/ApiReference_ApproveAssignmentOperation.html",
29
+ "aws_docs/ApiReference_AssignQualificationOperation.html",
30
+ "aws_docs/ApiReference_AssignmentDataStructureArticle.html",
31
+ "aws_docs/ApiReference_BlockWorkerOperation.html",
32
+ "aws_docs/ApiReference_ChangeHITTypeOfHITOperation.html",
33
+ "aws_docs/ApiReference_CommonParametersArticle.html",
34
+ "aws_docs/ApiReference_CreateHITOperation.html",
35
+ "aws_docs/ApiReference_CreateQualificationTypeOperation.html",
36
+ "aws_docs/ApiReference_DataStructuresArticle.html",
37
+ "aws_docs/ApiReference_DisableHITOperation.html",
38
+ "aws_docs/ApiReference_DisposeHITOperation.html",
39
+ "aws_docs/ApiReference_DisposeQualificationTypeOperation.html",
40
+ "aws_docs/ApiReference_ExtendHITOperation.html",
41
+ "aws_docs/ApiReference_ExternalQuestionArticle.html",
42
+ "aws_docs/ApiReference_ForceExpireHITOperation.html",
43
+ "aws_docs/ApiReference_FormattedContentXHTMLArticle.html",
44
+ "aws_docs/ApiReference_GetAccountBalanceOperation.html",
45
+ "aws_docs/ApiReference_GetAssignmentsForHITOperation.html",
46
+ "aws_docs/ApiReference_GetBonusPaymentsOperation.html",
47
+ "aws_docs/ApiReference_GetFileUploadURLOperation.html",
48
+ "aws_docs/ApiReference_GetHITOperation.html",
49
+ "aws_docs/ApiReference_GetHITsForQualificationTypeOperation.html",
50
+ "aws_docs/ApiReference_GetQualificationRequestsOperation.html",
51
+ "aws_docs/ApiReference_GetQualificationScoreOperation.html",
52
+ "aws_docs/ApiReference_GetQualificationTypeOperation.html",
53
+ "aws_docs/ApiReference_GetQualificationsForQualificationTypeOperation.html",
54
+ "aws_docs/ApiReference_GetRequesterStatisticOperation.html",
55
+ "aws_docs/ApiReference_GetReviewableHITsOperation.html",
56
+ "aws_docs/ApiReference_GrantBonusOperation.html",
57
+ "aws_docs/ApiReference_GrantQualificationOperation.html",
58
+ "aws_docs/ApiReference_HITDataStructureArticle.html",
59
+ "aws_docs/ApiReference_HelpOperation.html",
60
+ "aws_docs/ApiReference_LocaleDataStructureArticle.html",
61
+ "aws_docs/ApiReference_NotificationAPI_BuildingANotificationReceptor.html",
62
+ "aws_docs/ApiReference_NotificationAPI_ElementsOfANotification.html",
63
+ "aws_docs/ApiReference_NotificationDataStructureArticle.html",
64
+ "aws_docs/ApiReference_NotificationReceptorAPIArticle.html",
65
+ "aws_docs/ApiReference_NotificationReceptorAPI_RESTTransportArticle.html",
66
+ "aws_docs/ApiReference_NotificationReceptorAPI_SOAPTransportArticle.html",
67
+ "aws_docs/ApiReference_NotifyWorkersOperation.html",
68
+ "aws_docs/ApiReference_OperationsArticle.html",
69
+ "aws_docs/ApiReference_PriceDataStructureArticle.html",
70
+ "aws_docs/ApiReference_QualificationDataStructureArticle.html",
71
+ "aws_docs/ApiReference_QualificationRequestDataStructureArticle.html",
72
+ "aws_docs/ApiReference_QualificationRequirementDataStructureArticle.html",
73
+ "aws_docs/ApiReference_QualificationTypeDataStructureArticle.html",
74
+ "aws_docs/ApiReference_QuestionAnswerDataArticle.html",
75
+ "aws_docs/ApiReference_QuestionFormAnswersDataStructureArticle.html",
76
+ "aws_docs/ApiReference_QuestionFormDataStructureArticle.html",
77
+ "aws_docs/ApiReference_RegisterHITTypeOperation.html",
78
+ "aws_docs/ApiReference_RejectAssignmentOperation.html",
79
+ "aws_docs/ApiReference_RejectQualificationRequestOperation.html",
80
+ "aws_docs/ApiReference_RevokeQualificationOperation.html",
81
+ "aws_docs/ApiReference_SearchHITsOperation.html",
82
+ "aws_docs/ApiReference_SearchQualificationTypesOperation.html",
83
+ "aws_docs/ApiReference_SendTestEventNotificationOperation.html",
84
+ "aws_docs/ApiReference_SetHITAsReviewingOperation.html",
85
+ "aws_docs/ApiReference_SetHITTypeNotificationOperation.html",
86
+ "aws_docs/ApiReference_UnblockWorkerOperation.html",
87
+ "aws_docs/ApiReference_UpdateQualificationScoreOperation.html",
88
+ "aws_docs/ApiReference_UpdateQualificationTypeOperation.html",
89
+ "aws_docs/ApiReference_WsdlLocationArticle.html",
90
+ "aws_docs/ApiReference_XMLParameterValuesArticle.html",
91
+ "aws_docs/Welcome.html",
92
+ "aws_docs/WhatsNew.html",
93
+ "aws_docs/_title.html",
94
+ "aws_docs/_toc.html",
95
+ "aws_docs/aws-docs-IE.css",
96
+ "aws_docs/aws-docs.css",
97
+ "aws_docs/copyrightinfo.html",
98
+ "aws_docs/frameset.js",
99
+ "aws_docs/images/Feedback_link.gif",
100
+ "aws_docs/images/caution.png",
101
+ "aws_docs/images/home.gif",
102
+ "aws_docs/images/important.png",
103
+ "aws_docs/images/next.gif",
104
+ "aws_docs/images/note.png",
105
+ "aws_docs/images/prev.gif",
106
+ "aws_docs/images/tip.png",
107
+ "aws_docs/images/title-swoosh-logo.gif",
108
+ "aws_docs/images/toc_bullet.gif",
109
+ "aws_docs/images/toc_plus.gif",
110
+ "aws_docs/index.html",
111
+ "aws_docs/toc.js",
27
112
  "examples/blank_slate.rb",
28
113
  "examples/create_hit.rb",
29
114
  "examples/mturk.sample.yml",
30
115
  "examples/newtweet.html",
31
116
  "examples/review_answer.rb",
32
117
  "lib/rturk.rb",
33
- "lib/rturk/adapters/answers.rb",
118
+ "lib/rturk/adapter.rb",
34
119
  "lib/rturk/adapters/assignment.rb",
35
120
  "lib/rturk/adapters/hit.rb",
121
+ "lib/rturk/adapters/worker.rb",
36
122
  "lib/rturk/builders/qualification_builder.rb",
37
123
  "lib/rturk/builders/qualifications_builder.rb",
38
124
  "lib/rturk/builders/question_builder.rb",
@@ -51,19 +137,26 @@ Gem::Specification.new do |s|
51
137
  "lib/rturk/operations/get_hit.rb",
52
138
  "lib/rturk/operations/get_reviewable_hits.rb",
53
139
  "lib/rturk/operations/grant_bonus.rb",
140
+ "lib/rturk/operations/register_hit_type.rb",
54
141
  "lib/rturk/operations/reject_assignment.rb",
142
+ "lib/rturk/operations/search_hits.rb",
55
143
  "lib/rturk/operations/unblock_worker.rb",
144
+ "lib/rturk/parser.rb",
145
+ "lib/rturk/parsers/answer_parser.rb",
146
+ "lib/rturk/parsers/assignment_parser.rb",
147
+ "lib/rturk/parsers/hit_parser.rb",
148
+ "lib/rturk/parsers/response.rb",
149
+ "lib/rturk/parsers/responses/create_hit_response.rb",
150
+ "lib/rturk/parsers/responses/get_account_balance_response.rb",
151
+ "lib/rturk/parsers/responses/get_assignments_for_hit_response.rb",
152
+ "lib/rturk/parsers/responses/get_hit_response.rb",
153
+ "lib/rturk/parsers/responses/get_reviewable_hits_response.rb",
154
+ "lib/rturk/parsers/responses/register_hit_type_response.rb",
155
+ "lib/rturk/parsers/responses/search_hits_response.rb",
56
156
  "lib/rturk/requester.rb",
57
- "lib/rturk/response.rb",
58
- "lib/rturk/responses/create_hit_response.rb",
59
- "lib/rturk/responses/get_account_balance_response.rb",
60
- "lib/rturk/responses/get_assignments_for_hit_response.rb",
61
- "lib/rturk/responses/get_hit_response.rb",
62
- "lib/rturk/responses/get_reviewable_hits_response.rb",
63
157
  "lib/rturk/utilities.rb",
64
158
  "lib/rturk/xml_utilities.rb",
65
159
  "rturk.gemspec",
66
- "spec/adapters/answers_spec.rb",
67
160
  "spec/adapters/assignment_spec.rb",
68
161
  "spec/adapters/hit_spec.rb",
69
162
  "spec/builders/qualification_spec.rb",
@@ -82,7 +175,9 @@ Gem::Specification.new do |s|
82
175
  "spec/fake_responses/get_reviewable_hits.xml",
83
176
  "spec/fake_responses/grant_bonus.xml",
84
177
  "spec/fake_responses/invalid_credentials.xml",
178
+ "spec/fake_responses/register_hit_type.xml",
85
179
  "spec/fake_responses/reject_assignment.xml",
180
+ "spec/fake_responses/search_hits.xml",
86
181
  "spec/fake_responses/unblock_worker.xml",
87
182
  "spec/mturk.sample.yml",
88
183
  "spec/operations/approve_assignment_spec.rb",
@@ -96,8 +191,11 @@ Gem::Specification.new do |s|
96
191
  "spec/operations/get_hit_spec.rb",
97
192
  "spec/operations/get_reviewable_hits_spec.rb",
98
193
  "spec/operations/grant_bonus_spec.rb",
194
+ "spec/operations/register_hit_type_spec.rb",
99
195
  "spec/operations/reject_assignment_spec.rb",
100
196
  "spec/operations/unblock_worker_spec.rb",
197
+ "spec/parsers/answer_parser_spec.rb",
198
+ "spec/parsers/hit_parser_spec.rb",
101
199
  "spec/requester_spec.rb",
102
200
  "spec/response_spec.rb",
103
201
  "spec/rturk_spec.rb",
@@ -111,8 +209,7 @@ Gem::Specification.new do |s|
111
209
  s.rubygems_version = %q{1.3.5}
112
210
  s.summary = %q{Mechanical Turk API Wrapper}
113
211
  s.test_files = [
114
- "spec/adapters/answers_spec.rb",
115
- "spec/adapters/assignment_spec.rb",
212
+ "spec/adapters/assignment_spec.rb",
116
213
  "spec/adapters/hit_spec.rb",
117
214
  "spec/builders/qualification_spec.rb",
118
215
  "spec/builders/qualifications_spec.rb",
@@ -128,8 +225,11 @@ Gem::Specification.new do |s|
128
225
  "spec/operations/get_hit_spec.rb",
129
226
  "spec/operations/get_reviewable_hits_spec.rb",
130
227
  "spec/operations/grant_bonus_spec.rb",
228
+ "spec/operations/register_hit_type_spec.rb",
131
229
  "spec/operations/reject_assignment_spec.rb",
132
230
  "spec/operations/unblock_worker_spec.rb",
231
+ "spec/parsers/answer_parser_spec.rb",
232
+ "spec/parsers/hit_parser_spec.rb",
133
233
  "spec/requester_spec.rb",
134
234
  "spec/response_spec.rb",
135
235
  "spec/rturk_spec.rb",
@@ -11,6 +11,7 @@ describe "HIT adapter" do
11
11
  faker('get_assignments', :operation => 'GetAssignments')
12
12
  faker('force_expire_hit', :operation => 'ForceExpireHIT')
13
13
  faker('dispose_hit', :operation => 'DisposeHIT')
14
+ faker('search_hits', :operation => 'SearchHITs')
14
15
  end
15
16
 
16
17
  it "should let us create a hit" do
@@ -42,5 +43,14 @@ describe "HIT adapter" do
42
43
  hits = RTurk::Hit.all_reviewable
43
44
  hits.first.dispose!
44
45
  end
46
+
47
+ it "should return a list of all hits" do
48
+ hits = RTurk::Hit.all
49
+ hits.size.should eql(2)
50
+ hits.last.type_id.should eql('NYVZTQ1QVKJZXCYZCZVZ')
51
+ hits.last.status.should eql('Assignable')
52
+ hits.first.reward_amount.should eql(5.00)
53
+ hits.first.completed_assignments.should eql(1)
54
+ end
45
55
 
46
56
  end
@@ -0,0 +1,6 @@
1
+ <RegisterHITTypeResult>
2
+ <Request>
3
+ <IsValid>True</IsValid>
4
+ </Request>
5
+ <HITTypeId>KZ3GKTRXBWGYX8WXBW60</HITTypeId>
6
+ </RegisterHITTypeResult>
@@ -0,0 +1,50 @@
1
+ <SearchHITsResult>
2
+ <Request>
3
+ <IsValid>True</IsValid>
4
+ </Request>
5
+ <NumResults>2</NumResults>
6
+ <TotalNumResults>2</TotalNumResults>
7
+ <PageNumber>1</PageNumber>
8
+
9
+ <HIT>
10
+ <HITId>GBHZVQX3EHXZ2AYDY2T0</HITId>
11
+ <HITTypeId>NYVZTQ1QVKJZXCYZCZVZ</HITTypeId>
12
+ <CreationTime>2009-04-22T00:17:32Z</CreationTime>
13
+ <Title>Location</Title>
14
+ <Description>Select the image that best represents</Description>
15
+ <HITStatus>Reviewable</HITStatus>
16
+ <MaxAssignments>1</MaxAssignments>
17
+ <Reward>
18
+ <Amount>5.00</Amount>
19
+ <CurrencyCode>USD</CurrencyCode>
20
+ <FormattedPrice>$5.00</FormattedPrice>
21
+ </Reward>
22
+ <AutoApprovalDelayInSeconds>2592000</AutoApprovalDelayInSeconds>
23
+ <Expiration>2009-04-29T00:17:32Z</Expiration>
24
+ <AssignmentDurationInSeconds>30</AssignmentDurationInSeconds>
25
+ <NumberOfAssignmentsPending>0</NumberOfAssignmentsPending>
26
+ <NumberOfAssignmentsAvailable>0</NumberOfAssignmentsAvailable>
27
+ <NumberOfAssignmentsCompleted>1</NumberOfAssignmentsCompleted>
28
+ </HIT>
29
+
30
+ <HIT>
31
+ <HITId>ZZRZPTY4ERDZWJ868JCZ</HITId>
32
+ <HITTypeId>NYVZTQ1QVKJZXCYZCZVZ</HITTypeId>
33
+ <CreationTime>2009-07-07T00:56:40Z</CreationTime>
34
+ <Title>Location</Title>
35
+ <Description>Select the image that best represents</Description>
36
+ <HITStatus>Assignable</HITStatus>
37
+ <MaxAssignments>1</MaxAssignments>
38
+ <Reward>
39
+ <Amount>5.00</Amount>
40
+ <CurrencyCode>USD</CurrencyCode>
41
+ <FormattedPrice>$5.00</FormattedPrice>
42
+ </Reward>
43
+ <AutoApprovalDelayInSeconds>2592000</AutoApprovalDelayInSeconds>
44
+ <Expiration>2009-07-14T00:56:40Z</Expiration>
45
+ <AssignmentDurationInSeconds>30</AssignmentDurationInSeconds>
46
+ <NumberOfAssignmentsPending>0</NumberOfAssignmentsPending>
47
+ <NumberOfAssignmentsAvailable>1</NumberOfAssignmentsAvailable>
48
+ <NumberOfAssignmentsCompleted>0</NumberOfAssignmentsCompleted>
49
+ </HIT>
50
+ </SearchHITsResult>
@@ -31,7 +31,7 @@ describe "using mechanical turk with RTurk" do
31
31
  hit.reward = 0.05
32
32
  hit.qualifications.add(:adult, true)
33
33
  end
34
- response.hit.url.should eql('http://workersandbox.mturk.com/mturk/preview?groupId=YGKZ2W5X6YFZ08ZRXXZZ')
34
+ response.hit.url.should eql('http://workersandbox.mturk.com/mturk/preview?groupId=NYVZTQ1QVKJZXCYZCZVZ')
35
35
  end
36
36
 
37
37
  it "should let me create a hit with just option arguments" do
@@ -60,7 +60,7 @@ describe "using mechanical turk with RTurk" do
60
60
  end
61
61
  response.is_a?(RTurk::CreateHITResponse).should be_true
62
62
  response.hit_id.should == 'GBHZVQX3EHXZ2AYDY2T0'
63
- response.hit_type_id.should == 'NYVZTQ1QVKJZXCYZCZVZ'
63
+ response.type_id.should == 'NYVZTQ1QVKJZXCYZCZVZ'
64
64
  end
65
65
 
66
66
  end
@@ -10,7 +10,7 @@ describe RTurk::GetHIT do
10
10
  it "should fetch the details of a HIT" do
11
11
  response = RTurk.GetHIT(:hit_id => '1234abcd')
12
12
  response.type_id.should eql('YGKZ2W5X6YFZ08ZRXXZZ')
13
- response.auto_approval.should eql(3600)
13
+ response.auto_approval_delay.should eql(3600)
14
14
  response.status.should eql('Reviewable')
15
15
  end
16
16
 
@@ -0,0 +1,24 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
+
3
+ describe RTurk::RegisterHITType do
4
+
5
+ before(:all) do
6
+ aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml')))
7
+ RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true)
8
+ FakeWeb.clean_registry
9
+ faker('register_hit_type', :operation => "RegisterHITType")
10
+ end
11
+
12
+ it "should rerturn a CreateHITResponse after the request" do
13
+ response = RTurk::RegisterHITType(:title => "Look at some pictures from 4Chan") do |hit|
14
+ hit.assignments = 5
15
+ hit.description = "foo"
16
+ hit.question("http://mpercival.com", :test => 'b')
17
+ hit.reward = 0.05
18
+ hit.qualifications.add(:adult, true)
19
+ end
20
+ response.is_a?(RTurk::RegisterHITTypeResponse).should be_true
21
+ response.type_id.should == 'KZ3GKTRXBWGYX8WXBW60'
22
+ end
23
+
24
+ end
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
2
 
3
3
 
4
- describe RTurk::Answers do
4
+ describe RTurk::AnswerParser do
5
5
 
6
6
  before(:all) do
7
7
  @answer = <<-XML
@@ -20,7 +20,7 @@ XML
20
20
  end
21
21
 
22
22
  it "should parse a answer" do
23
- RTurk::Answers.new(@answer).to_hash.should == {"Submit"=>"Submit", "tweet"=>"This is my tweet!"}
23
+ RTurk::AnswerParser.parse(@answer).to_hash.should == {"Submit"=>"Submit", "tweet"=>"This is my tweet!"}
24
24
  end
25
25
 
26
26
 
@@ -0,0 +1,41 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
+
3
+
4
+ describe RTurk::HITParser do
5
+
6
+ before(:all) do
7
+ @hit_xml = <<-XML
8
+ <HIT>
9
+ <HITId>ZZRZPTY4ERDZWJ868JCZ</HITId>
10
+ <HITTypeId>NYVZTQ1QVKJZXCYZCZVZ</HITTypeId>
11
+ <CreationTime>2009-07-07T00:56:40Z</CreationTime>
12
+ <Title>Location</Title>
13
+ <Description>Select the image that best represents</Description>
14
+ <HITStatus>Assignable</HITStatus>
15
+ <MaxAssignments>1</MaxAssignments>
16
+ <Reward>
17
+ <Amount>5.00</Amount>
18
+ <CurrencyCode>USD</CurrencyCode>
19
+ <FormattedPrice>$5.00</FormattedPrice>
20
+ </Reward>
21
+ <AutoApprovalDelayInSeconds>2592000</AutoApprovalDelayInSeconds>
22
+ <Expiration>2009-07-14T00:56:40Z</Expiration>
23
+ <AssignmentDurationInSeconds>30</AssignmentDurationInSeconds>
24
+ <NumberOfAssignmentsPending>0</NumberOfAssignmentsPending>
25
+ <NumberOfAssignmentsAvailable>1</NumberOfAssignmentsAvailable>
26
+ <NumberOfAssignmentsCompleted>0</NumberOfAssignmentsCompleted>
27
+ </HIT>
28
+ XML
29
+ @hit_xml = Nokogiri::XML(@hit_xml)
30
+ @hit = RTurk::HITParser.new(@hit_xml.children)
31
+ end
32
+
33
+ it "should parse a answer" do
34
+ @hit.id.should eql('ZZRZPTY4ERDZWJ868JCZ')
35
+ @hit.type_id.should eql('NYVZTQ1QVKJZXCYZCZVZ')
36
+ @hit.status.should eql('Assignable')
37
+ @hit.reward_amount.should eql(5.00)
38
+ end
39
+
40
+
41
+ end
@@ -1,11 +1,11 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper'
2
2
 
3
3
 
4
- describe RTurk::XmlUtilities do
4
+ describe RTurk::XMLUtilities do
5
5
 
6
6
  before(:all) do
7
7
  class XMLTest
8
- include RTurk::XmlUtilities
8
+ include RTurk::XMLUtilities
9
9
  def xml
10
10
  <<-XML
11
11
  <foo>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rturk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Percival
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-27 00:00:00 -04:00
12
+ date: 2009-11-01 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -31,15 +31,101 @@ files:
31
31
  - Rakefile
32
32
  - TODO.markdown
33
33
  - VERSION
34
+ - aws_docs/ApiReference_AnswerKeyDataStructureArticle.html
35
+ - aws_docs/ApiReference_ApproveAssignmentOperation.html
36
+ - aws_docs/ApiReference_AssignQualificationOperation.html
37
+ - aws_docs/ApiReference_AssignmentDataStructureArticle.html
38
+ - aws_docs/ApiReference_BlockWorkerOperation.html
39
+ - aws_docs/ApiReference_ChangeHITTypeOfHITOperation.html
40
+ - aws_docs/ApiReference_CommonParametersArticle.html
41
+ - aws_docs/ApiReference_CreateHITOperation.html
42
+ - aws_docs/ApiReference_CreateQualificationTypeOperation.html
43
+ - aws_docs/ApiReference_DataStructuresArticle.html
44
+ - aws_docs/ApiReference_DisableHITOperation.html
45
+ - aws_docs/ApiReference_DisposeHITOperation.html
46
+ - aws_docs/ApiReference_DisposeQualificationTypeOperation.html
47
+ - aws_docs/ApiReference_ExtendHITOperation.html
48
+ - aws_docs/ApiReference_ExternalQuestionArticle.html
49
+ - aws_docs/ApiReference_ForceExpireHITOperation.html
50
+ - aws_docs/ApiReference_FormattedContentXHTMLArticle.html
51
+ - aws_docs/ApiReference_GetAccountBalanceOperation.html
52
+ - aws_docs/ApiReference_GetAssignmentsForHITOperation.html
53
+ - aws_docs/ApiReference_GetBonusPaymentsOperation.html
54
+ - aws_docs/ApiReference_GetFileUploadURLOperation.html
55
+ - aws_docs/ApiReference_GetHITOperation.html
56
+ - aws_docs/ApiReference_GetHITsForQualificationTypeOperation.html
57
+ - aws_docs/ApiReference_GetQualificationRequestsOperation.html
58
+ - aws_docs/ApiReference_GetQualificationScoreOperation.html
59
+ - aws_docs/ApiReference_GetQualificationTypeOperation.html
60
+ - aws_docs/ApiReference_GetQualificationsForQualificationTypeOperation.html
61
+ - aws_docs/ApiReference_GetRequesterStatisticOperation.html
62
+ - aws_docs/ApiReference_GetReviewableHITsOperation.html
63
+ - aws_docs/ApiReference_GrantBonusOperation.html
64
+ - aws_docs/ApiReference_GrantQualificationOperation.html
65
+ - aws_docs/ApiReference_HITDataStructureArticle.html
66
+ - aws_docs/ApiReference_HelpOperation.html
67
+ - aws_docs/ApiReference_LocaleDataStructureArticle.html
68
+ - aws_docs/ApiReference_NotificationAPI_BuildingANotificationReceptor.html
69
+ - aws_docs/ApiReference_NotificationAPI_ElementsOfANotification.html
70
+ - aws_docs/ApiReference_NotificationDataStructureArticle.html
71
+ - aws_docs/ApiReference_NotificationReceptorAPIArticle.html
72
+ - aws_docs/ApiReference_NotificationReceptorAPI_RESTTransportArticle.html
73
+ - aws_docs/ApiReference_NotificationReceptorAPI_SOAPTransportArticle.html
74
+ - aws_docs/ApiReference_NotifyWorkersOperation.html
75
+ - aws_docs/ApiReference_OperationsArticle.html
76
+ - aws_docs/ApiReference_PriceDataStructureArticle.html
77
+ - aws_docs/ApiReference_QualificationDataStructureArticle.html
78
+ - aws_docs/ApiReference_QualificationRequestDataStructureArticle.html
79
+ - aws_docs/ApiReference_QualificationRequirementDataStructureArticle.html
80
+ - aws_docs/ApiReference_QualificationTypeDataStructureArticle.html
81
+ - aws_docs/ApiReference_QuestionAnswerDataArticle.html
82
+ - aws_docs/ApiReference_QuestionFormAnswersDataStructureArticle.html
83
+ - aws_docs/ApiReference_QuestionFormDataStructureArticle.html
84
+ - aws_docs/ApiReference_RegisterHITTypeOperation.html
85
+ - aws_docs/ApiReference_RejectAssignmentOperation.html
86
+ - aws_docs/ApiReference_RejectQualificationRequestOperation.html
87
+ - aws_docs/ApiReference_RevokeQualificationOperation.html
88
+ - aws_docs/ApiReference_SearchHITsOperation.html
89
+ - aws_docs/ApiReference_SearchQualificationTypesOperation.html
90
+ - aws_docs/ApiReference_SendTestEventNotificationOperation.html
91
+ - aws_docs/ApiReference_SetHITAsReviewingOperation.html
92
+ - aws_docs/ApiReference_SetHITTypeNotificationOperation.html
93
+ - aws_docs/ApiReference_UnblockWorkerOperation.html
94
+ - aws_docs/ApiReference_UpdateQualificationScoreOperation.html
95
+ - aws_docs/ApiReference_UpdateQualificationTypeOperation.html
96
+ - aws_docs/ApiReference_WsdlLocationArticle.html
97
+ - aws_docs/ApiReference_XMLParameterValuesArticle.html
98
+ - aws_docs/Welcome.html
99
+ - aws_docs/WhatsNew.html
100
+ - aws_docs/_title.html
101
+ - aws_docs/_toc.html
102
+ - aws_docs/aws-docs-IE.css
103
+ - aws_docs/aws-docs.css
104
+ - aws_docs/copyrightinfo.html
105
+ - aws_docs/frameset.js
106
+ - aws_docs/images/Feedback_link.gif
107
+ - aws_docs/images/caution.png
108
+ - aws_docs/images/home.gif
109
+ - aws_docs/images/important.png
110
+ - aws_docs/images/next.gif
111
+ - aws_docs/images/note.png
112
+ - aws_docs/images/prev.gif
113
+ - aws_docs/images/tip.png
114
+ - aws_docs/images/title-swoosh-logo.gif
115
+ - aws_docs/images/toc_bullet.gif
116
+ - aws_docs/images/toc_plus.gif
117
+ - aws_docs/index.html
118
+ - aws_docs/toc.js
34
119
  - examples/blank_slate.rb
35
120
  - examples/create_hit.rb
36
121
  - examples/mturk.sample.yml
37
122
  - examples/newtweet.html
38
123
  - examples/review_answer.rb
39
124
  - lib/rturk.rb
40
- - lib/rturk/adapters/answers.rb
125
+ - lib/rturk/adapter.rb
41
126
  - lib/rturk/adapters/assignment.rb
42
127
  - lib/rturk/adapters/hit.rb
128
+ - lib/rturk/adapters/worker.rb
43
129
  - lib/rturk/builders/qualification_builder.rb
44
130
  - lib/rturk/builders/qualifications_builder.rb
45
131
  - lib/rturk/builders/question_builder.rb
@@ -58,19 +144,26 @@ files:
58
144
  - lib/rturk/operations/get_hit.rb
59
145
  - lib/rturk/operations/get_reviewable_hits.rb
60
146
  - lib/rturk/operations/grant_bonus.rb
147
+ - lib/rturk/operations/register_hit_type.rb
61
148
  - lib/rturk/operations/reject_assignment.rb
149
+ - lib/rturk/operations/search_hits.rb
62
150
  - lib/rturk/operations/unblock_worker.rb
151
+ - lib/rturk/parser.rb
152
+ - lib/rturk/parsers/answer_parser.rb
153
+ - lib/rturk/parsers/assignment_parser.rb
154
+ - lib/rturk/parsers/hit_parser.rb
155
+ - lib/rturk/parsers/response.rb
156
+ - lib/rturk/parsers/responses/create_hit_response.rb
157
+ - lib/rturk/parsers/responses/get_account_balance_response.rb
158
+ - lib/rturk/parsers/responses/get_assignments_for_hit_response.rb
159
+ - lib/rturk/parsers/responses/get_hit_response.rb
160
+ - lib/rturk/parsers/responses/get_reviewable_hits_response.rb
161
+ - lib/rturk/parsers/responses/register_hit_type_response.rb
162
+ - lib/rturk/parsers/responses/search_hits_response.rb
63
163
  - lib/rturk/requester.rb
64
- - lib/rturk/response.rb
65
- - lib/rturk/responses/create_hit_response.rb
66
- - lib/rturk/responses/get_account_balance_response.rb
67
- - lib/rturk/responses/get_assignments_for_hit_response.rb
68
- - lib/rturk/responses/get_hit_response.rb
69
- - lib/rturk/responses/get_reviewable_hits_response.rb
70
164
  - lib/rturk/utilities.rb
71
165
  - lib/rturk/xml_utilities.rb
72
166
  - rturk.gemspec
73
- - spec/adapters/answers_spec.rb
74
167
  - spec/adapters/assignment_spec.rb
75
168
  - spec/adapters/hit_spec.rb
76
169
  - spec/builders/qualification_spec.rb
@@ -89,7 +182,9 @@ files:
89
182
  - spec/fake_responses/get_reviewable_hits.xml
90
183
  - spec/fake_responses/grant_bonus.xml
91
184
  - spec/fake_responses/invalid_credentials.xml
185
+ - spec/fake_responses/register_hit_type.xml
92
186
  - spec/fake_responses/reject_assignment.xml
187
+ - spec/fake_responses/search_hits.xml
93
188
  - spec/fake_responses/unblock_worker.xml
94
189
  - spec/mturk.sample.yml
95
190
  - spec/operations/approve_assignment_spec.rb
@@ -103,8 +198,11 @@ files:
103
198
  - spec/operations/get_hit_spec.rb
104
199
  - spec/operations/get_reviewable_hits_spec.rb
105
200
  - spec/operations/grant_bonus_spec.rb
201
+ - spec/operations/register_hit_type_spec.rb
106
202
  - spec/operations/reject_assignment_spec.rb
107
203
  - spec/operations/unblock_worker_spec.rb
204
+ - spec/parsers/answer_parser_spec.rb
205
+ - spec/parsers/hit_parser_spec.rb
108
206
  - spec/requester_spec.rb
109
207
  - spec/response_spec.rb
110
208
  - spec/rturk_spec.rb
@@ -140,7 +238,6 @@ signing_key:
140
238
  specification_version: 3
141
239
  summary: Mechanical Turk API Wrapper
142
240
  test_files:
143
- - spec/adapters/answers_spec.rb
144
241
  - spec/adapters/assignment_spec.rb
145
242
  - spec/adapters/hit_spec.rb
146
243
  - spec/builders/qualification_spec.rb
@@ -157,8 +254,11 @@ test_files:
157
254
  - spec/operations/get_hit_spec.rb
158
255
  - spec/operations/get_reviewable_hits_spec.rb
159
256
  - spec/operations/grant_bonus_spec.rb
257
+ - spec/operations/register_hit_type_spec.rb
160
258
  - spec/operations/reject_assignment_spec.rb
161
259
  - spec/operations/unblock_worker_spec.rb
260
+ - spec/parsers/answer_parser_spec.rb
261
+ - spec/parsers/hit_parser_spec.rb
162
262
  - spec/requester_spec.rb
163
263
  - spec/response_spec.rb
164
264
  - spec/rturk_spec.rb