mdp/rturk — Issue #19: Allow more than 100 hits to be traversed
Author: jeremylightsmith
Created: 2012-03-01 03:33:28+00:00
State: open

No time to do this right and fork this, but here's a monkey patch that hopefully will make it's way into main.

module RTurk
class Hit
def self.each(page_number = 1, &block)
result = RTurk::SearchHITs.create(page_number:page_number, page_size:100)
total_num_results = result.xpath("//TotalNumResults").text.to_i

result.hits.map do |hit|
yield new(hit.id, hit)
end
each(page_number + 1, &block) if total_num_results > page_number * 100
end
end
end