Skip to content

Instantly share code, notes, and snippets.

@holgersindbaek
Created October 19, 2013 12:07
Show Gist options
  • Save holgersindbaek/7055188 to your computer and use it in GitHub Desktop.
Save holgersindbaek/7055188 to your computer and use it in GitHub Desktop.
Follow the Rabbit
require 'open-uri'
require 'json'
BASE_URL = "http://letsrevolutionizetesting.com/challenge.json"
@counter = 0
def follow_the_rabbit(url)
json = JSON.parse(open(url).read)
puts " "
if json["follow"]
id = json["follow"].split("challenge").last
new_url = BASE_URL+id
@counter += 1
puts "#{@counter} - #{new_url}"
follow_the_rabbit(new_url)
elsif json["message"]
puts "#{@counter} - #{json["message"]}"
end
end
follow_the_rabbit(BASE_URL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment