Class: Typingpool::Amazon::HIT::Full::FromSearchHITs

Inherits:
Typingpool::Amazon::HIT::Full show all
Defined in:
lib/typingpool/amazon/hit/full/fromsearchhits.rb

Overview

For more on why this subclass is neccesary, see the documentation for Typingpool::Amazon::HIT.cached_or_new_from_searchhits. In short, RTurk::HITParser objects returned by RTurk::SearchHITs are pointlessly and subtly different from RTurk::GetHITResponse objects. (I need to submit a patch to RTurk.)

Instance Attribute Summary

Attributes inherited from Typingpool::Amazon::HIT::Full

#assignments_completed, #assignments_duration, #assignments_pending, #expires_at, #id, #status, #type_id

Instance Method Summary collapse

Methods inherited from Typingpool::Amazon::HIT::Full

#annotation, #expired?, #expired_and_overdue?, #external_question, #external_question_param

Constructor Details

#initialize(rturk_hit, annotation) ⇒ FromSearchHITs

Constructor. Takes an RTurk::Hit instance and the text of the HIT’s annotation. The text of the annotation must be submitted as a separate param because RTurk::Hit instances returned by RTurk::SearchHITs do not bother to extract the annotation into an attribute, so we have to so that ourselves (elsewhere) using the raw xml.



20
21
22
23
24
25
# File 'lib/typingpool/amazon/hit/full/fromsearchhits.rb', line 20

def initialize(rturk_hit, annotation)
   import_standard_attrs_from_rturk_hit(rturk_hit)
   @assignments_completed = rturk_hit.completed_assignments
   @assignments_pending = rturk_hit.pending_assignments
   self.annotation = annotation
end

Instance Method Details

#external_question_urlObject



27
28
29
30
31
32
33
# File 'lib/typingpool/amazon/hit/full/fromsearchhits.rb', line 27

def external_question_url
  unless @checked_question
    self.external_question_url = at_amazon.xml
    @checked_question = true
  end
  @external_question_url
end