rturk 2.3.6 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
  gem 'nokogiri'
3
3
  gem 'jeweler'
4
- gem 'fakeweb'
4
+ gem 'webmock'
5
5
  gem 'rest-client'
6
6
  gem 'rspec', '~> 1.3.1'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.6
1
+ 2.4.0
@@ -1,6 +1,4 @@
1
- $: << File.join(File.dirname(__FILE__), '..', 'lib')
2
- require 'rubygems'
3
- require '../lib/rturk'
1
+ require File.expand_path('../example_helper', __FILE__)
4
2
 
5
3
  aws = YAML.load(File.open(File.join(File.dirname(__FILE__), 'mturk.yml')))
6
4
  RTurk::setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'])
@@ -1,6 +1,4 @@
1
- $: << File.join(File.dirname(__FILE__), '..', 'lib')
2
- require 'rubygems'
3
- require '../lib/rturk'
1
+ require File.expand_path('../example_helper', __FILE__)
4
2
 
5
3
  aws = YAML.load(File.open(File.join(File.dirname(__FILE__), 'mturk.yml')))
6
4
  RTurk::setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true)
@@ -0,0 +1,4 @@
1
+ $: << File.join(File.dirname(__FILE__), '..', 'lib')
2
+ require 'rubygems'
3
+ require 'yaml'
4
+ require '../lib/rturk'
@@ -1,7 +1,4 @@
1
- $: << File.join(File.dirname(__FILE__), '..', 'lib')
2
- require 'rubygems'
3
- require '../lib/rturk'
4
- require 'yaml'
1
+ require File.expand_path('../example_helper', __FILE__)
5
2
 
6
3
  aws = YAML.load(File.open(File.join(File.dirname(__FILE__), 'mturk.yml')))
7
4
  RTurk::setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'])
@@ -20,4 +17,4 @@ unless hits.empty?
20
17
  assignment.approve! if assignment.status == 'Submitted'
21
18
  end
22
19
  end
23
- end
20
+ end
@@ -93,6 +93,13 @@ module RTurk
93
93
  RTurk::DisableHIT(:hit_id => self.id)
94
94
  end
95
95
 
96
+ def set_as_reviewing!
97
+ RTurk::SetHITAsReviewing(:hit_id => self.id)
98
+ end
99
+
100
+ def set_as_reviewable!
101
+ RTurk::SetHITAsReviewing(:hit_id => self.id, :revert => true)
102
+ end
96
103
 
97
104
  def url
98
105
  if RTurk.sandbox?
@@ -34,13 +34,8 @@ module RTurk
34
34
  qualifier[:QualificationTypeId] = types[type]
35
35
  end
36
36
  if opts.is_a?(Hash)
37
- qualifier[:Comparator] = COMPARATORS[opts.keys.first]
38
- value = opts.values.first
39
- if value.to_s.match(/[A-Z]./)
40
- qualifier[:Country] = value
41
- else
42
- qualifier[:IntegerValue] = value
43
- end
37
+ qualifier[:RequiredToPreview] = opts['RequiredToPreview'].to_s unless opts['RequiredToPreview'].nil?
38
+ qualifier.merge!(build_comparator(opts))
44
39
  elsif opts == true || opts == false
45
40
  qualifier[:IntegerValue] = opts == true ? 1 : 0
46
41
  qualifier[:Comparator] = COMPARATORS[:eql]
@@ -63,6 +58,23 @@ module RTurk
63
58
  TYPES
64
59
  end
65
60
 
61
+ private
62
+
63
+ def build_comparator(opts)
64
+ qualifier = {}
65
+ opts.each do |k,v|
66
+ if COMPARATORS.has_key?(k)
67
+ qualifier[:Comparator] = COMPARATORS[k]
68
+ if v.to_s.match(/[A-Z]./)
69
+ qualifier[:Country] = v
70
+ else
71
+ qualifier[:IntegerValue] = v
72
+ end
73
+ end
74
+ end
75
+ qualifier
76
+ end
77
+
66
78
  end
67
79
 
68
80
  end
@@ -0,0 +1,18 @@
1
+ # http://docs.amazonwebservices.com/AWSMechTurk/2008-08-02/AWSMturkAPI/ApiReference_SetHITAsReviewingOperation.html
2
+ module RTurk
3
+ class SetHITAsReviewing < Operation
4
+
5
+ require_params :hit_id
6
+ attr_accessor :hit_id, :revert
7
+
8
+ def to_params
9
+ {'HITId' => self.hit_id, 'Revert' => self.revert}
10
+ end
11
+
12
+ end
13
+
14
+ def self.SetHITAsReviewing(*args, &blk)
15
+ RTurk::SetHITAsReviewing.create(*args, &blk)
16
+ end
17
+
18
+ end
@@ -45,7 +45,7 @@ module RTurk
45
45
  end.join('&') # order doesn't matter for the actual request
46
46
 
47
47
  RTurk.logger.debug "Sending request:\n\t #{credentials.host}?#{querystring}"
48
- RestClient.get("#{credentials.host}?#{querystring}")
48
+ RestClient.post(credentials.host, querystring)
49
49
  end
50
50
 
51
51
  private
@@ -54,6 +54,13 @@ module RTurk
54
54
  RTurk
55
55
  end
56
56
 
57
+ def stubbed_response
58
+ @stubbed_responses ||= []
59
+ @stubbed_responses.each do |sr|
60
+ return sr.response if sr.matches(params)
61
+ end
62
+ end
63
+
57
64
  def sign(secret_key, service,method,time)
58
65
  msg = "#{service}#{method}#{time}"
59
66
  return hmac_sha1(secret_key, msg )
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rturk}
8
- s.version = "2.3.5"
8
+ s.version = "2.4.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", "Zach Hale", "David Balatero", "Rob Hanlon"]
12
- s.date = %q{2011-03-29}
12
+ s.date = %q{2011-06-03}
13
13
  s.email = %q{mark@mpercival.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -112,6 +112,7 @@ Gem::Specification.new do |s|
112
112
  "aws_docs/toc.js",
113
113
  "examples/blank_slate.rb",
114
114
  "examples/create_hit.rb",
115
+ "examples/example_helper.rb",
115
116
  "examples/mturk.sample.yml",
116
117
  "examples/newtweet.html",
117
118
  "examples/review_answer.rb",
@@ -148,12 +149,15 @@ Gem::Specification.new do |s|
148
149
  "lib/rturk/operations/get_qualifications_for_qualification_type.rb",
149
150
  "lib/rturk/operations/get_reviewable_hits.rb",
150
151
  "lib/rturk/operations/grant_bonus.rb",
152
+ "lib/rturk/operations/grant_qualification.rb",
151
153
  "lib/rturk/operations/notify_workers.rb",
152
154
  "lib/rturk/operations/register_hit_type.rb",
153
155
  "lib/rturk/operations/reject_assignment.rb",
156
+ "lib/rturk/operations/reject_qualification_request.rb",
154
157
  "lib/rturk/operations/revoke_qualification.rb",
155
158
  "lib/rturk/operations/search_hits.rb",
156
159
  "lib/rturk/operations/send_test_event_notification.rb",
160
+ "lib/rturk/operations/set_hit_as_reviewing.rb",
157
161
  "lib/rturk/operations/set_hit_type_notification.rb",
158
162
  "lib/rturk/operations/unblock_worker.rb",
159
163
  "lib/rturk/operations/update_qualification_type.rb",
@@ -206,12 +210,15 @@ Gem::Specification.new do |s|
206
210
  "spec/fake_responses/get_qualifications_for_qualification_type.xml",
207
211
  "spec/fake_responses/get_reviewable_hits.xml",
208
212
  "spec/fake_responses/grant_bonus.xml",
213
+ "spec/fake_responses/grant_qualification.xml",
209
214
  "spec/fake_responses/invalid_credentials.xml",
210
215
  "spec/fake_responses/notify_workers.xml",
211
216
  "spec/fake_responses/register_hit_type.xml",
212
217
  "spec/fake_responses/reject_assignment.xml",
218
+ "spec/fake_responses/reject_qualification_request.xml",
213
219
  "spec/fake_responses/revoke_qualification.xml",
214
220
  "spec/fake_responses/search_hits.xml",
221
+ "spec/fake_responses/set_hit_as_reviewing.xml",
215
222
  "spec/fake_responses/unblock_worker.xml",
216
223
  "spec/fake_responses/update_qualification_type.xml",
217
224
  "spec/mturk.sample.yml",
@@ -234,11 +241,14 @@ Gem::Specification.new do |s|
234
241
  "spec/operations/get_qualifications_for_qualification_type_spec.rb",
235
242
  "spec/operations/get_reviewable_hits_spec.rb",
236
243
  "spec/operations/grant_bonus_spec.rb",
244
+ "spec/operations/grant_qualification_spec.rb",
237
245
  "spec/operations/notify_workers_spec.rb",
238
246
  "spec/operations/register_hit_type_spec.rb",
239
247
  "spec/operations/reject_assignment_spec.rb",
248
+ "spec/operations/reject_qualification_request_spec.rb",
240
249
  "spec/operations/revoke_qualification_spec.rb",
241
250
  "spec/operations/send_test_event_notification_spec.rb",
251
+ "spec/operations/set_hit_as_reviewing_spec.rb",
242
252
  "spec/operations/set_hit_type_notification_spec.rb",
243
253
  "spec/operations/unblock_worker_spec.rb",
244
254
  "spec/operations/update_qualification_type_spec.rb",
@@ -253,78 +263,35 @@ Gem::Specification.new do |s|
253
263
  ]
254
264
  s.homepage = %q{http://github.com/mdp/rturk}
255
265
  s.require_paths = ["lib"]
256
- s.rubygems_version = %q{1.3.7}
266
+ s.rubygems_version = %q{1.7.2}
257
267
  s.summary = %q{Mechanical Turk API Wrapper}
258
- s.test_files = [
259
- "examples/blank_slate.rb",
260
- "examples/create_hit.rb",
261
- "examples/review_answer.rb",
262
- "spec/adapters/assignment_spec.rb",
263
- "spec/adapters/hit_spec.rb",
264
- "spec/builders/notification_builder_spec.rb",
265
- "spec/builders/qualification_spec.rb",
266
- "spec/builders/qualifications_spec.rb",
267
- "spec/builders/question_spec.rb",
268
- "spec/operations/approve_assignment_spec.rb",
269
- "spec/operations/assign_qualification_spec.rb",
270
- "spec/operations/block_worker_spec.rb",
271
- "spec/operations/create_hit_spec.rb",
272
- "spec/operations/create_qualification_type_spec.rb",
273
- "spec/operations/disable_hit_spec.rb",
274
- "spec/operations/dispose_hit_spec.rb",
275
- "spec/operations/dispose_qualification_type_spec.rb",
276
- "spec/operations/extend_hit_spec.rb",
277
- "spec/operations/force_expire_hit_spec.rb",
278
- "spec/operations/get_account_balance_spec.rb",
279
- "spec/operations/get_assignments_spec.rb",
280
- "spec/operations/get_bonus_payments_spec.rb",
281
- "spec/operations/get_hit_spec.rb",
282
- "spec/operations/get_qualification_requests_spec.rb",
283
- "spec/operations/get_qualification_type_spec.rb",
284
- "spec/operations/get_qualifications_for_qualification_type_spec.rb",
285
- "spec/operations/get_reviewable_hits_spec.rb",
286
- "spec/operations/grant_bonus_spec.rb",
287
- "spec/operations/notify_workers_spec.rb",
288
- "spec/operations/register_hit_type_spec.rb",
289
- "spec/operations/reject_assignment_spec.rb",
290
- "spec/operations/revoke_qualification_spec.rb",
291
- "spec/operations/send_test_event_notification_spec.rb",
292
- "spec/operations/set_hit_type_notification_spec.rb",
293
- "spec/operations/unblock_worker_spec.rb",
294
- "spec/operations/update_qualification_type_spec.rb",
295
- "spec/parsers/answer_parser_spec.rb",
296
- "spec/parsers/hit_parser_spec.rb",
297
- "spec/requester_spec.rb",
298
- "spec/response_spec.rb",
299
- "spec/rturk_spec.rb",
300
- "spec/spec_helper.rb",
301
- "spec/xml_parse_spec.rb"
302
- ]
303
268
 
304
269
  if s.respond_to? :specification_version then
305
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
306
270
  s.specification_version = 3
307
271
 
308
272
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
309
273
  s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
310
- s.add_runtime_dependency(%q<fakeweb>, [">= 0"])
274
+ s.add_runtime_dependency(%q<jeweler>, [">= 0"])
275
+ s.add_runtime_dependency(%q<webmock>, [">= 0"])
311
276
  s.add_runtime_dependency(%q<rest-client>, [">= 0"])
312
- s.add_runtime_dependency(%q<rspec>, [">= 0"])
277
+ s.add_runtime_dependency(%q<rspec>, ["~> 1.3.1"])
313
278
  s.add_runtime_dependency(%q<rest-client>, [">= 1.4.0"])
314
279
  s.add_runtime_dependency(%q<nokogiri>, [">= 1.4.1"])
315
280
  else
316
281
  s.add_dependency(%q<nokogiri>, [">= 0"])
317
- s.add_dependency(%q<fakeweb>, [">= 0"])
282
+ s.add_dependency(%q<jeweler>, [">= 0"])
283
+ s.add_dependency(%q<webmock>, [">= 0"])
318
284
  s.add_dependency(%q<rest-client>, [">= 0"])
319
- s.add_dependency(%q<rspec>, [">= 0"])
285
+ s.add_dependency(%q<rspec>, ["~> 1.3.1"])
320
286
  s.add_dependency(%q<rest-client>, [">= 1.4.0"])
321
287
  s.add_dependency(%q<nokogiri>, [">= 1.4.1"])
322
288
  end
323
289
  else
324
290
  s.add_dependency(%q<nokogiri>, [">= 0"])
325
- s.add_dependency(%q<fakeweb>, [">= 0"])
291
+ s.add_dependency(%q<jeweler>, [">= 0"])
292
+ s.add_dependency(%q<webmock>, [">= 0"])
326
293
  s.add_dependency(%q<rest-client>, [">= 0"])
327
- s.add_dependency(%q<rspec>, [">= 0"])
294
+ s.add_dependency(%q<rspec>, ["~> 1.3.1"])
328
295
  s.add_dependency(%q<rest-client>, [">= 1.4.0"])
329
296
  s.add_dependency(%q<nokogiri>, [">= 1.4.1"])
330
297
  end
@@ -12,6 +12,7 @@ describe "HIT adapter" do
12
12
  faker('extend_hit', :operation => 'ExtendHIT')
13
13
  faker('force_expire_hit', :operation => 'ForceExpireHIT')
14
14
  faker('dispose_hit', :operation => 'DisposeHIT')
15
+ faker('set_hit_as_reviewing', :operation => 'SetHITAsReviewing')
15
16
  faker('search_hits', :operation => 'SearchHITs')
16
17
  end
17
18
 
@@ -72,7 +73,15 @@ describe "HIT adapter" do
72
73
  hits = RTurk::Hit.all_reviewable
73
74
  hits.first.dispose!
74
75
  end
75
-
76
+
77
+ it "should set a hit as Reviewing and Reviewable" do
78
+ hit = RTurk::Hit.all_reviewable.first
79
+ RTurk.should_receive(:SetHITAsReviewing).once.with(:hit_id => hit.id)
80
+ hit.set_as_reviewing!
81
+ RTurk.should_receive(:SetHITAsReviewing).once.with(:hit_id => hit.id, :revert => true)
82
+ hit.set_as_reviewable!
83
+ end
84
+
76
85
  it "should return a list of all hits" do
77
86
  hits = RTurk::Hit.all
78
87
  hits.size.should eql(2)
@@ -15,6 +15,12 @@ describe RTurk::Qualifications do
15
15
  @qualification.to_params.should eql({"QualificationTypeId" => '000000000000000000L0',"Comparator" => 'GreaterThan',
16
16
  "IntegerValue" => 90, "RequiredToPreview" => "true"})
17
17
  end
18
+
19
+ it "should build a qualification for Approval rate which does not require preview" do
20
+ @qualification = RTurk::Qualification.new('000000000000000000L0', :gt => 90, "RequiredToPreview" => false)
21
+ @qualification.to_params.should eql({"QualificationTypeId" => '000000000000000000L0',"Comparator" => 'GreaterThan',
22
+ "IntegerValue" => 90, "RequiredToPreview" => 'false'})
23
+ end
18
24
 
19
25
  it "should build a qualification for boolean qualification" do
20
26
  @qualification = RTurk::Qualification.new('00000000000000000060', true)
@@ -0,0 +1,5 @@
1
+ <SetHITAsReviewingResult>
2
+ <Request>
3
+ <IsValid>True</IsValid>
4
+ </Request>
5
+ </SetHITAsReviewingResult>
@@ -5,7 +5,7 @@ describe "using mechanical turk with RTurk" do
5
5
  before(:all) do
6
6
  aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml')))
7
7
  RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true)
8
- FakeWeb.clean_registry
8
+ WebMock.reset!
9
9
  faker('create_hit', :operation => "CreateHIT")
10
10
  faker('get_hit', :operation => "GetHIT")
11
11
  end
@@ -18,7 +18,7 @@ describe RTurk::GetAssignmentsForHIT do
18
18
 
19
19
  context "an HIT with one assignment" do
20
20
  before(:all) do
21
- FakeWeb.clean_registry
21
+ WebMock.reset!
22
22
  faker('get_assignments', :operation => 'GetAssignmentsForHIT')
23
23
  end
24
24
 
@@ -31,7 +31,7 @@ describe RTurk::GetAssignmentsForHIT do
31
31
  context "an HIT with multiple assignment" do
32
32
 
33
33
  before(:all) do
34
- FakeWeb.clean_registry
34
+ WebMock.reset!
35
35
  faker('get_assignments_multiple', :operation => 'GetAssignmentsForHIT')
36
36
  end
37
37
 
@@ -8,7 +8,7 @@ describe RTurk::GetBonusPayments do
8
8
 
9
9
  context "a HIT with multiple payments" do
10
10
  before(:all) do
11
- FakeWeb.clean_registry
11
+ WebMock.reset!
12
12
  faker('get_bonus_payments', :operation => 'GetBonusPayments')
13
13
 
14
14
  @response = RTurk::GetBonusPayments(:hit_id => 'fdsa')
@@ -5,7 +5,7 @@ describe RTurk::RegisterHITType do
5
5
  before(:all) do
6
6
  aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml')))
7
7
  RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true)
8
- FakeWeb.clean_registry
8
+ WebMock.reset!
9
9
  faker('register_hit_type', :operation => "RegisterHITType")
10
10
 
11
11
  @lambda = lambda do
@@ -0,0 +1,29 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
+
3
+ describe RTurk::SetHITAsReviewing 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
+ faker('set_hit_as_reviewing', :operation => 'SetHITAsReviewing')
9
+ end
10
+
11
+ it "should ensure required params" do
12
+ lambda{RTurk::SetHITAsReviewing()}.should raise_error(RTurk::MissingParameters)
13
+ end
14
+
15
+ it "should successfully request the operation" do
16
+ RTurk::Requester.should_receive(:request).twice.with(
17
+ hash_including('Operation' => 'SetHITAsReviewing'))
18
+ RTurk::SetHITAsReviewing(:hit_id => "123456789") rescue RTurk::InvalidRequest
19
+ RTurk::SetHITAsReviewing(:hit_id => "123456789", :revert => true) rescue RTurk::InvalidRequest
20
+ end
21
+
22
+ it "should parse and return the result" do
23
+ RTurk::SetHITAsReviewing(:hit_id => "123456789").should
24
+ be_a_kind_of RTurk::Response
25
+ RTurk::SetHITAsReviewing(:hit_id => "123456789", :revert => true).should
26
+ be_a_kind_of RTurk::Response
27
+ end
28
+
29
+ end
@@ -3,13 +3,13 @@ require 'spec_helper'
3
3
  describe RTurk::Requester do
4
4
 
5
5
  before(:all) do
6
- FakeWeb.clean_registry
6
+ WebMock.reset!
7
7
  aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml')))
8
8
  RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true)
9
9
  end
10
10
 
11
11
  it "should send the request to Amazon" do
12
- RestClient.should_receive(:get).with(/amazonaws.*Operation=GetHIT.*$/)
12
+ RestClient.should_receive(:post).with(/amazonaws/, /Operation=GetHIT.*$/)
13
13
  RTurk::Requester.request(:Operation => 'GetHIT', 'HITId' => 'test')
14
14
  end
15
15
 
@@ -19,7 +19,8 @@ describe RTurk::Requester do
19
19
  'Param1' => 'test1',
20
20
  'Param2' => 'test2'
21
21
  }
22
- RestClient.should_receive(:get).with(
22
+ RestClient.should_receive(:post).with(
23
+ /amazonaws/,
23
24
  /(?=.*Operation=GetHIT)(?=.*Param1=test1)(?=.*Param2=test2)/)
24
25
  RTurk::Requester.request(params)
25
26
  end
@@ -30,7 +31,8 @@ describe RTurk::Requester do
30
31
  'Param1' => 'test1',
31
32
  'Param2' => %w(test2a test2b)
32
33
  }
33
- RestClient.should_receive(:get).with(
34
+ RestClient.should_receive(:post).with(
35
+ /amazonaws/,
34
36
  /(?=.*Operation=GetHIT)(?=.*Param1=test1)(?=.*Param2=test2a)(?=.*Param2=test2b)/)
35
37
  RTurk::Requester.request(params)
36
38
  end
@@ -41,8 +43,9 @@ describe RTurk::Requester do
41
43
  'Param1' => 'test1',
42
44
  'Param2' => {0 => 'test2a', 1 => 'test2b'}
43
45
  }
44
- RestClient.should_receive(:get).with(
46
+ RestClient.should_receive(:post).with(
47
+ /amazonaws/,
45
48
  /(?=.*Operation=GetHIT)(?=.*Param1=test1)(?=.*Param2.0=test2a)(?=.*Param2.1=test2b)/)
46
49
  RTurk::Requester.request(params)
47
50
  end
48
- end
51
+ end
@@ -5,15 +5,8 @@ require 'rubygems'
5
5
  require 'spec'
6
6
  require 'fakeweb'
7
7
  require 'yaml'
8
-
9
- module FakeWeb
10
- class Registry
11
- # Comment out this override if you're using a quantum computer
12
- def variations_of_uri_as_strings(uri)
13
- [uri.to_s]
14
- end
15
- end
16
- end
8
+ require 'webmock'
9
+ include WebMock::API
17
10
 
18
11
  require 'rturk'
19
12
  # RTurk.log.level = Logger::DEBUG
@@ -22,13 +15,12 @@ require 'rturk'
22
15
  RTurk.setup(@aws['AWSAccessKeyId'], @aws['AWSAccessKey'], :sandbox => true)
23
16
 
24
17
  def faker(response_name, opts = {})
18
+ response = File.read(File.join(SPEC_ROOT, 'fake_responses', "#{response_name.to_s}.xml"))
25
19
  if opts[:operation]
26
- match = %r[amazonaws\.com\/?\?.*Operation=#{opts[:operation]}.*$]
20
+ stub_request(:post, /amazonaws.com/).with(:body => /Operation=#{opts[:operation]}/).to_return(:body => response)
27
21
  else
28
- match = %r[amazonaws\.com]
22
+ stub_request(:post, /amazonaws.com/).to_return(:body => response)
29
23
  end
30
- response = File.read(File.join(SPEC_ROOT, 'fake_responses', "#{response_name.to_s}.xml"))
31
- FakeWeb.register_uri(:get, match, :body => response)
32
24
  end
33
25
 
34
26
  def fake_response(xml)
@@ -36,5 +28,5 @@ def fake_response(xml)
36
28
  end
37
29
 
38
30
  Spec::Runner.configure do |config|
39
-
31
+
40
32
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rturk
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.3.6
5
+ version: 2.4.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Mark Percival
@@ -13,8 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2011-03-31 00:00:00 +00:00
17
- default_executable:
16
+ date: 2011-06-03 00:00:00 Z
18
17
  dependencies:
19
18
  - !ruby/object:Gem::Dependency
20
19
  name: nokogiri
@@ -39,7 +38,7 @@ dependencies:
39
38
  prerelease: false
40
39
  version_requirements: *id002
41
40
  - !ruby/object:Gem::Dependency
42
- name: fakeweb
41
+ name: webmock
43
42
  requirement: &id003 !ruby/object:Gem::Requirement
44
43
  none: false
45
44
  requirements:
@@ -199,6 +198,7 @@ files:
199
198
  - aws_docs/toc.js
200
199
  - examples/blank_slate.rb
201
200
  - examples/create_hit.rb
201
+ - examples/example_helper.rb
202
202
  - examples/mturk.sample.yml
203
203
  - examples/newtweet.html
204
204
  - examples/review_answer.rb
@@ -243,6 +243,7 @@ files:
243
243
  - lib/rturk/operations/revoke_qualification.rb
244
244
  - lib/rturk/operations/search_hits.rb
245
245
  - lib/rturk/operations/send_test_event_notification.rb
246
+ - lib/rturk/operations/set_hit_as_reviewing.rb
246
247
  - lib/rturk/operations/set_hit_type_notification.rb
247
248
  - lib/rturk/operations/unblock_worker.rb
248
249
  - lib/rturk/operations/update_qualification_type.rb
@@ -303,6 +304,7 @@ files:
303
304
  - spec/fake_responses/reject_qualification_request.xml
304
305
  - spec/fake_responses/revoke_qualification.xml
305
306
  - spec/fake_responses/search_hits.xml
307
+ - spec/fake_responses/set_hit_as_reviewing.xml
306
308
  - spec/fake_responses/unblock_worker.xml
307
309
  - spec/fake_responses/update_qualification_type.xml
308
310
  - spec/mturk.sample.yml
@@ -332,6 +334,7 @@ files:
332
334
  - spec/operations/reject_qualification_request_spec.rb
333
335
  - spec/operations/revoke_qualification_spec.rb
334
336
  - spec/operations/send_test_event_notification_spec.rb
337
+ - spec/operations/set_hit_as_reviewing_spec.rb
335
338
  - spec/operations/set_hit_type_notification_spec.rb
336
339
  - spec/operations/unblock_worker_spec.rb
337
340
  - spec/operations/update_qualification_type_spec.rb
@@ -343,7 +346,6 @@ files:
343
346
  - spec/spec_helper.rb
344
347
  - spec/tmp
345
348
  - spec/xml_parse_spec.rb
346
- has_rdoc: true
347
349
  homepage: http://github.com/mdp/rturk
348
350
  licenses: []
349
351
 
@@ -367,53 +369,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
367
369
  requirements: []
368
370
 
369
371
  rubyforge_project:
370
- rubygems_version: 1.6.2
372
+ rubygems_version: 1.7.2
371
373
  signing_key:
372
374
  specification_version: 3
373
375
  summary: Mechanical Turk API Wrapper
374
- test_files:
375
- - examples/blank_slate.rb
376
- - examples/create_hit.rb
377
- - examples/review_answer.rb
378
- - spec/adapters/assignment_spec.rb
379
- - spec/adapters/hit_spec.rb
380
- - spec/builders/notification_builder_spec.rb
381
- - spec/builders/qualification_spec.rb
382
- - spec/builders/qualifications_spec.rb
383
- - spec/builders/question_spec.rb
384
- - spec/operations/approve_assignment_spec.rb
385
- - spec/operations/assign_qualification_spec.rb
386
- - spec/operations/block_worker_spec.rb
387
- - spec/operations/create_hit_spec.rb
388
- - spec/operations/create_qualification_type_spec.rb
389
- - spec/operations/disable_hit_spec.rb
390
- - spec/operations/dispose_hit_spec.rb
391
- - spec/operations/dispose_qualification_type_spec.rb
392
- - spec/operations/extend_hit_spec.rb
393
- - spec/operations/force_expire_hit_spec.rb
394
- - spec/operations/get_account_balance_spec.rb
395
- - spec/operations/get_assignments_spec.rb
396
- - spec/operations/get_bonus_payments_spec.rb
397
- - spec/operations/get_hit_spec.rb
398
- - spec/operations/get_qualification_requests_spec.rb
399
- - spec/operations/get_qualification_type_spec.rb
400
- - spec/operations/get_qualifications_for_qualification_type_spec.rb
401
- - spec/operations/get_reviewable_hits_spec.rb
402
- - spec/operations/grant_bonus_spec.rb
403
- - spec/operations/grant_qualification_spec.rb
404
- - spec/operations/notify_workers_spec.rb
405
- - spec/operations/register_hit_type_spec.rb
406
- - spec/operations/reject_assignment_spec.rb
407
- - spec/operations/reject_qualification_request_spec.rb
408
- - spec/operations/revoke_qualification_spec.rb
409
- - spec/operations/send_test_event_notification_spec.rb
410
- - spec/operations/set_hit_type_notification_spec.rb
411
- - spec/operations/unblock_worker_spec.rb
412
- - spec/operations/update_qualification_type_spec.rb
413
- - spec/parsers/answer_parser_spec.rb
414
- - spec/parsers/hit_parser_spec.rb
415
- - spec/requester_spec.rb
416
- - spec/response_spec.rb
417
- - spec/rturk_spec.rb
418
- - spec/spec_helper.rb
419
- - spec/xml_parse_spec.rb
376
+ test_files: []
377
+