H.service.extension.customRoute.Service
Class Summary
Extends: H.service.AbstractRestService
This class encapsulates the Custom Route Extension API in a service stub, providing methods to access its resources. Refer to the REST service documentation for the description of service parameters and response objects.
[ For full details, see the Class Details ]
Method Summary
Methods |
---|
This method sends a route calculation request to the Custom Route Extension API and calls the |
This method receives configuration parameters from the platform, that can be used by the object implementing the interface. The method must not be invoked directly. |
Class Description
This class encapsulates the Custom Route Extension API in a service stub, providing methods to access its resources. Refer to the REST service documentation for the description of service parameters and response objects.
An instance of this class can be retrieved by calling the factory method on a platform instance. H.service.Platform#getCustomRoutingService.
Example
// Assumption: the platform is instantiated
customRoutingService = platform.getCustomRoutingService();
Constructor Details
H.service.extension.customRoute.Service(opt_options)
- Parameters:
-
opt_options
: -
{H.service.extension.customRoute.Service.Options=} [optional]
- An optional service parameters
Method Details
calculateRoute (calculateRouteParams, onResult, onError)
This method sends a route calculation request to the Custom Route Extension API and calls the onResult
callback function once the service response becomes available (providing a H.service.ServiceResult object) or the onError
callback if a communication error occurred.
Please refer to the API Documentation for information on available parameters and the response object structure.
- Parameters:
-
calculateRouteParams
: -
{H.service.ServiceParameters}
- An object containing the service parameters to be sent with the routing request.
-
onResult
: -
{function(H.service.ServiceResult)}
- The callback which is called when result is returned
-
onError
: -
{function(Error)}
- The callback which is called when error occurred (i.e request timeout, or server error)
- Throws:
-
{H.lang.InvalidArgumentError}
- If passed arguments are invalid
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) : {H.service.IConfigurable}
This method receives configuration parameters from the platform, that can be used by the object implementing the interface. The method must not be invoked directly.
Example
// assuming that the configurable object exists and the variable name is "configurable"
var platform = new H.service.Platform({
'app_id': [your app_id],
'app_code': [your app_code],
})
platform.configure(configurable);
- Parameters:
-
appId
: -
{string}
- The application ID to identify the client against the platform (mandatory)
-
appCode
: -
{string}
- The application code to identify the client against the platform (mandatory)
-
useHTTPS
: -
{boolean}
- The indicator whether secure communication is used (
true
), the default isfalse
-
useCIT
: -
{boolean}
- A value indicating whether Customer Integration Testing ("CIT") is used (
true
), the default isfalse
-
opt_baseUrl
: -
{H.service.Url=} [optional]
- The base URL of the platform, the default is
http://api.here.com
. Note that if theuseHTTPS
flag is set totrue
, the URL scheme specified in theopt_baseUrl
is overridden to useHTTPS
.
- Returns:
-
{H.service.IConfigurable}
- An instance of
IConfigurable
reflecting the new configuration