rturk 2.2.1 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rturk/operations/assign_qualification.rb +18 -0
- data/lib/rturk/operations/create_qualification_type.rb +24 -0
- data/lib/rturk/operations/dispose_qualification_type.rb +16 -0
- data/lib/rturk/operations/grant_bonus.rb +4 -3
- data/lib/rturk/operations/revoke_qualification.rb +21 -0
- data/lib/rturk/parsers/responses/create_qualification_type_response.rb +27 -0
- data/lib/rturk/requester.rb +21 -12
- data/rturk.gemspec +19 -2
- data/spec/fake_responses/assign_qualification.xml +5 -0
- data/spec/fake_responses/create_qualification_type.xml +16 -0
- data/spec/fake_responses/dispose_qualification_type.xml +5 -0
- data/spec/fake_responses/revoke_qualification.xml +5 -0
- data/spec/operations/assign_qualification_spec.rb +27 -0
- data/spec/operations/create_qualification_type_spec.rb +25 -0
- data/spec/operations/dispose_qualification_type_spec.rb +25 -0
- data/spec/operations/revoke_qualification_spec.rb +27 -0
- data/spec/requester_spec.rb +20 -1
- metadata +21 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.0
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Operation to assign a qualification to a worker
|
2
|
+
|
3
|
+
module RTurk
|
4
|
+
class AssignQualification < Operation
|
5
|
+
attr_accessor :qualification_type_id, :worker_id, :send_notification
|
6
|
+
require_params :qualification_type_id, :worker_id
|
7
|
+
|
8
|
+
def to_params
|
9
|
+
{'QualificationTypeId' => qualification_type_id,
|
10
|
+
'WorkerId' => worker_id,
|
11
|
+
'SendNotification' => (!!send_notification).to_s}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.AssignQualification(*args)
|
16
|
+
RTurk::AssignQualification.create(*args)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Operation to create a qualification type
|
2
|
+
|
3
|
+
module RTurk
|
4
|
+
class CreateQualificationType < Operation
|
5
|
+
attr_accessor :name, :description, :keywords, :status, :auto_granted
|
6
|
+
require_params :name
|
7
|
+
|
8
|
+
def parse(response)
|
9
|
+
RTurk::CreateQualificationTypeResponse.new(response)
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_params
|
13
|
+
{'Name' => name,
|
14
|
+
'Description' => description,
|
15
|
+
'Keywords' => keywords,
|
16
|
+
'QualificationTypeStatus' => (status || "Active"),
|
17
|
+
'AutoGranted' => (auto_granted.nil? ? true : auto_granted).to_s}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.CreateQualificationType(*args)
|
22
|
+
RTurk::CreateQualificationType.create(*args)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Operation to despose a qualification type
|
2
|
+
|
3
|
+
module RTurk
|
4
|
+
class DisposeQualificationType < Operation
|
5
|
+
attr_accessor :qualification_type_id
|
6
|
+
require_params :qualification_type_id
|
7
|
+
|
8
|
+
def to_params
|
9
|
+
{'QualificationTypeId' => qualification_type_id}
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.DisposeQualificationType(*args)
|
14
|
+
RTurk::DisposeQualificationType.create(*args)
|
15
|
+
end
|
16
|
+
end
|
@@ -12,9 +12,10 @@ module RTurk
|
|
12
12
|
|
13
13
|
def to_params
|
14
14
|
{'AssignmentId' => self.assignment_id,
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
'BonusAmount.1.Amount' => self.amount,
|
16
|
+
'BonusAmount.1.CurrencyCode' => (self.currency || 'USD'),
|
17
|
+
'Reason' => self.feedback,
|
18
|
+
'WorkerId' => worker_id}
|
18
19
|
end
|
19
20
|
|
20
21
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Operation to revoke a qualification from a worker
|
2
|
+
|
3
|
+
module RTurk
|
4
|
+
class RevokeQualification < Operation
|
5
|
+
attr_accessor :qualification_type_id, :subject_id, :reason
|
6
|
+
require_params :qualification_type_id, :subject_id
|
7
|
+
|
8
|
+
def to_params
|
9
|
+
params = {
|
10
|
+
'QualificationTypeId' => qualification_type_id,
|
11
|
+
'SubjectId' => subject_id
|
12
|
+
}
|
13
|
+
params['Reason'] = reason if reason
|
14
|
+
params
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.RevokeQualification(*args)
|
19
|
+
RTurk::RevokeQualification.create(*args)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Parses out the CreateQualificationType response
|
2
|
+
#
|
3
|
+
# Example response:
|
4
|
+
# <CreateQualificationTypeResponse>
|
5
|
+
# <OperationRequest>
|
6
|
+
# <RequestId>5218189c-1d7e-49a3-abbf-672fb5e77c66</RequestId>
|
7
|
+
# </OperationRequest>
|
8
|
+
# <QualificationType>
|
9
|
+
# <Request>
|
10
|
+
# <IsValid>True</IsValid>
|
11
|
+
# </Request>
|
12
|
+
# <QualificationTypeId>ZSPJXD4F1SFZP7YNJWR0</QualificationTypeId>
|
13
|
+
# <CreationTime>2009-07-13T17:26:33Z</CreationTime>
|
14
|
+
# <Name>SampleQualificationTest</Name>
|
15
|
+
# <Description>Description of my qualification test.</Description>
|
16
|
+
# <QualificationTypeStatus>Active</QualificationTypeStatus>
|
17
|
+
# <AutoGranted>0</AutoGranted>
|
18
|
+
# </QualificationType>
|
19
|
+
# </CreateQualificationTypeResponse>
|
20
|
+
|
21
|
+
module RTurk
|
22
|
+
class CreateQualificationTypeResponse < Response
|
23
|
+
def qualification_type_id
|
24
|
+
@xml.xpath('//QualificationTypeId').inner_text
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/rturk/requester.rb
CHANGED
@@ -8,10 +8,9 @@ require 'restclient'
|
|
8
8
|
|
9
9
|
module RTurk
|
10
10
|
class Requester
|
11
|
-
|
12
11
|
class << self
|
13
12
|
include RTurk::Utilities
|
14
|
-
|
13
|
+
|
15
14
|
# @param [Hash] params
|
16
15
|
# @option [String] 'Operation' The operation - Required
|
17
16
|
# @option [String] Any Pass any other params and they will be included in the request
|
@@ -29,22 +28,33 @@ module RTurk
|
|
29
28
|
params.merge!(base_params)
|
30
29
|
signature = sign(credentials.secret_key, params['Service'], params['Operation'], params["Timestamp"])
|
31
30
|
params['Signature'] = signature
|
32
|
-
|
31
|
+
|
32
|
+
querystring = params.inject([]) do |pairs, (key, value)|
|
33
|
+
if value.is_a?(Array)
|
34
|
+
value.each do |multi_value|
|
35
|
+
pairs << [CGI.escape(key.to_s), CGI.escape(multi_value.to_s)].join('=')
|
36
|
+
end
|
37
|
+
else
|
38
|
+
pairs << [CGI.escape(key.to_s), CGI.escape(value.to_s)].join('=')
|
39
|
+
end
|
40
|
+
pairs
|
41
|
+
end.join('&') # order doesn't matter for the actual request
|
42
|
+
|
33
43
|
RTurk.logger.debug "Sending request:\n\t #{credentials.host}?#{querystring}"
|
34
44
|
RestClient.get("#{credentials.host}?#{querystring}")
|
35
45
|
end
|
36
|
-
|
37
|
-
def sign(secret_key, service,method,time)
|
38
|
-
msg = "#{service}#{method}#{time}"
|
39
|
-
return hmac_sha1(secret_key, msg )
|
40
|
-
end
|
41
|
-
|
46
|
+
|
42
47
|
private
|
43
|
-
|
48
|
+
|
44
49
|
def credentials
|
45
50
|
RTurk
|
46
51
|
end
|
47
52
|
|
53
|
+
def sign(secret_key, service,method,time)
|
54
|
+
msg = "#{service}#{method}#{time}"
|
55
|
+
return hmac_sha1(secret_key, msg )
|
56
|
+
end
|
57
|
+
|
48
58
|
def hmac_sha1(key, s)
|
49
59
|
ipad = [].fill(0x36, 0, 64)
|
50
60
|
opad = [].fill(0x5C, 0, 64)
|
@@ -64,9 +74,8 @@ module RTurk
|
|
64
74
|
end
|
65
75
|
end
|
66
76
|
end
|
67
|
-
|
77
|
+
|
68
78
|
def self.Request(*args)
|
69
79
|
RTurk::Requester.request(*args)
|
70
80
|
end
|
71
|
-
|
72
81
|
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.
|
8
|
+
s.version = "2.3.0"
|
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{2010-07-
|
12
|
+
s.date = %q{2010-07-27}
|
13
13
|
s.email = %q{mark@mpercival.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
@@ -130,10 +130,13 @@ Gem::Specification.new do |s|
|
|
130
130
|
"lib/rturk/macros.rb",
|
131
131
|
"lib/rturk/operation.rb",
|
132
132
|
"lib/rturk/operations/approve_assignment.rb",
|
133
|
+
"lib/rturk/operations/assign_qualification.rb",
|
133
134
|
"lib/rturk/operations/block_worker.rb",
|
134
135
|
"lib/rturk/operations/create_hit.rb",
|
136
|
+
"lib/rturk/operations/create_qualification_type.rb",
|
135
137
|
"lib/rturk/operations/disable_hit.rb",
|
136
138
|
"lib/rturk/operations/dispose_hit.rb",
|
139
|
+
"lib/rturk/operations/dispose_qualification_type.rb",
|
137
140
|
"lib/rturk/operations/extend_hit.rb",
|
138
141
|
"lib/rturk/operations/force_expire_hit.rb",
|
139
142
|
"lib/rturk/operations/get_account_balance.rb",
|
@@ -144,6 +147,7 @@ Gem::Specification.new do |s|
|
|
144
147
|
"lib/rturk/operations/notify_workers.rb",
|
145
148
|
"lib/rturk/operations/register_hit_type.rb",
|
146
149
|
"lib/rturk/operations/reject_assignment.rb",
|
150
|
+
"lib/rturk/operations/revoke_qualification.rb",
|
147
151
|
"lib/rturk/operations/search_hits.rb",
|
148
152
|
"lib/rturk/operations/send_test_event_notification.rb",
|
149
153
|
"lib/rturk/operations/set_hit_type_notification.rb",
|
@@ -154,6 +158,7 @@ Gem::Specification.new do |s|
|
|
154
158
|
"lib/rturk/parsers/hit_parser.rb",
|
155
159
|
"lib/rturk/parsers/response.rb",
|
156
160
|
"lib/rturk/parsers/responses/create_hit_response.rb",
|
161
|
+
"lib/rturk/parsers/responses/create_qualification_type_response.rb",
|
157
162
|
"lib/rturk/parsers/responses/get_account_balance_response.rb",
|
158
163
|
"lib/rturk/parsers/responses/get_assignments_for_hit_response.rb",
|
159
164
|
"lib/rturk/parsers/responses/get_hit_response.rb",
|
@@ -171,10 +176,13 @@ Gem::Specification.new do |s|
|
|
171
176
|
"spec/builders/qualifications_spec.rb",
|
172
177
|
"spec/builders/question_spec.rb",
|
173
178
|
"spec/fake_responses/approve_assignment.xml",
|
179
|
+
"spec/fake_responses/assign_qualification.xml",
|
174
180
|
"spec/fake_responses/block_worker.xml",
|
175
181
|
"spec/fake_responses/create_hit.xml",
|
182
|
+
"spec/fake_responses/create_qualification_type.xml",
|
176
183
|
"spec/fake_responses/disable_hit.xml",
|
177
184
|
"spec/fake_responses/dispose_hit.xml",
|
185
|
+
"spec/fake_responses/dispose_qualification_type.xml",
|
178
186
|
"spec/fake_responses/extend_hit.xml",
|
179
187
|
"spec/fake_responses/force_expire_hit.xml",
|
180
188
|
"spec/fake_responses/get_account_balance.xml",
|
@@ -187,14 +195,18 @@ Gem::Specification.new do |s|
|
|
187
195
|
"spec/fake_responses/notify_workers.xml",
|
188
196
|
"spec/fake_responses/register_hit_type.xml",
|
189
197
|
"spec/fake_responses/reject_assignment.xml",
|
198
|
+
"spec/fake_responses/revoke_qualification.xml",
|
190
199
|
"spec/fake_responses/search_hits.xml",
|
191
200
|
"spec/fake_responses/unblock_worker.xml",
|
192
201
|
"spec/mturk.sample.yml",
|
193
202
|
"spec/operations/approve_assignment_spec.rb",
|
203
|
+
"spec/operations/assign_qualification_spec.rb",
|
194
204
|
"spec/operations/block_worker_spec.rb",
|
195
205
|
"spec/operations/create_hit_spec.rb",
|
206
|
+
"spec/operations/create_qualification_type_spec.rb",
|
196
207
|
"spec/operations/disable_hit_spec.rb",
|
197
208
|
"spec/operations/dispose_hit_spec.rb",
|
209
|
+
"spec/operations/dispose_qualification_type_spec.rb",
|
198
210
|
"spec/operations/extend_hit_spec.rb",
|
199
211
|
"spec/operations/force_expire_hit_spec.rb",
|
200
212
|
"spec/operations/get_account_balance_spec.rb",
|
@@ -205,6 +217,7 @@ Gem::Specification.new do |s|
|
|
205
217
|
"spec/operations/notify_workers_spec.rb",
|
206
218
|
"spec/operations/register_hit_type_spec.rb",
|
207
219
|
"spec/operations/reject_assignment_spec.rb",
|
220
|
+
"spec/operations/revoke_qualification_spec.rb",
|
208
221
|
"spec/operations/send_test_event_notification_spec.rb",
|
209
222
|
"spec/operations/set_hit_type_notification_spec.rb",
|
210
223
|
"spec/operations/unblock_worker_spec.rb",
|
@@ -230,10 +243,13 @@ Gem::Specification.new do |s|
|
|
230
243
|
"spec/builders/qualifications_spec.rb",
|
231
244
|
"spec/builders/question_spec.rb",
|
232
245
|
"spec/operations/approve_assignment_spec.rb",
|
246
|
+
"spec/operations/assign_qualification_spec.rb",
|
233
247
|
"spec/operations/block_worker_spec.rb",
|
234
248
|
"spec/operations/create_hit_spec.rb",
|
249
|
+
"spec/operations/create_qualification_type_spec.rb",
|
235
250
|
"spec/operations/disable_hit_spec.rb",
|
236
251
|
"spec/operations/dispose_hit_spec.rb",
|
252
|
+
"spec/operations/dispose_qualification_type_spec.rb",
|
237
253
|
"spec/operations/extend_hit_spec.rb",
|
238
254
|
"spec/operations/force_expire_hit_spec.rb",
|
239
255
|
"spec/operations/get_account_balance_spec.rb",
|
@@ -244,6 +260,7 @@ Gem::Specification.new do |s|
|
|
244
260
|
"spec/operations/notify_workers_spec.rb",
|
245
261
|
"spec/operations/register_hit_type_spec.rb",
|
246
262
|
"spec/operations/reject_assignment_spec.rb",
|
263
|
+
"spec/operations/revoke_qualification_spec.rb",
|
247
264
|
"spec/operations/send_test_event_notification_spec.rb",
|
248
265
|
"spec/operations/set_hit_type_notification_spec.rb",
|
249
266
|
"spec/operations/unblock_worker_spec.rb",
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<CreateQualificationTypeResponse>
|
2
|
+
<OperationRequest>
|
3
|
+
<RequestId>5218189c-1d7e-49a3-abbf-672fb5e77c66</RequestId>
|
4
|
+
</OperationRequest>
|
5
|
+
<QualificationType>
|
6
|
+
<Request>
|
7
|
+
<IsValid>True</IsValid>
|
8
|
+
</Request>
|
9
|
+
<QualificationTypeId>ZSPJXD4F1SFZP7YNJWR0</QualificationTypeId>
|
10
|
+
<CreationTime>2009-07-13T17:26:33Z</CreationTime>
|
11
|
+
<Name>SampleQualificationTest</Name>
|
12
|
+
<Description>Description of my qualification test.</Description>
|
13
|
+
<QualificationTypeStatus>Active</QualificationTypeStatus>
|
14
|
+
<AutoGranted>0</AutoGranted>
|
15
|
+
</QualificationType>
|
16
|
+
</CreateQualificationTypeResponse>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
2
|
+
|
3
|
+
describe RTurk::AssignQualification do
|
4
|
+
before(:all) do
|
5
|
+
aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml')))
|
6
|
+
RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true)
|
7
|
+
faker('assign_qualification', :operation => 'AssignQualification')
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should ensure required params" do
|
11
|
+
lambda{RTurk::AssignQualification()}.should raise_error RTurk::MissingParameters
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should successfully request the operation" do
|
15
|
+
RTurk::Requester.should_receive(:request).once.with(
|
16
|
+
hash_including('Operation' => 'AssignQualification'))
|
17
|
+
RTurk::AssignQualification(:qualification_type_id => "123456789",
|
18
|
+
:worker_id => "ABCDEF1234") rescue RTurk::InvalidRequest
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should parse and return the result" do
|
22
|
+
RTurk::AssignQualification(:qualification_type_id => "123456789",
|
23
|
+
:worker_id => "ABCDEF1234").elements.should eql(
|
24
|
+
{"AssignQualificationResult"=>{"Request"=>{"IsValid"=>"True"}}}
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
2
|
+
|
3
|
+
describe RTurk::CreateQualificationType do
|
4
|
+
before(:all) do
|
5
|
+
aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml')))
|
6
|
+
RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true)
|
7
|
+
faker('create_qualification_type', :operation => 'CreateQualificationType')
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should ensure required params" do
|
11
|
+
lambda{RTurk::CreateQualificationType()}.should raise_error RTurk::MissingParameters
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should successfully request the operation" do
|
15
|
+
RTurk::Requester.should_receive(:request).once.with(
|
16
|
+
hash_including('Operation' => 'CreateQualificationType'))
|
17
|
+
RTurk::CreateQualificationType(:name => "bogus") rescue RTurk::InvalidRequest
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should parse and return the result" do
|
21
|
+
response = RTurk::CreateQualificationType(:name => "bogus")
|
22
|
+
response['CreateQualificationTypeResponse']['QualificationType']['QualificationTypeId'].should == "ZSPJXD4F1SFZP7YNJWR0"
|
23
|
+
response.qualification_type_id.should == "ZSPJXD4F1SFZP7YNJWR0"
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
2
|
+
|
3
|
+
describe RTurk::DisposeQualificationType do
|
4
|
+
before(:all) do
|
5
|
+
aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml')))
|
6
|
+
RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true)
|
7
|
+
faker('dispose_qualification_type', :operation => 'DisposeQualificationType')
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should ensure required params" do
|
11
|
+
lambda{RTurk::DisposeQualificationType()}.should raise_error RTurk::MissingParameters
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should successfully request the operation" do
|
15
|
+
RTurk::Requester.should_receive(:request).once.with(
|
16
|
+
hash_including('Operation' => 'DisposeQualificationType'))
|
17
|
+
RTurk::DisposeQualificationType(:qualification_type_id => "123456789") rescue RTurk::InvalidRequest
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should parse and return the result" do
|
21
|
+
RTurk::DisposeQualificationType(:qualification_type_id => "123456789").elements.should eql(
|
22
|
+
{"DisposeQualificationTypeResult"=>{"Request"=>{"IsValid"=>"True"}}}
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
2
|
+
|
3
|
+
describe RTurk::RevokeQualification do
|
4
|
+
before(:all) do
|
5
|
+
aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml')))
|
6
|
+
RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true)
|
7
|
+
faker('revoke_qualification', :operation => 'RevokeQualification')
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should ensure required params" do
|
11
|
+
lambda{RTurk::RevokeQualification()}.should raise_error RTurk::MissingParameters
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should successfully request the operation" do
|
15
|
+
RTurk::Requester.should_receive(:request).once.with(
|
16
|
+
hash_including('Operation' => 'RevokeQualification'))
|
17
|
+
RTurk::RevokeQualification(:qualification_type_id => "123456789",
|
18
|
+
:subject_id => "ABCDEF1234") rescue RTurk::InvalidRequest
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should parse and return the result" do
|
22
|
+
RTurk::RevokeQualification(:qualification_type_id => "123456789",
|
23
|
+
:subject_id => "ABCDEF1234").elements.should eql(
|
24
|
+
{"RevokeQualificationResult"=>{"Request"=>{"IsValid"=>"True"}}}
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
data/spec/requester_spec.rb
CHANGED
@@ -13,6 +13,25 @@ describe RTurk::Requester do
|
|
13
13
|
RTurk::Requester.request(:Operation => 'GetHIT', 'HITId' => 'test')
|
14
14
|
end
|
15
15
|
|
16
|
+
it "should build a correct querystring with one value per key" do
|
17
|
+
params = {
|
18
|
+
:Operation => 'GetHIT',
|
19
|
+
'Param1' => 'test1',
|
20
|
+
'Param2' => 'test2'
|
21
|
+
}
|
22
|
+
RestClient.should_receive(:get).with(
|
23
|
+
/(?=.*Operation=GetHIT)(?=.*Param1=test1)(?=.*Param2=test2)/)
|
24
|
+
RTurk::Requester.request(params)
|
25
|
+
end
|
16
26
|
|
17
|
-
|
27
|
+
it "Should build a correct querystring with two values per key" do
|
28
|
+
params = {
|
29
|
+
:Operation => 'GetHIT',
|
30
|
+
'Param1' => 'test1',
|
31
|
+
'Param2' => %w(test2a test2b)
|
32
|
+
}
|
33
|
+
RestClient.should_receive(:get).with(
|
34
|
+
/(?=.*Operation=GetHIT)(?=.*Param1=test1)(?=.*Param2=test2a)(?=.*Param2=test2b)/)
|
35
|
+
RTurk::Requester.request(params)
|
36
|
+
end
|
18
37
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 2
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 2.
|
7
|
+
- 3
|
8
|
+
- 0
|
9
|
+
version: 2.3.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Mark Percival
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-07-
|
17
|
+
date: 2010-07-27 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -169,10 +169,13 @@ files:
|
|
169
169
|
- lib/rturk/macros.rb
|
170
170
|
- lib/rturk/operation.rb
|
171
171
|
- lib/rturk/operations/approve_assignment.rb
|
172
|
+
- lib/rturk/operations/assign_qualification.rb
|
172
173
|
- lib/rturk/operations/block_worker.rb
|
173
174
|
- lib/rturk/operations/create_hit.rb
|
175
|
+
- lib/rturk/operations/create_qualification_type.rb
|
174
176
|
- lib/rturk/operations/disable_hit.rb
|
175
177
|
- lib/rturk/operations/dispose_hit.rb
|
178
|
+
- lib/rturk/operations/dispose_qualification_type.rb
|
176
179
|
- lib/rturk/operations/extend_hit.rb
|
177
180
|
- lib/rturk/operations/force_expire_hit.rb
|
178
181
|
- lib/rturk/operations/get_account_balance.rb
|
@@ -183,6 +186,7 @@ files:
|
|
183
186
|
- lib/rturk/operations/notify_workers.rb
|
184
187
|
- lib/rturk/operations/register_hit_type.rb
|
185
188
|
- lib/rturk/operations/reject_assignment.rb
|
189
|
+
- lib/rturk/operations/revoke_qualification.rb
|
186
190
|
- lib/rturk/operations/search_hits.rb
|
187
191
|
- lib/rturk/operations/send_test_event_notification.rb
|
188
192
|
- lib/rturk/operations/set_hit_type_notification.rb
|
@@ -193,6 +197,7 @@ files:
|
|
193
197
|
- lib/rturk/parsers/hit_parser.rb
|
194
198
|
- lib/rturk/parsers/response.rb
|
195
199
|
- lib/rturk/parsers/responses/create_hit_response.rb
|
200
|
+
- lib/rturk/parsers/responses/create_qualification_type_response.rb
|
196
201
|
- lib/rturk/parsers/responses/get_account_balance_response.rb
|
197
202
|
- lib/rturk/parsers/responses/get_assignments_for_hit_response.rb
|
198
203
|
- lib/rturk/parsers/responses/get_hit_response.rb
|
@@ -210,10 +215,13 @@ files:
|
|
210
215
|
- spec/builders/qualifications_spec.rb
|
211
216
|
- spec/builders/question_spec.rb
|
212
217
|
- spec/fake_responses/approve_assignment.xml
|
218
|
+
- spec/fake_responses/assign_qualification.xml
|
213
219
|
- spec/fake_responses/block_worker.xml
|
214
220
|
- spec/fake_responses/create_hit.xml
|
221
|
+
- spec/fake_responses/create_qualification_type.xml
|
215
222
|
- spec/fake_responses/disable_hit.xml
|
216
223
|
- spec/fake_responses/dispose_hit.xml
|
224
|
+
- spec/fake_responses/dispose_qualification_type.xml
|
217
225
|
- spec/fake_responses/extend_hit.xml
|
218
226
|
- spec/fake_responses/force_expire_hit.xml
|
219
227
|
- spec/fake_responses/get_account_balance.xml
|
@@ -226,14 +234,18 @@ files:
|
|
226
234
|
- spec/fake_responses/notify_workers.xml
|
227
235
|
- spec/fake_responses/register_hit_type.xml
|
228
236
|
- spec/fake_responses/reject_assignment.xml
|
237
|
+
- spec/fake_responses/revoke_qualification.xml
|
229
238
|
- spec/fake_responses/search_hits.xml
|
230
239
|
- spec/fake_responses/unblock_worker.xml
|
231
240
|
- spec/mturk.sample.yml
|
232
241
|
- spec/operations/approve_assignment_spec.rb
|
242
|
+
- spec/operations/assign_qualification_spec.rb
|
233
243
|
- spec/operations/block_worker_spec.rb
|
234
244
|
- spec/operations/create_hit_spec.rb
|
245
|
+
- spec/operations/create_qualification_type_spec.rb
|
235
246
|
- spec/operations/disable_hit_spec.rb
|
236
247
|
- spec/operations/dispose_hit_spec.rb
|
248
|
+
- spec/operations/dispose_qualification_type_spec.rb
|
237
249
|
- spec/operations/extend_hit_spec.rb
|
238
250
|
- spec/operations/force_expire_hit_spec.rb
|
239
251
|
- spec/operations/get_account_balance_spec.rb
|
@@ -244,6 +256,7 @@ files:
|
|
244
256
|
- spec/operations/notify_workers_spec.rb
|
245
257
|
- spec/operations/register_hit_type_spec.rb
|
246
258
|
- spec/operations/reject_assignment_spec.rb
|
259
|
+
- spec/operations/revoke_qualification_spec.rb
|
247
260
|
- spec/operations/send_test_event_notification_spec.rb
|
248
261
|
- spec/operations/set_hit_type_notification_spec.rb
|
249
262
|
- spec/operations/unblock_worker_spec.rb
|
@@ -293,10 +306,13 @@ test_files:
|
|
293
306
|
- spec/builders/qualifications_spec.rb
|
294
307
|
- spec/builders/question_spec.rb
|
295
308
|
- spec/operations/approve_assignment_spec.rb
|
309
|
+
- spec/operations/assign_qualification_spec.rb
|
296
310
|
- spec/operations/block_worker_spec.rb
|
297
311
|
- spec/operations/create_hit_spec.rb
|
312
|
+
- spec/operations/create_qualification_type_spec.rb
|
298
313
|
- spec/operations/disable_hit_spec.rb
|
299
314
|
- spec/operations/dispose_hit_spec.rb
|
315
|
+
- spec/operations/dispose_qualification_type_spec.rb
|
300
316
|
- spec/operations/extend_hit_spec.rb
|
301
317
|
- spec/operations/force_expire_hit_spec.rb
|
302
318
|
- spec/operations/get_account_balance_spec.rb
|
@@ -307,6 +323,7 @@ test_files:
|
|
307
323
|
- spec/operations/notify_workers_spec.rb
|
308
324
|
- spec/operations/register_hit_type_spec.rb
|
309
325
|
- spec/operations/reject_assignment_spec.rb
|
326
|
+
- spec/operations/revoke_qualification_spec.rb
|
310
327
|
- spec/operations/send_test_event_notification_spec.rb
|
311
328
|
- spec/operations/set_hit_type_notification_spec.rb
|
312
329
|
- spec/operations/unblock_worker_spec.rb
|