Class: Mapbox::Directions

Inherits:
Object
  • Object
show all
Includes:
APIOperations::Request
Defined in:
lib/mapbox/directions.rb

Class Method Summary collapse

Methods included from APIOperations::Request

included

Class Method Details

.directions(waypoints, profile = 'mapbox.driving') ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/mapbox/directions.rb', line 7

def self.directions(waypoints, profile='mapbox.driving')
  formatted_waypoints = waypoints.map { |point|
    "#{point['longitude']},#{point['latitude']}"
  }.join(';')
  return request(
    :get,
    "/v4/directions/#{profile}/#{formatted_waypoints}.json",
    nil)
end