Created
October 5, 2018 10:28
-
-
Save CyberRoute/064957bf10dddb2e4b380e1ec1d653af to your computer and use it in GitHub Desktop.
challenge_ruby
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'json' | |
require 'net/http' | |
result = nil | |
uri = URI('http://letsrevolutionizetesting.com/challenge.json') | |
while result == nil | |
res = Net::HTTP.get_response(uri) | |
challenge = JSON.parse(res.body) | |
if challenge.has_key?("follow") | |
uri = URI(challenge["follow"].sub("challenge?", "challenge.json?")) | |
puts uri | |
else | |
result = challenge | |
end | |
end | |
puts result["message"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment