diff --git a/README.md b/README.md index 4968aca..3b63b7b 100644 --- a/README.md +++ b/README.md @@ -120,25 +120,6 @@ ns.getArrivals( { [API documentation](https://apiportal.ns.nl/docs/services/reisinformatie-api/operations/getArrivals) -### getCalamities -**( [object] ) : array** - -List of all current calamities - -| parameter | type | description | -|:-----------|:---------------|:--------------| -| [lang] | string | Text language | - -```js -ns.getArrivals( { lang: 'en' } ) - .then( console.log ) - .catch( console.error ) -; -``` - -[API documentation](https://apiportal.ns.nl/docs/services/reisinformatie-api/operations/getCalamities) - - ### getDepartures **( object ) : array** diff --git a/nsapi.js b/nsapi.js index 7ce9420..f0d2f4d 100644 --- a/nsapi.js +++ b/nsapi.js @@ -135,19 +135,15 @@ module.exports = class NSAPI { /** - * Get calamities + * Get calamities - DEPRECATED * * @param {object} [parameters] Request parameters * @return {Promise} */ async getCalamities ( parameters = {} ) { - const data = await this._request( { - path: '/reisinformatie-api/api/v1/calamities', - parameters, - } ); - - return data.meldingen; + console.trace( 'DEPRECATED - getCalamities is deprecated by the API, use getDisruptions' ); + return this.getDisruptions( parameters ); } diff --git a/test.js b/test.js index dfc09ff..02ad5bd 100644 --- a/test.js +++ b/test.js @@ -189,26 +189,6 @@ dotest.add( 'Method .getArrivals - String dateTime', async test => { } ); -dotest.add( 'Method .getCalamities', async test => { - let data; - let error; - - try { - data = await ns.getCalamities(); - } - catch ( err ) { - error = err; - } - finally { - test( error ) - .isArray( 'fail', 'data', data ) - .isNotEmpty( 'warn', 'data', data ) - .done() - ; - } -} ); - - dotest.add( 'Method .getDepartures - Without dateTime', async test => { let data; let error; @@ -356,6 +336,26 @@ dotest.add( 'Method .getStationDisruption', async test => { } ); +dotest.add( 'Method .getCalamities (alias)', async test => { + let data; + let error; + + try { + data = await ns.getCalamities(); + } + catch ( err ) { + error = err; + } + finally { + test( error ) + .isArray( 'fail', 'data', data ) + .isNotEmpty( 'warn', 'data', data ) + .done() + ; + } +} ); + + dotest.add( 'Method .getTrips - Without dateTime', async test => { let data; let error;