1

I am trying to send request to google directions api on rails and I tried a few things, this is what i have now -

 url = URI.parse(requested_url)
 full_path = (url.query.blank?) ? url.path : "#{url.path}?#{url.query}"
 the_request = Net::HTTP::Get.new(full_path)
 the_response = Net::HTTP.start(url.host, url.port) { |http| http.request(the_request) }
 raise "Response was not 200, response was #{the_response.code}" if the_response.code !=   "200"
 return the_response.body

but it raize a = bad URI(is not URI?): http://maps.googleapis.com/maps/api/directions/json?origin='תל אביב'&destination='ירושלים'&sensor=false

If you will paste it on you browser it returns ok.

user1666543
  • 665
  • 1
  • 10
  • 19

0 Answers0