Class: RTurk::SearchHITsResponse

Inherits:
Response show all
Defined in:
lib/rturk/parsers/responses/search_hits_response.rb

Overview

<SearchHITsResult>

<Request>
  <IsValid>True</IsValid>
</Request>
<NumResults>2</NumResults>
<TotalNumResults>2</TotalNumResults>
<PageNumber>1</PageNumber>

<HIT>
  <HITId>GBHZVQX3EHXZ2AYDY2T0</HITId>
  <HITTypeId>NYVZTQ1QVKJZXCYZCZVZ</HITTypeId>
  <CreationTime>2009-04-22T00:17:32Z</CreationTime>
  <Title>Location</Title>
  <Description>Select the image that best represents</Description>
  <HITStatus>Reviewable</HITStatus>
  <MaxAssignments>1</MaxAssignments>
  <Reward>
    <Amount>5.00</Amount>
    <CurrencyCode>USD</CurrencyCode>
    <FormattedPrice>$5.00</FormattedPrice>
  </Reward>
  <AutoApprovalDelayInSeconds>2592000</AutoApprovalDelayInSeconds>
  <Expiration>2009-04-29T00:17:32Z</Expiration>
  <AssignmentDurationInSeconds>30</AssignmentDurationInSeconds>
  <NumberOfAssignmentsPending>0</NumberOfAssignmentsPending>
  <NumberOfAssignmentsAvailable>0</NumberOfAssignmentsAvailable>
  <NumberOfAssignmentsCompleted>1</NumberOfAssignmentsCompleted>
</HIT>

<HIT>
  <HITId>ZZRZPTY4ERDZWJ868JCZ</HITId>
  <HITTypeId>NYVZTQ1QVKJZXCYZCZVZ</HITTypeId>
  <CreationTime>2009-07-07T00:56:40Z</CreationTime>
  <Title>Location</Title>
  <Description>Select the image that best represents</Description>
  <HITStatus>Assignable</HITStatus>
  <MaxAssignments>1</MaxAssignments>
  <Reward>
    <Amount>5.00</Amount>
    <CurrencyCode>USD</CurrencyCode>
    <FormattedPrice>$5.00</FormattedPrice>
  </Reward>
  <AutoApprovalDelayInSeconds>2592000</AutoApprovalDelayInSeconds>
  <Expiration>2009-07-14T00:56:40Z</Expiration>
  <AssignmentDurationInSeconds>30</AssignmentDurationInSeconds>
  <NumberOfAssignmentsPending>0</NumberOfAssignmentsPending>
  <NumberOfAssignmentsAvailable>1</NumberOfAssignmentsAvailable>
  <NumberOfAssignmentsCompleted>0</NumberOfAssignmentsCompleted>
</HIT>

</SearchHITsResult>

Instance Attribute Summary

Attributes inherited from Response

#raw_xml, #xml

Instance Method Summary collapse

Methods inherited from Response

#[], #elements, #errors, #humanized_errors, #initialize, #method_missing, #raise_errors, #success?, #xpath

Methods included from XMLUtilities

#map_content, #normalize_nested_params, #xml_to_hash

Constructor Details

This class inherits a constructor from RTurk::Response

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RTurk::Response

Instance Method Details

#hitsObject



55
56
57
58
59
60
61
# File 'lib/rturk/parsers/responses/search_hits_response.rb', line 55

def hits
  @hits ||= begin
    @xml.xpath('//HIT').inject([]) do |arr, hit_xml|
      arr << HITParser.new(hit_xml); arr
    end
  end
end