Documentation ¶
Overview ¶
Package routific exposes a wrapper for making calls to Routific's Engine API
Index ¶
Examples ¶
Constants ¶
const VehicleRoutingAPIUrl = "https://api.routific.com/v1/vrp"
VehicleRoutingAPIUrl is a constant that holds the url for vehicle routing problem solver
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CurrentRoute ¶
type CurrentRoute Position
CurrentRoute represents the current location as lat+lng for a given driver
type DestinationRoute ¶
type DestinationRoute Position
DestinationRoute represents a destination route as lat+lng
type LocationResponse ¶
type LocationResponse struct { LocationID string `bson:"location_id" json:"location_id"` LocationName string `bson:"location_name" json:"location_name"` }
LocationResponse struct holds each location in a given solution for a driver to go through
type MockHTTPClient ¶
MockHTTPClient is an autogenerated mock type for the HTTPClient type
type MockService ¶
MockService is an autogenerated mock type for the Service type
func (*MockService) GetVehicleRoute ¶
func (_m *MockService) GetVehicleRoute(driverID bson.ObjectId, currentRoute CurrentRoute, destinationRoute DestinationRoute) (VehicleRoutingResponse, error)
GetVehicleRoute provides a mock function with given fields: driverID, currentRoute, destinationRoute
type OrderRequest ¶
type OrderRequest struct {
Location Position `json:"location"`
}
OrderRequest represents the order for a given vehicle routing reequest
type Routific ¶
type Routific struct {
Client HTTPClient
}
Routific struct will hold http client and implement API interface
func NewService ¶
func NewService(client HTTPClient) *Routific
NewService will return a new value of type interface Service
Example ¶
service := NewService(Client) fmt.Printf("%T", service)
Output: *routific.Routific
func (*Routific) GetVehicleRoute ¶
func (r *Routific) GetVehicleRoute(driverID bson.ObjectId, currentRoute CurrentRoute, destinationRoute DestinationRoute) (VehicleRoutingResponse, error)
GetVehicleRoute will make a call to Routific's Engine API Vehicle routing endpoint and try to get a valid solution back
type Service ¶
type Service interface {
GetVehicleRoute(driverID bson.ObjectId, currentRoute CurrentRoute, destinationRoute DestinationRoute) (VehicleRoutingResponse, error)
}
Service interface has all the methods needed for communicating to Routific's Engine API
type VehicleRequest ¶
type VehicleRequest struct {
StartLocation Position `json:"start_location"`
}
VehicleRequest represents the vehicle for a given vehicle routing reequest
type VehicleRoutingRequest ¶
type VehicleRoutingRequest struct { Visits map[string]OrderRequest `json:"visits"` Fleet map[string]VehicleRequest `json:"fleet"` }
VehicleRoutingRequest struct holds values for a vehicle routing request
type VehicleRoutingResponse ¶
type VehicleRoutingResponse struct { Status string `json:"status"` TotalTravelTime float64 `bson:"total_travel_time" json:"total_travel_time"` Solution map[string][]LocationResponse `json:"solution"` }
VehicleRoutingResponse holds a valid response from Vehicle routing Routific Engine API