Skip to content

Instantly share code, notes, and snippets.

@markburns
Created December 2, 2013 20:27
Show Gist options
  • Select an option

  • Save markburns/7758173 to your computer and use it in GitHub Desktop.

Select an option

Save markburns/7758173 to your computer and use it in GitHub Desktop.
require 'faraday'
require 'faraday_middleware'
require 'byebug'
def connection
@connection ||=
Faraday::Connection.new 'http://www.letsrevolutionizetesting.com/' do |c|
c.request :json
c.response :json, :content_type => /\bjson$/
c.adapter Faraday.default_adapter
end
end
def follow url
response = connection.get url
puts response.body
uri = URI.parse(response.body['follow'])
"#{uri.path}.json?#{uri.query}"
rescue Exception => e
puts e
byebug
end
next_url = "challenge.json"
while true do
next_url = follow(next_url)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment