forked from ryantate/rturk
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for the SetHITAsReviewing operation.
- Loading branch information
1 parent
d1d3c42
commit f3ec6a9
Showing
5 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# http://docs.amazonwebservices.com/AWSMturkAPI/2008-08-02/ApiReference_DisposeHITOperation.html | ||
module RTurk | ||
class SetHITAsReviewing < Operation | ||
|
||
require_params :hit_id | ||
attr_accessor :hit_id, :revert | ||
|
||
def to_params | ||
{'HITId' => self.hit_id, 'Revert' => self.revert} | ||
end | ||
|
||
end | ||
|
||
def self.SetHITAsReviewing(*args, &blk) | ||
RTurk::SetHITAsReviewing.create(*args, &blk) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<SetHITAsReviewingResult> | ||
<Request> | ||
<IsValid>True</IsValid> | ||
</Request> | ||
</SetHITAsReviewingResult> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) | ||
|
||
describe RTurk::SetHITAsReviewing do | ||
|
||
before(:all) do | ||
aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml'))) | ||
RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true) | ||
faker('set_hit_as_reviewing', :operation => 'SetHITAsReviewing') | ||
end | ||
|
||
it "should ensure required params" do | ||
lambda{RTurk::SetHITAsReviewing()}.should raise_error(RTurk::MissingParameters) | ||
end | ||
|
||
it "should successfully request the operation" do | ||
RTurk::Requester.should_receive(:request).twice.with( | ||
hash_including('Operation' => 'SetHITAsReviewing')) | ||
RTurk::SetHITAsReviewing(:hit_id => "123456789") rescue RTurk::InvalidRequest | ||
RTurk::SetHITAsReviewing(:hit_id => "123456789", :revert => true) rescue RTurk::InvalidRequest | ||
end | ||
|
||
it "should parse and return the result" do | ||
RTurk::SetHITAsReviewing(:hit_id => "123456789").should | ||
be_a_kind_of RTurk::Response | ||
RTurk::SetHITAsReviewing(:hit_id => "123456789", :revert => true).should | ||
be_a_kind_of RTurk::Response | ||
end | ||
|
||
end |