Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | 2x 2x 2x 2x 2x 1x 2x 2x 2x 2x 6x 6x 4x 6x 2x 2x 2x 2x |
import Logger from "../../../Utils/LoggerByDefault";
import _ from "../../../Utils/MessagesResources";
import GeocodeParamREST from "./model/GeocodeParamREST";
/**
* @classdesc
* Classe de gestion des requêtes de type REST sur le service de calcul d'itineraire
* (uniquement en GET)
*
* @constructor
* @alias Gp.Services.Geocode.Request.GeocodeRequestREST
* @param {Object} options - options definies dans le composant Route
*
* @example
* var options = {
* (...)
* };
*
* @private
*/
function GeocodeRequestREST (options) {
this.logger = Logger.getLogger("GeocodeRequestREST");
this.logger.trace("[Constructeur GeocodeRequestREST ()]");
Iif (!(this instanceof GeocodeRequestREST)) {
throw new TypeError("GeocodeRequestREST constructor cannot be called as a function.");
}
// existance des options
Iif (!options) {
throw new Error(_.getMessage("PARAM_EMPTY", "options"));
}
/** liste des options */
this.settings = options;
}
GeocodeRequestREST.prototype = {
/**
* @lends module:GeocodeRequestREST#
*/
/**
* request
* @type {String}
*/
requestString : null,
/**
* Constructeur (alias)
*/
constructor : GeocodeRequestREST,
/**
* Construction de la requête.
*
* @returns {String} request
*/
processRequestString : function () {
var request = "";
// Mapping des options avec le service de l'API REST
const oParams = new GeocodeParamREST(this.settings);
const params = oParams.getParams();
for (var i = 0; i < params.length; i++) {
var o = params[i];
if (request) {
request += "&";
}
request += o.k + "=" + o.v;
}
Iif (!this.settings.geocodeMethod || (this.settings.geocodeMethod !== "search" && this.settings.geocodeMethod !== "reverse")) {
throw new Error("Error geocodeMethod not valid");
}
this.requestString = "?" + request;
this.logger.trace(this.requestString);
return this.requestString;
}
};
export default GeocodeRequestREST;
|