Skip to content

Instantly share code, notes, and snippets.

@vanpelt
Created March 24, 2009 22:37
Show Gist options
  • Save vanpelt/84406 to your computer and use it in GitHub Desktop.
Save vanpelt/84406 to your computer and use it in GitHub Desktop.
require 'httparty'
class CrowdFlower
include HTTParty
base_uri "https://crowdflower.com/jobs/"
def initialize(key = nil)
key ||= YOUR_KEY
self.class.default_params(:key => key)
end
def get(id, page = 1, limit = 10)
self.class.get("/#{id}.json", {:query => {:limit => limit, :page => page}})
end
end
(ARGV[0].to_i || 1).upto(ARGV[0].to_i + 100) do |page|
puts "\n#{page}"
CrowdFlower.new.get(369, page).each do |unit_id, data|
#Do something awesome here...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment