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) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/mapbox/directions.rb', line 5

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