define('application/models/halo/authentication/oauth', [
'rofl/models/api/abstract',
'rofl/lib/utils',
'antie/runtimecontext'
], function (
Abstract,
Utils,
RuntimeContext
) {
'use strict';
var application = RuntimeContext.getCurrentApplication(),
appConfig = application.getConfiguration(),
endpoint = appConfig.api.halo.endpoint.oauth.url,
SERVICES = {
GET_TOKEN: '/token/#app'
};
return Abstract.extend({
/**
* Resolves the endpoint.
*
* @param {Object} params - The endpoint params.
* @returns {string} - The endpoint.
*/
resolveEndpoint: function (params) {
var service = params.service,
resultEndpoint = endpoint,
resultService = SERVICES[service];
switch (resultService) {
case SERVICES.GET_TOKEN:
resultEndpoint += resultService;
break;
// No default
}
return Utils.formatTemplate(resultEndpoint, params);
}
});
});