Sha256: 53ccc939b19f64a21ad4bc75e23e61a965efdeab1aac8d599eb8b6ffe4a90baa

Contents?: true

Size: 911 Bytes

Versions: 6

Compression:

Stored size: 911 Bytes

Contents

# <GetReviewableHITsResult>
#   <Request>
#     <IsValid>True</IsValid>
#   </Request>
#   <NumResults>3</NumResults>
#   <TotalNumResults>3</TotalNumResults>
#   <PageNumber>1</PageNumber>
#   <HIT>
#     <HITId>GBHZVQX3EHXZ2AYDY2T0</HITId>
#   </HIT>
#   <HIT>
#     <HITId>GBHZVQX3EHXZ2AYDY2T1</HITId>
#   </HIT>
#   <HIT>
#     <HITId>GBHZVQX3EHXZ2AYDY2T2</HITId>
#   </HIT>
# </GetReviewableHITsResult>

module RTurk

  class GetReviewableHITsResponse < Response

    def hit_ids
      @xml.xpath('//HIT').inject([]) do |arr, hit_xml|
        arr << hit_xml.inner_text.strip; arr
      end
    end

    # todo: test
    def total_num_results
      @xml.xpath('//TotalNumResults').inner_text.to_i
    end

    # todo: test
    def num_results
      @xml.xpath('//NumResults').inner_text.to_i
    end

    # todo: test
    def page_number
      @xml.xpath('//PageNumber').inner_text.to_i
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rturk-2.12.1 lib/rturk/parsers/responses/get_reviewable_hits_response.rb
rturk-2.12.0 lib/rturk/parsers/responses/get_reviewable_hits_response.rb
rturk-2.11.3 lib/rturk/parsers/responses/get_reviewable_hits_response.rb
rturk-2.11.2 lib/rturk/parsers/responses/get_reviewable_hits_response.rb
rturk-2.11.1 lib/rturk/parsers/responses/get_reviewable_hits_response.rb
rturk-2.11.0 lib/rturk/parsers/responses/get_reviewable_hits_response.rb