def snap_to_roads(path, interpolate: false)
      path = GoogleMapsService::Convert.waypoints(path)

      params = {
        path: path
      }

      params[:interpolate] = 'true' if interpolate

      return get('/v1/snapToRoads', params,
                 base_url: ROADS_BASE_URL,
                 accepts_client_id: false,
                 custom_response_decoder: method(:extract_roads_body))[:snappedPoints]
    end
def snap_to_roads(path, interpolate: false)
      path = GoogleMapsService::Convert.waypoints(path)

      params = {
        path: path
      }

      params[:interpolate] = 'true' if interpolate

      return get('/v1/snapToRoads', params,
                 base_url: ROADS_BASE_URL,
                 accepts_client_id: false,
                 custom_response_decoder: method(:extract_roads_body))[:snappedPoints]
    end
Snaps a path to the most likely roads travelled.

 Takes up to 100 GPS points collected along a route, and returns a similar
 set of data with the points snapped to the most likely roads the vehicle
 was traveling along.

 @example Single point snap
   results = client.snap_to_roads([40.714728, -73.998672])

 @example Multi points snap
   path = [
       [-33.8671, 151.20714],
       [-33.86708, 151.20683000000002],
       [-33.867070000000005, 151.20674000000002],
       [-33.86703, 151.20625]
   ]
   results = client.snap_to_roads(path, interpolate: true)

 @param [Array] path The path to be snapped. Array of latitude/longitude pairs.
 @param [Boolean] interpolate Whether to interpolate a path to include all points
         forming the full road-geometry. When true, additional interpolated
         points will also be returned, resulting in a path that smoothly
         follows the geometry of the road, even around corners and through
         tunnels.  Interpolated paths may contain more points than the
         original path.

 @return [Array] Array of snapped points.