Skip to content

Instantly share code, notes, and snippets.

@checco
Created October 13, 2016 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save checco/097c7c80d12018c19dce6c95fe007e57 to your computer and use it in GitHub Desktop.
Save checco/097c7c80d12018c19dce6c95fe007e57 to your computer and use it in GitHub Desktop.
JSON API call test
require 'uri'
require 'net/http'
url = URI("http://www.hostelspoint.com/webservices/affiliates/json.php?IDSite=2336&requestType=AvailSearchCity&day=11&year_month=2016-11&nights=1&guests=1&currency=EUR&cat=&lang=en&order=&room_type=&city=190")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["cache-control"] = 'no-cache'
response = http.request(request)
puts response.read_body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment