route4me-node
Version:
Access Route4Me's logistics-as-a-service API using our Node.js SDK
55 lines (45 loc) • 1.82 kB
JavaScript
/**
* Vehicles facility
*
* @category Vehicles
*/
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Vehicles = function () {
/**
* Constructor
*
* @see {@link https://route4me.io/docs/#vehicles}
* @since 0.1.4
* @private
*
* @param {RequestManager} requestManager - Request Manager
* @return {Vehicles} - Vehicles facility
*/
function Vehicles(requestManager) {
_classCallCheck(this, Vehicles);
this.r = requestManager;
}
/**
* Get vehicles that belong to the Route4Me account
*
* @todo Fix error in API docs: there the method utilizes `POST`-http-method to get results
*
* @see {@link https://route4me.io/docs/#get-vehicles}
*
* @param {module:route4me-node~RequestCallback<jsonschema:Vehicles.ResponseMany>} [callback]
*/
_createClass(Vehicles, [{
key: "list",
value: function list(callback) {
return this.r._makeRequest({
method: "GET",
path: "/api.v4/vehicle.php",
validationContext: "Vehicles.ResponseMany"
}, callback);
}
}]);
return Vehicles;
}();
module.exports = Vehicles;
;