rturk 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.3.1
@@ -28,8 +28,14 @@ module RTurk
28
28
  new(response.hit_id, response)
29
29
  end
30
30
 
31
+ # Find all the details for a HIT
32
+ # You could do this manually with new(id), and only call for the details
33
+ # you need, or simply call this and get them all
31
34
  def find(id)
32
-
35
+ h = new(id)
36
+ h.details
37
+ h.assignments
38
+ h
33
39
  end
34
40
 
35
41
  def all_reviewable
@@ -2,19 +2,29 @@
2
2
 
3
3
  module RTurk
4
4
  class CreateQualificationType < Operation
5
- attr_accessor :name, :description, :keywords, :status, :auto_granted
6
- require_params :name
5
+ attr_accessor :name, :description, :keywords, :status, :auto_granted,
6
+ :retry_delay_in_seconds, :test, :answer_key,
7
+ :test_duration_in_seconds, :auto_granted_value
8
+ require_params :name, :description
7
9
 
8
10
  def parse(response)
9
- RTurk::CreateQualificationTypeResponse.new(response)
11
+ RTurk::GetQualificationTypeResponse.new(response)
10
12
  end
11
13
 
12
14
  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}
15
+ params = {
16
+ 'Name' => name,
17
+ 'Description' => description,
18
+ 'QualificationTypeStatus' => (status || "Active")
19
+ }
20
+ params['Keywords'] = keywords unless keywords.nil?
21
+ params['AutoGranted'] = auto_granted unless auto_granted.nil?
22
+ params['AutoGrantedValue'] = auto_granted_value unless auto_granted_value.nil?
23
+ params['RetryDelayInSeconds'] = retry_delay_in_seconds unless retry_delay_in_seconds.nil?
24
+ params['Test'] = test unless test.nil?
25
+ params['AnswerKey'] = answer_key unless answer_key.nil?
26
+ params['TestDurationInSeconds'] = test_duration_in_seconds unless test_duration_in_seconds.nil?
27
+ params
18
28
  end
19
29
  end
20
30
 
@@ -0,0 +1,20 @@
1
+ # Operation to get info about qualification type
2
+
3
+ module RTurk
4
+ class GetQualificationType < Operation
5
+ attr_accessor :qualification_type_id
6
+ require_params :qualification_type_id
7
+
8
+ def parse(xml)
9
+ RTurk::GetQualificationTypeResponse.new(xml)
10
+ end
11
+
12
+ def to_params
13
+ {'QualificationTypeId' => qualification_type_id}
14
+ end
15
+ end
16
+
17
+ def self.GetQualificationType(*args)
18
+ RTurk::GetQualificationType.create(*args)
19
+ end
20
+ end
@@ -0,0 +1,26 @@
1
+ # Operation to get qualifications for a qualification type
2
+
3
+ module RTurk
4
+ class GetQualificationsForQualificationType < Operation
5
+ attr_accessor :qualification_type_id, :status, :page_size, :page_number
6
+ require_params :qualification_type_id
7
+
8
+ def parse(xml)
9
+ RTurk::GetQualificationsForQualificationTypeResponse.new(xml)
10
+ end
11
+
12
+ def to_params
13
+ params = {
14
+ 'QualificationTypeId' => qualification_type_id
15
+ }
16
+ params['Status'] = status unless status.nil?
17
+ params['PageSize'] = page_size unless page_size.nil?
18
+ params['PageNumber'] = page_number unless page_number.nil?
19
+ params
20
+ end
21
+ end
22
+
23
+ def self.GetQualificationsForQualificationType(*args)
24
+ RTurk::GetQualificationsForQualificationType.create(*args)
25
+ end
26
+ end
@@ -13,6 +13,8 @@ module RTurk
13
13
  require_params :worker_ids, :subject, :message_text
14
14
 
15
15
  def to_params
16
+ message_text.strip!
17
+
16
18
  if worker_ids.length > 100
17
19
  raise ArgumentError, 'Cannot send a message to more than 100 workers at a time.'
18
20
  elsif message_text.length > 4096
@@ -10,7 +10,7 @@ module RTurk
10
10
  'QualificationTypeId' => qualification_type_id,
11
11
  'SubjectId' => subject_id
12
12
  }
13
- params['Reason'] = reason if reason
13
+ params['Reason'] = reason unless reason.nil?
14
14
  params
15
15
  end
16
16
  end
@@ -0,0 +1,36 @@
1
+ # Operation to update a qualification type
2
+
3
+ module RTurk
4
+ class UpdateQualificationType < Operation
5
+ attr_accessor :qualification_type_id, :name, :description, :keywords,
6
+ :status, :auto_granted, :retry_delay_in_seconds,
7
+ :test, :answer_key, :test_duration_in_seconds,
8
+ :auto_granted_value
9
+ require_params :qualification_type_id
10
+
11
+ def parse(xml)
12
+ RTurk::GetQualificationTypeResponse.new(xml)
13
+ end
14
+
15
+ def to_params
16
+ params = {
17
+ 'QualificationTypeId' => qualification_type_id
18
+ }
19
+ params['Name'] = name unless name.nil?
20
+ params['Description'] = description unless description.nil?
21
+ params['Keywords'] = keywords unless keywords.nil?
22
+ params['QualificationTypeStatus'] = status unless status.nil?
23
+ params['AutoGranted'] = auto_granted unless auto_granted.nil?
24
+ params['RetryDelayInSeconds'] = retry_delay_in_seconds unless retry_delay_in_seconds.nil?
25
+ params['Test'] = test unless test.nil?
26
+ params['AnswerKey'] = answer_key unless answer_key.nil?
27
+ params['TestDurationInSeconds'] = test_duration_in_seconds unless test_duration_in_seconds.nil?
28
+ params['AutoGrantedValue'] = auto_granted_value unless auto_granted_value.nil?
29
+ params
30
+ end
31
+ end
32
+
33
+ def self.UpdateQualificationType(*args)
34
+ RTurk::UpdateQualificationType.create(*args)
35
+ end
36
+ end
@@ -0,0 +1,19 @@
1
+ # Parses a Qualification object
2
+
3
+ module RTurk
4
+ class QualificationParser < RTurk::Parser
5
+ attr_reader :qualification_type_id, :subject_id, :grant_time,
6
+ :integer_value, :locale_value, :status
7
+
8
+ def initialize(qualifications_xml)
9
+ @xml_obj = qualifications_xml
10
+ map_content(@xml_obj,
11
+ :qualification_type_id => 'QualificationTypeId',
12
+ :subject_id => 'SubjectId',
13
+ :grant_time => 'GrantTime',
14
+ :integer_value => 'IntegerValue',
15
+ :locale_value => 'LocaleValue',
16
+ :status => 'Status')
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,33 @@
1
+ # Parses the GetQualificationType Response
2
+
3
+ module RTurk
4
+ class GetQualificationTypeResponse < Response
5
+ attr_reader :qualification_type_id, :creation_time, :name, :description,
6
+ :keywords, :status, :retry_delay_in_seconds, :is_requestable,
7
+ :test, :test_duration_in_seconds, :answer_key, :auto_granted,
8
+ :auto_granted_value
9
+
10
+ def initialize(response)
11
+ @raw_xml = response.body
12
+ @xml = Nokogiri::XML(@raw_xml)
13
+ raise_errors
14
+ map_content(@xml.xpath('//QualificationType'),
15
+ :qualification_type_id => 'QualificationTypeId',
16
+ :creation_time => 'CreationTime',
17
+ :name => 'Name',
18
+ :description => 'Description',
19
+ :keywords => 'Keywords',
20
+ :status => 'QualificationTypeStatus',
21
+ :retry_delay_in_seconds => 'RetryDelayInSeconds',
22
+ :is_requestable => 'IsRequestable',
23
+ :test => 'Test',
24
+ :test_duration_in_seconds => 'TestDurationInSeconds',
25
+ :answer_key => 'AnswerKey',
26
+ :auto_granted => 'AutoGranted',
27
+ :auto_granted_value => 'AutoGrantedValue'
28
+ )
29
+
30
+ @keywords = @keywords.split(', ') if @keywords
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,26 @@
1
+ # Parses the GetQualificationType Response
2
+
3
+ module RTurk
4
+ class GetQualificationsForQualificationTypeResponse < Response
5
+ attr_reader :num_results, :total_num_results, :page_number
6
+
7
+ def initialize(response)
8
+ @raw_xml = response.body
9
+ @xml = Nokogiri::XML(@raw_xml)
10
+ raise_errors
11
+ map_content(@xml.xpath('//GetQualificationsForQualificationTypeResult'),
12
+ :num_results => 'NumResults',
13
+ :total_num_results => 'TotalNumResults',
14
+ :page_number => 'PageNumber'
15
+ )
16
+ end
17
+
18
+ def qualifications
19
+ @qualifications ||= []
20
+ @xml.xpath('//Qualification').each do |qualification_xml|
21
+ @qualifications << QualificationParser.new(qualification_xml)
22
+ end
23
+ @qualifications
24
+ end
25
+ end
26
+ 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.3.0"
8
+ s.version = "2.3.1"
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-27}
12
+ s.date = %q{2010-09-25}
13
13
  s.email = %q{mark@mpercival.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -142,6 +142,8 @@ Gem::Specification.new do |s|
142
142
  "lib/rturk/operations/get_account_balance.rb",
143
143
  "lib/rturk/operations/get_assignments_for_hit.rb",
144
144
  "lib/rturk/operations/get_hit.rb",
145
+ "lib/rturk/operations/get_qualification_type.rb",
146
+ "lib/rturk/operations/get_qualifications_for_qualification_type.rb",
145
147
  "lib/rturk/operations/get_reviewable_hits.rb",
146
148
  "lib/rturk/operations/grant_bonus.rb",
147
149
  "lib/rturk/operations/notify_workers.rb",
@@ -152,16 +154,19 @@ Gem::Specification.new do |s|
152
154
  "lib/rturk/operations/send_test_event_notification.rb",
153
155
  "lib/rturk/operations/set_hit_type_notification.rb",
154
156
  "lib/rturk/operations/unblock_worker.rb",
157
+ "lib/rturk/operations/update_qualification_type.rb",
155
158
  "lib/rturk/parser.rb",
156
159
  "lib/rturk/parsers/answer_parser.rb",
157
160
  "lib/rturk/parsers/assignment_parser.rb",
158
161
  "lib/rturk/parsers/hit_parser.rb",
162
+ "lib/rturk/parsers/qualification_parser.rb",
159
163
  "lib/rturk/parsers/response.rb",
160
164
  "lib/rturk/parsers/responses/create_hit_response.rb",
161
- "lib/rturk/parsers/responses/create_qualification_type_response.rb",
162
165
  "lib/rturk/parsers/responses/get_account_balance_response.rb",
163
166
  "lib/rturk/parsers/responses/get_assignments_for_hit_response.rb",
164
167
  "lib/rturk/parsers/responses/get_hit_response.rb",
168
+ "lib/rturk/parsers/responses/get_qualification_type_response.rb",
169
+ "lib/rturk/parsers/responses/get_qualifications_for_qualification_type_response.rb",
165
170
  "lib/rturk/parsers/responses/get_reviewable_hits_response.rb",
166
171
  "lib/rturk/parsers/responses/register_hit_type_response.rb",
167
172
  "lib/rturk/parsers/responses/search_hits_response.rb",
@@ -189,6 +194,8 @@ Gem::Specification.new do |s|
189
194
  "spec/fake_responses/get_assignments.xml",
190
195
  "spec/fake_responses/get_assignments_multiple.xml",
191
196
  "spec/fake_responses/get_hit.xml",
197
+ "spec/fake_responses/get_qualification_type.xml",
198
+ "spec/fake_responses/get_qualifications_for_qualification_type.xml",
192
199
  "spec/fake_responses/get_reviewable_hits.xml",
193
200
  "spec/fake_responses/grant_bonus.xml",
194
201
  "spec/fake_responses/invalid_credentials.xml",
@@ -198,6 +205,7 @@ Gem::Specification.new do |s|
198
205
  "spec/fake_responses/revoke_qualification.xml",
199
206
  "spec/fake_responses/search_hits.xml",
200
207
  "spec/fake_responses/unblock_worker.xml",
208
+ "spec/fake_responses/update_qualification_type.xml",
201
209
  "spec/mturk.sample.yml",
202
210
  "spec/operations/approve_assignment_spec.rb",
203
211
  "spec/operations/assign_qualification_spec.rb",
@@ -212,6 +220,8 @@ Gem::Specification.new do |s|
212
220
  "spec/operations/get_account_balance_spec.rb",
213
221
  "spec/operations/get_assignments_spec.rb",
214
222
  "spec/operations/get_hit_spec.rb",
223
+ "spec/operations/get_qualification_type_spec.rb",
224
+ "spec/operations/get_qualifications_for_qualification_type_spec.rb",
215
225
  "spec/operations/get_reviewable_hits_spec.rb",
216
226
  "spec/operations/grant_bonus_spec.rb",
217
227
  "spec/operations/notify_workers_spec.rb",
@@ -221,6 +231,7 @@ Gem::Specification.new do |s|
221
231
  "spec/operations/send_test_event_notification_spec.rb",
222
232
  "spec/operations/set_hit_type_notification_spec.rb",
223
233
  "spec/operations/unblock_worker_spec.rb",
234
+ "spec/operations/update_qualification_type_spec.rb",
224
235
  "spec/parsers/answer_parser_spec.rb",
225
236
  "spec/parsers/hit_parser_spec.rb",
226
237
  "spec/requester_spec.rb",
@@ -255,6 +266,8 @@ Gem::Specification.new do |s|
255
266
  "spec/operations/get_account_balance_spec.rb",
256
267
  "spec/operations/get_assignments_spec.rb",
257
268
  "spec/operations/get_hit_spec.rb",
269
+ "spec/operations/get_qualification_type_spec.rb",
270
+ "spec/operations/get_qualifications_for_qualification_type_spec.rb",
258
271
  "spec/operations/get_reviewable_hits_spec.rb",
259
272
  "spec/operations/grant_bonus_spec.rb",
260
273
  "spec/operations/notify_workers_spec.rb",
@@ -264,6 +277,7 @@ Gem::Specification.new do |s|
264
277
  "spec/operations/send_test_event_notification_spec.rb",
265
278
  "spec/operations/set_hit_type_notification_spec.rb",
266
279
  "spec/operations/unblock_worker_spec.rb",
280
+ "spec/operations/update_qualification_type_spec.rb",
267
281
  "spec/parsers/answer_parser_spec.rb",
268
282
  "spec/parsers/hit_parser_spec.rb",
269
283
  "spec/requester_spec.rb",
@@ -19,6 +19,14 @@ describe "HIT adapter" do
19
19
  RTurk::Hit.create(:title => 'foo', :description => 'do foo', :question => 'http://mpercival.com', :reward => 0.05)
20
20
  end
21
21
 
22
+ it "should retrieve all the details of a HIT with find" do
23
+ proxy_hit = RTurk::Hit.new(12345)
24
+ proxy_hit.should_receive(:details)
25
+ proxy_hit.should_receive(:assignments)
26
+ RTurk::Hit.should_receive(:new).and_return(proxy_hit)
27
+ hit = RTurk::Hit.find(12345)
28
+ end
29
+
22
30
  it "should automagically request additional information on an existing hit" do
23
31
  hit = RTurk::Hit.new(12345)
24
32
  hit.type_id.should eql("YGKZ2W5X6YFZ08ZRXXZZ")
@@ -0,0 +1,18 @@
1
+ <GetQualificationTypeResponse>
2
+ <OperationRequest>
3
+ <RequestId>49341251-fcbd-45c3-ab98-8fbe2e4d8060</RequestId>
4
+ </OperationRequest>
5
+ <QualificationType>
6
+ <Request>
7
+ <IsValid>True</IsValid>
8
+ </Request>
9
+ <QualificationTypeId>789RVWYBAZW00EXAMPLE</QualificationTypeId>
10
+ <CreationTime>2005-01-31T23:59:59Z</CreationTime>
11
+ <Name>EnglishWritingAbility</Name>
12
+ <Description>The ability to write and edit text...</Description>
13
+ <Keywords>English, text, write, edit, language</Keywords>
14
+ <QualificationTypeStatus>Active</QualificationTypeStatus>
15
+ <RetryDelayInSeconds>86400</RetryDelayInSeconds>
16
+ <IsRequestable>true</IsRequestable>
17
+ </QualificationType>
18
+ </GetQualificationTypeResponse>
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0"?>
2
+ <GetQualificationsForQualificationTypeResponse>
3
+ <OperationRequest>
4
+ <RequestId>49341251-fcbd-45c3-ab98-8fbe2e4d8060</RequestId>
5
+ </OperationRequest>
6
+ <GetQualificationsForQualificationTypeResult>
7
+ <Request>
8
+ <IsValid>True</IsValid>
9
+ </Request>
10
+ <NumResults>2</NumResults>
11
+ <TotalNumResults>2</TotalNumResults>
12
+ <PageNumber>1</PageNumber>
13
+ <Qualification>
14
+ <QualificationTypeId>ZSPJXD4F1SFZP7YNJWR0</QualificationTypeId>
15
+ <SubjectId>AZ3456EXAMPLE</SubjectId>
16
+ <GrantTime>2009-07-15T01:21:28.296Z</GrantTime>
17
+ <IntegerValue>1</IntegerValue>
18
+ <Status>Granted</Status>
19
+ </Qualification>
20
+ <Qualification>
21
+ <QualificationTypeId>ZSPJXD4F1SFZP7YNJWR0</QualificationTypeId>
22
+ <SubjectId>AZ4567EXAMPLE</SubjectId>
23
+ <GrantTime>2009-07-15T01:21:28.296Z</GrantTime>
24
+ <IntegerValue>1</IntegerValue>
25
+ <Status>Granted</Status>
26
+ </Qualification>
27
+ </GetQualificationsForQualificationTypeResult>
28
+ </GetQualificationsForQualificationTypeResponse>
@@ -0,0 +1,15 @@
1
+ <UpdateQualificationTypeResult>
2
+ <Request>
3
+ <IsValid>True</IsValid>
4
+ </Request>
5
+ <QualificationType>
6
+ <QualificationTypeId>789RVWYBAZW00EXAMPLE</QualificationTypeId>
7
+ <CreationTime>2009-06-15T12:00:01Z</CreationTime>
8
+ <Name>EnglishWritingAbility</Name>
9
+ <Description>The ability to write and edit text...</Description>
10
+ <Keywords>English, text, write, edit, language</Keywords>
11
+ <QualificationTypeStatus>Active</QualificationTypeStatus>
12
+ <RetryDelayInSeconds>86400</RetryDelayInSeconds>
13
+ <IsRequestable>true</IsRequestable>
14
+ </QualificationType>
15
+ </UpdateQualificationTypeResult>
@@ -14,12 +14,11 @@ describe RTurk::CreateQualificationType do
14
14
  it "should successfully request the operation" do
15
15
  RTurk::Requester.should_receive(:request).once.with(
16
16
  hash_including('Operation' => 'CreateQualificationType'))
17
- RTurk::CreateQualificationType(:name => "bogus") rescue RTurk::InvalidRequest
17
+ RTurk::CreateQualificationType(:name => "bogus", :description => 'really bogus') rescue RTurk::InvalidRequest
18
18
  end
19
19
 
20
20
  it "should parse and return the result" do
21
- response = RTurk::CreateQualificationType(:name => "bogus")
22
- response['CreateQualificationTypeResponse']['QualificationType']['QualificationTypeId'].should == "ZSPJXD4F1SFZP7YNJWR0"
21
+ response = RTurk::CreateQualificationType(:name => "bogus", :description => 'really bogus')
23
22
  response.qualification_type_id.should == "ZSPJXD4F1SFZP7YNJWR0"
24
23
  end
25
24
  end
@@ -0,0 +1,26 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
+
3
+ describe RTurk::GetQualificationType 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('get_qualification_type', :operation => 'GetQualificationType')
8
+ end
9
+
10
+ it "should ensure required params" do
11
+ lambda{RTurk::GetQualificationType()}.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' => 'GetQualificationType'))
17
+ RTurk::GetQualificationType(:qualification_type_id => '789RVWYBAZW00EXAMPLE') rescue RTurk::InvalidRequest
18
+ end
19
+
20
+ it "should parse and return the result" do
21
+ response = RTurk::GetQualificationType(:qualification_type_id => '789RVWYBAZW00EXAMPLE')
22
+ response.name.should == 'EnglishWritingAbility'
23
+ response.description.should == "The ability to write and edit text..."
24
+ response.keywords.should == ["English", "text", "write", "edit", "language"]
25
+ end
26
+ end
@@ -0,0 +1,27 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
+
3
+ describe RTurk::GetQualificationsForQualificationType 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('get_qualifications_for_qualification_type', :operation => 'GetQualificationsForQualificationType')
8
+ end
9
+
10
+ it "should ensure required params" do
11
+ lambda{RTurk::GetQualificationsForQualificationType()}.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' => 'GetQualificationsForQualificationType'))
17
+ RTurk::GetQualificationsForQualificationType(:qualification_type_id => '789RVWYBAZW00EXAMPLE') rescue RTurk::InvalidRequest
18
+ end
19
+
20
+ it "should parse and return the result" do
21
+ response = RTurk::GetQualificationsForQualificationType(:qualification_type_id => '789RVWYBAZW00EXAMPLE')
22
+ response.num_results.should == 2
23
+ response.qualifications.length.should == 2
24
+ response.qualifications[0].subject_id.should == 'AZ3456EXAMPLE'
25
+ response.qualifications[1].subject_id.should == 'AZ4567EXAMPLE'
26
+ end
27
+ end
@@ -0,0 +1,24 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
+
3
+ describe RTurk::UpdateQualificationType 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('update_qualification_type', :operation => 'UpdateQualificationType')
8
+ end
9
+
10
+ it "should ensure required params" do
11
+ lambda{RTurk::UpdateQualificationType()}.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' => 'UpdateQualificationType'))
17
+ RTurk::UpdateQualificationType(:qualification_type_id => '789RVWYBAZW00EXAMPLE', :name => "bogus") rescue RTurk::InvalidRequest
18
+ end
19
+
20
+ it "should parse and return the result" do
21
+ response = RTurk::UpdateQualificationType(:qualification_type_id => '789RVWYBAZW00EXAMPLE', :name => "bogus")
22
+ response.qualification_type_id.should == "789RVWYBAZW00EXAMPLE"
23
+ end
24
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 3
8
- - 0
9
- version: 2.3.0
8
+ - 1
9
+ version: 2.3.1
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-27 00:00:00 -07:00
17
+ date: 2010-09-25 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -181,6 +181,8 @@ files:
181
181
  - lib/rturk/operations/get_account_balance.rb
182
182
  - lib/rturk/operations/get_assignments_for_hit.rb
183
183
  - lib/rturk/operations/get_hit.rb
184
+ - lib/rturk/operations/get_qualification_type.rb
185
+ - lib/rturk/operations/get_qualifications_for_qualification_type.rb
184
186
  - lib/rturk/operations/get_reviewable_hits.rb
185
187
  - lib/rturk/operations/grant_bonus.rb
186
188
  - lib/rturk/operations/notify_workers.rb
@@ -191,16 +193,19 @@ files:
191
193
  - lib/rturk/operations/send_test_event_notification.rb
192
194
  - lib/rturk/operations/set_hit_type_notification.rb
193
195
  - lib/rturk/operations/unblock_worker.rb
196
+ - lib/rturk/operations/update_qualification_type.rb
194
197
  - lib/rturk/parser.rb
195
198
  - lib/rturk/parsers/answer_parser.rb
196
199
  - lib/rturk/parsers/assignment_parser.rb
197
200
  - lib/rturk/parsers/hit_parser.rb
201
+ - lib/rturk/parsers/qualification_parser.rb
198
202
  - lib/rturk/parsers/response.rb
199
203
  - lib/rturk/parsers/responses/create_hit_response.rb
200
- - lib/rturk/parsers/responses/create_qualification_type_response.rb
201
204
  - lib/rturk/parsers/responses/get_account_balance_response.rb
202
205
  - lib/rturk/parsers/responses/get_assignments_for_hit_response.rb
203
206
  - lib/rturk/parsers/responses/get_hit_response.rb
207
+ - lib/rturk/parsers/responses/get_qualification_type_response.rb
208
+ - lib/rturk/parsers/responses/get_qualifications_for_qualification_type_response.rb
204
209
  - lib/rturk/parsers/responses/get_reviewable_hits_response.rb
205
210
  - lib/rturk/parsers/responses/register_hit_type_response.rb
206
211
  - lib/rturk/parsers/responses/search_hits_response.rb
@@ -228,6 +233,8 @@ files:
228
233
  - spec/fake_responses/get_assignments.xml
229
234
  - spec/fake_responses/get_assignments_multiple.xml
230
235
  - spec/fake_responses/get_hit.xml
236
+ - spec/fake_responses/get_qualification_type.xml
237
+ - spec/fake_responses/get_qualifications_for_qualification_type.xml
231
238
  - spec/fake_responses/get_reviewable_hits.xml
232
239
  - spec/fake_responses/grant_bonus.xml
233
240
  - spec/fake_responses/invalid_credentials.xml
@@ -237,6 +244,7 @@ files:
237
244
  - spec/fake_responses/revoke_qualification.xml
238
245
  - spec/fake_responses/search_hits.xml
239
246
  - spec/fake_responses/unblock_worker.xml
247
+ - spec/fake_responses/update_qualification_type.xml
240
248
  - spec/mturk.sample.yml
241
249
  - spec/operations/approve_assignment_spec.rb
242
250
  - spec/operations/assign_qualification_spec.rb
@@ -251,6 +259,8 @@ files:
251
259
  - spec/operations/get_account_balance_spec.rb
252
260
  - spec/operations/get_assignments_spec.rb
253
261
  - spec/operations/get_hit_spec.rb
262
+ - spec/operations/get_qualification_type_spec.rb
263
+ - spec/operations/get_qualifications_for_qualification_type_spec.rb
254
264
  - spec/operations/get_reviewable_hits_spec.rb
255
265
  - spec/operations/grant_bonus_spec.rb
256
266
  - spec/operations/notify_workers_spec.rb
@@ -260,6 +270,7 @@ files:
260
270
  - spec/operations/send_test_event_notification_spec.rb
261
271
  - spec/operations/set_hit_type_notification_spec.rb
262
272
  - spec/operations/unblock_worker_spec.rb
273
+ - spec/operations/update_qualification_type_spec.rb
263
274
  - spec/parsers/answer_parser_spec.rb
264
275
  - spec/parsers/hit_parser_spec.rb
265
276
  - spec/requester_spec.rb
@@ -318,6 +329,8 @@ test_files:
318
329
  - spec/operations/get_account_balance_spec.rb
319
330
  - spec/operations/get_assignments_spec.rb
320
331
  - spec/operations/get_hit_spec.rb
332
+ - spec/operations/get_qualification_type_spec.rb
333
+ - spec/operations/get_qualifications_for_qualification_type_spec.rb
321
334
  - spec/operations/get_reviewable_hits_spec.rb
322
335
  - spec/operations/grant_bonus_spec.rb
323
336
  - spec/operations/notify_workers_spec.rb
@@ -327,6 +340,7 @@ test_files:
327
340
  - spec/operations/send_test_event_notification_spec.rb
328
341
  - spec/operations/set_hit_type_notification_spec.rb
329
342
  - spec/operations/unblock_worker_spec.rb
343
+ - spec/operations/update_qualification_type_spec.rb
330
344
  - spec/parsers/answer_parser_spec.rb
331
345
  - spec/parsers/hit_parser_spec.rb
332
346
  - spec/requester_spec.rb
@@ -1,27 +0,0 @@
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