1

私はレール上のGoogle方向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

しかし、それは a = 悪い URI を発生させます (URI ではありませんか?): http://maps.googleapis.com/maps/api/directions/json?origin= 'תל אביב'&destination='יתלשלים'&sensor=false

ブラウザに貼り付けると、OK が返されます。

4

0 に答える 0