3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/citi_bike_directions/gmaps_walking_directions.rb', line 3
def get_walking_directions_with_waypoints(coord1, waypoint1, waypoint2, coord2)
url = Addressable::URI.new(
scheme: "http",
host: "maps.googleapis.com",
path: "maps/api/directions/json",
query_values: {
origin: coord1,
destination: coord2,
sensor: false,
mode: "walking",
waypoints: "#{waypoint1}|#{waypoint2}"
}
).to_s
result = JSON.parse(RestClient.get(url))
result['routes'].first['legs']
end
|