Created
June 23, 2014 19:00
-
-
Save nickmeehan/dead20d0a0c60b3c9470 to your computer and use it in GitHub Desktop.
RainforstQA Challenge Application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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