Class: Orochi::GoogleClient

Inherits:
Object
  • Object
show all
Defined in:
lib/orochi.rb

Class Method Summary collapse

Class Method Details

.request(options = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/orochi.rb', line 19

def self.request(options = {})
  request_str = "http://maps.googleapis.com/maps/api/directions/json?"

  # TODO make settings for default request
  request_str += "sensor=false&"
  request_str += "alternatives=true&"
  
  options.each do |k, v|
    request_str += "&#{k}=#{CGI::escape(v)}"
  end

  response = open(request_str)
  return JSON.parse(response.read)
end