Skip to content

Instantly share code, notes, and snippets.

@nickmeehan
Created June 23, 2014 19:00
Show Gist options
  • Save nickmeehan/dead20d0a0c60b3c9470 to your computer and use it in GitHub Desktop.
Save nickmeehan/dead20d0a0c60b3c9470 to your computer and use it in GitHub Desktop.
RainforstQA Challenge Application
require 'httparty'
require 'json'
def handle_follow_response(response)
new_id = response["follow"].match(/\d+/)
append_to_url = "id=#{new_id}"
puts response
get_new_json_response(append_to_url)
end
def get_new_json_response(append_to_url = "")
url = 'http://letsrevolutionizetesting.com/challenge.json?'
response = HTTParty.get(url + append_to_url)
if response["follow"]
handle_follow_response(response)
else
puts response
end
end
get_new_json_response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment