diff --git a/index.js b/index.js index 3636b560a37bbd64627ddd901e2fc05aba040841..e443c6aebd355875b41a395358c2bb6896b6b5c9 100644 --- a/index.js +++ b/index.js @@ -145,15 +145,15 @@ const endDate = moment().format('MM/DD/YYYY') const timeRange = ['day', 'month', 'year'] const rangeDate = { day: { - doctype: 'io.egl.day', + doctype: 'com.grandlyon.egl.day', keys: ['year', 'month', 'day'] }, month: { - doctype: 'io.egl.month', + doctype: 'com.grandlyon.egl.month', keys: ['year', 'month'] }, year: { - doctype: 'io.egl.year', + doctype: 'com.grandlyon.egl.year', keys: ['year'] } } @@ -228,15 +228,11 @@ async function authenticate(login, password, baseUrl, apiAuthKey) { }, json: true } - try { - const response = await rp(authRequest) - if (response.codeRetour === 100) { - return response - } else { - throw new Error(errors.LOGIN_FAILED) - } - } catch (error) { - throw error + const response = await rp(authRequest) + if (response.codeRetour === 100) { + return response + } else { + throw new Error(errors.LOGIN_FAILED) } } @@ -259,10 +255,10 @@ async function getData(response, baseUrl, apiAuthKey) { json: true } try { - const response = await rp(dataRequest) - switch (response.codeRetour) { + const responseEgl = await rp(dataRequest) + switch (responseEgl.codeRetour) { case 100: - return format(response) + return format(responseEgl) case -2: throw new Error(errors.LOGIN_FAILED) case -1: @@ -355,7 +351,7 @@ async function storeData(data, doctype, keys) { /** * Function handling special case. * The temporary aggregated data need to be remove in order for the most recent one te be saved. - * ex for io.egl.month : + * ex for com.grandlyon.egl.month : * { load: 76.712, month: 2020, ... } need to be replace by * { load: 82.212, month: 2020, ... } after grdf data reprocess */ diff --git a/manifest.konnector b/manifest.konnector index ec075f4c5b47b6d5ee95259508cd746914285124..2d0e30a2499512aeca23e13b71d322c06b86a150 100644 --- a/manifest.konnector +++ b/manifest.konnector @@ -56,4 +56,3 @@ }, "manifest_version": "2" } -