Skip to content

Instantly share code, notes, and snippets.

@CyberRoute
Created October 5, 2018 10:28
Show Gist options
  • Save CyberRoute/064957bf10dddb2e4b380e1ec1d653af to your computer and use it in GitHub Desktop.
Save CyberRoute/064957bf10dddb2e4b380e1ec1d653af to your computer and use it in GitHub Desktop.
challenge_ruby
#!/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