Skip to content

Commit

Permalink
Add additional attributes to Hit per issue ryantate#16
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Morgan authored and seeingidog committed Jul 11, 2012
1 parent d31748c commit 4efbc1c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
8 changes: 6 additions & 2 deletions lib/rturk/parsers/responses/get_hit_response.rb
Expand Up @@ -48,7 +48,8 @@ class GetHITResponse < Response
:expires_at, :assignments_duration, :reward_amount, :max_assignments,
:auto_approval_delay, :description, :reward, :lifetime, :annotation,
:similar_hits_count, :assignments_pending_count, :assignments_available_count,
:assignments_completed_count
:assignments_completed_count, :question_external_url, :qualification_requirement_comparator,
:qualification_requirement_value

def initialize(response)
@raw_xml = response.body
Expand All @@ -74,7 +75,10 @@ def initialize(response)
:similar_hits_count => 'NumberOfSimilarHITs',
:assignments_pending_count => 'NumberOfAssignmentsPending',
:assignments_available_count => 'NumberOfAssignmentsAvailable',
:assignments_completed_count => 'NumberOfAssignmentsCompleted'
:assignments_completed_count => 'NumberOfAssignmentsCompleted',
:question_external_url => 'Question/*/*[1]',
:qualification_requirement_comparator => 'QualificationRequirement/Comparator',
:qualification_requirement_value => 'QualificationRequirement/IntegerValue'
)

@keywords = @keywords.split(', ') if @keywords
Expand Down
8 changes: 4 additions & 4 deletions spec/fake_responses/get_hit.xml
Expand Up @@ -12,10 +12,10 @@
<CreationTime>2009-06-25T04:21:17Z</CreationTime>
<Title>Write a twitter update</Title>
<Description>Simply write a twitter update for me</Description>
<Question>&lt;ExternalQuestion xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2006-07-14/ExternalQuestion.xsd"&gt;
&lt;ExternalURL&gt;http://s3.amazonaws.com/mpercival.com/newtweet.html?id=foo&lt;/ExternalURL&gt;
&lt;FrameHeight&gt;400&lt;/FrameHeight&gt;
&lt;/ExternalQuestion&gt;
<Question><ExternalQuestion xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2006-07-14/ExternalQuestion.xsd">
<ExternalURL>http://s3.amazonaws.com/mpercival.com/newtweet.html?id=foo</ExternalURL>
<FrameHeight>400</FrameHeight>
</ExternalQuestion>
</Question>
<Keywords>twitter, blogging, writing, english</Keywords>
<HITStatus>Reviewable</HITStatus>
Expand Down
3 changes: 3 additions & 0 deletions spec/operations/get_hit_spec.rb
Expand Up @@ -11,6 +11,9 @@
response.type_id.should eql('YGKZ2W5X6YFZ08ZRXXZZ')
response.auto_approval_delay.should eql(3600)
response.status.should eql('Reviewable')
response.question_external_url.should eql("http://s3.amazonaws.com/mpercival.com/newtweet.html?id=foo")
response.qualification_requirement_comparator.should eql("GreaterThan")
response.qualification_requirement_value.should eql(90)
end

it "should not specify the ResponseGroup by default" do
Expand Down

0 comments on commit 4efbc1c

Please sign in to comment.