Class: Mapbox::Directions

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

Class Method Summary collapse

Methods included from HashUtils

xy_from_hash

Methods included from APIOperations::Request

included

Class Method Details

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



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

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