Documentation ¶
Index ¶
- func NewHEREPlannerHP(client httpGetter, geocodeEndpoint string, routeEndpoint string, appID string, ...) herePlanner
- type DTODPlannerMileage
- type Error
- func NewAddressLookupError(statusCode int, a *models.Address) Error
- func NewGeocodeResponseDecodingError(r GeocodeResponseBody) Error
- func NewRoutingResponseDecodingError(r RoutingResponseBody) Error
- func NewShortHaulError(source LatLong, dest LatLong, moveDistance int) Error
- func NewUnknownAddressLookupError(statusCode int, a *models.Address) Error
- func NewUnknownRoutingError(statusCode int, source LatLong, dest LatLong) Error
- func NewUnroutableRouteError(statusCode int, source LatLong, dest LatLong) Error
- type ErrorCode
- type GeocodeResponse
- type GeocodeResponseBody
- type HerePosition
- type HereRoute
- type HereRouteSummary
- type HereSearchLocation
- type HereSearchResultType
- type HereSearchResultsViewType
- type LatLong
- type Planner
- func InitDTODRoutePlanner(appCtx appcontext.AppContext, v *viper.Viper, tlsConfig *tls.Config) (Planner, error)
- func InitHHGRoutePlanner(appCtx appcontext.AppContext, v *viper.Viper, tlsConfig *tls.Config) (Planner, error)
- func InitRoutePlanner(v *viper.Viper) Planner
- func NewDTODPlanner(dtodPlannerMileage DTODPlannerMileage) Planner
- func NewHEREPlanner(client httpGetter, geocodeEndpoint string, routeEndpoint string, appID string, ...) Planner
- func NewHHGPlanner(dtodPlannerMileage DTODPlannerMileage) Planner
- type RoutingResponse
- type RoutingResponseBody
- type SoapCaller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DTODPlannerMileage ¶
type DTODPlannerMileage interface {
DTODZip5Distance(appCtx appcontext.AppContext, pickup string, destination string) (int, error)
}
DTODPlannerMileage is the interface for connecting to DTOD SOAP service and requesting distance mileage NOTE: Placing this in a separate package/directory to avoid a circular dependency from an existing mock.
func NewDTODZip5Distance ¶
func NewDTODZip5Distance(username string, password string, soapClient SoapCaller) DTODPlannerMileage
NewDTODZip5Distance returns a new DTOD Planner Mileage interface
func NewMockDTODZip5Distance ¶
func NewMockDTODZip5Distance() DTODPlannerMileage
NewMockDTODZip5Distance is a mock (but deterministic) implementation of a DTOD call to calculate mileage
type Error ¶
Error is used for handling errors from the Route package
func NewAddressLookupError ¶
NewAddressLookupError returns a known error for failed address lookups
func NewGeocodeResponseDecodingError ¶
func NewGeocodeResponseDecodingError(r GeocodeResponseBody) Error
NewGeocodeResponseDecodingError creates a new geocodeResponseDecodingError error.
func NewRoutingResponseDecodingError ¶
func NewRoutingResponseDecodingError(r RoutingResponseBody) Error
NewRoutingResponseDecodingError creates a new routingResponseDecodingError error.
func NewShortHaulError ¶
NewShortHaulError is the new short haul error
func NewUnknownAddressLookupError ¶
NewUnknownAddressLookupError returns an unknown error for failed address lookups
func NewUnknownRoutingError ¶
NewUnknownRoutingError returns an error for failed postal code lookups
type ErrorCode ¶
type ErrorCode string
ErrorCode contains error codes for the route package
const ( // UnroutableRoute happens when a valid route can't be calculated between two locations UnroutableRoute ErrorCode = "UNROUTABLE_ROUTE" // AddressLookupError happens when doing a LatLong lookup of an address AddressLookupError ErrorCode = "ADDRESS_LOOKUP_ERROR" // GeocodeResponseDecodingError happens when attempting to decode a geocode response GeocodeResponseDecodingError ErrorCode = "GEOCODE_RESPONSE_DECODE_ERROR" // RoutingResponseDecodingError happens when attempting to decode a routing response RoutingResponseDecodingError ErrorCode = "ROUTING_RESPONSE_DECODE_ERROR" // ShortHaulError - no moves under 50 miles ShortHaulError ErrorCode = "SHORT_HAUL_ERROR" // UnknownError is for when the cause of the error can't be ascertained UnknownError ErrorCode = "UNKNOWN_ERROR" )
type GeocodeResponse ¶
type GeocodeResponse struct {
View []HereSearchResultsViewType `json:"View"`
}
GeocodeResponse is the json structure returned as "Response" in HERE geocode request
type GeocodeResponseBody ¶
type GeocodeResponseBody struct {
Response GeocodeResponse `json:"Response"`
}
GeocodeResponseBody is the json structure returned from HERE geocode request
type HerePosition ¶
HerePosition is a lat long position in the json response from HERE
type HereRoute ¶
type HereRoute struct {
Summary HereRouteSummary `json:"summary"`
}
HereRoute is one of the Route responses from the HERE routing API
type HereRouteSummary ¶
type HereRouteSummary struct {
Distance int `json:"distance"` // Distance in meters
}
HereRouteSummary is the json object containing the summary of the route a HERE routing API response
type HereSearchLocation ¶
type HereSearchLocation struct {
}HereSearchLocation is part of the json response from the geocoder
type HereSearchResultType ¶
type HereSearchResultType struct {
Location HereSearchLocation `json:"Location"`
}
HereSearchResultType is part of the json response from the geo
type HereSearchResultsViewType ¶
type HereSearchResultsViewType struct {
Result []HereSearchResultType `json:"Result"`
}
HereSearchResultsViewType is part of the json response from the geocoder
type LatLong ¶
LatLong is used to hold latitude and longitude as floats
func Zip5ToLatLong ¶
Zip5ToLatLong looks up a zip code and returns the Lat Long from the census data
func Zip5ToZip3LatLong ¶
Zip5ToZip3LatLong looks up a zip code and returns the Lat Long from the census data
type Planner ¶
type Planner interface { TransitDistance(appCtx appcontext.AppContext, source *models.Address, destination *models.Address) (int, error) LatLongTransitDistance(appCtx appcontext.AppContext, source LatLong, destination LatLong) (int, error) // Zip5TransitDistanceLineHaul is used by PPM flow and checks for minimum distance restriction as PPM doesn't allow short hauls // New code should probably make the minimum checks after calling Zip5TransitDistance over using this method Zip5TransitDistanceLineHaul(appCtx appcontext.AppContext, source string, destination string) (int, error) ZipTransitDistance(appCtx appcontext.AppContext, source string, destination string) (int, error) Zip3TransitDistance(appCtx appcontext.AppContext, source string, destination string) (int, error) Zip5TransitDistance(appCtx appcontext.AppContext, source string, destination string) (int, error) }
Planner is the interface needed by Handlers to be able to evaluate the distance to be used for move accounting
func InitDTODRoutePlanner ¶
func InitDTODRoutePlanner(appCtx appcontext.AppContext, v *viper.Viper, tlsConfig *tls.Config) (Planner, error)
InitDTODRoutePlanner creates a new DTOD route planner that adheres to the Planner interface
func InitHHGRoutePlanner ¶
func InitHHGRoutePlanner(appCtx appcontext.AppContext, v *viper.Viper, tlsConfig *tls.Config) (Planner, error)
InitHHGRoutePlanner creates a new HHG route planner that adheres to the Planner interface
func InitRoutePlanner ¶
InitRoutePlanner creates a new HERE route planner that adheres to the Planner interface
func NewDTODPlanner ¶
func NewDTODPlanner(dtodPlannerMileage DTODPlannerMileage) Planner
NewDTODPlanner constructs and returns a Planner for GHC routing.
func NewHEREPlanner ¶
func NewHEREPlanner(client httpGetter, geocodeEndpoint string, routeEndpoint string, appID string, appCode string) Planner
NewHEREPlanner constructs and returns a Planner which uses the HERE Map API to plan routes.
func NewHHGPlanner ¶
func NewHHGPlanner(dtodPlannerMileage DTODPlannerMileage) Planner
NewHHGPlanner constructs and returns a Planner for GHC routing.
type RoutingResponse ¶
type RoutingResponse struct {
Routes []HereRoute `json:"route"`
}
RoutingResponse is the top level object in the response from the HERE routing API
type RoutingResponseBody ¶
type RoutingResponseBody struct {
Response RoutingResponse `json:"response"`
}
RoutingResponseBody is the json structure returned from HERE routing request
type SoapCaller ¶
SoapCaller provides an interface for the Call method of the gosoap Client so it can be mocked. NOTE: Placing this in a separate package/directory to avoid a circular dependency from an existing mock.