Skip to content

Instantly share code, notes, and snippets.

@potomak
Created April 28, 2014 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save potomak/11385148 to your computer and use it in GitHub Desktop.
Save potomak/11385148 to your computer and use it in GitHub Desktop.
Follow Rainforest
require 'net/http'
require 'json'
hash = { 'follow' => 'http://letsrevolutionizetesting.com/challenge?id=47526821' }
begin
uri = URI(hash['follow'])
req = Net::HTTP::Get.new(uri)
req['Accept'] = 'application/json'
res = Net::HTTP.start(uri.hostname, uri.port) { |http| http.request(req) }
hash = JSON.parse(res.body)
puts hash
rescue => e
puts "ERROR: #{e}"
end while hash.has_key?('follow')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment