Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails rails上的错误uri google目录api_Ruby On Rails_Uri_Google Directions Api - Fatal编程技术网

Ruby on rails rails上的错误uri google目录api

Ruby on rails rails上的错误uri google目录api,ruby-on-rails,uri,google-directions-api,Ruby On Rails,Uri,Google Directions Api,我正在尝试向rails上的google directions api发送请求,我尝试了一些事情,这就是我现在所拥有的- 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,

我正在尝试向rails上的google directions api发送请求,我尝试了一些事情,这就是我现在所拥有的-

 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
但它是一个坏的URI(不是URI?):“ת㪠בבבב”和destination=“יש㪡םם”和sensor=false

如果将其粘贴到浏览器上,则返回ok