Module: DistanceMatrixHelper

Included in:
CitiBikeDirections
Defined in:
lib/citi_bike_directions/distance_matrix_helper.rb

Instance Method Summary collapse

Instance Method Details

#build_dmatrix_params(dests, coords) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/citi_bike_directions/distance_matrix_helper.rb', line 12

def build_dmatrix_params(dests, coords)    
  dest_str = dests.map { |lat, long, id| "#{lat},#{long}" }.join("|")
  p dest_str #debug
  orig_str = coords.join(",")
  { destinations: dest_str, 
    origins:      orig_str, 
    sensor:       false,
    mode:         "walking" }    
end

#build_dmatrix_url(qv_hash) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/citi_bike_directions/distance_matrix_helper.rb', line 3

def build_dmatrix_url(qv_hash)
  Addressable::URI.new(
  scheme: "http",
  host: "www.google.com",
  path: "maps/api/distancematrix/json",
  query_values: qv_hash
  ).to_s
end