Skip to content

Commit

Permalink
updated to get DisruptionLists working
Browse files Browse the repository at this point in the history
  • Loading branch information
magnatronus committed May 6, 2020
1 parent 9f1dc38 commit 5a80a90
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# ldbs-json changelog

## 1.2.1 (May 2020)
Minor updated - added CRSList to filterList processing to handle getting disruptionLists

## 1.2.0 (May 2020)
Replaced request with node-fetch and added some basic error trapping. Examples updated

Expand Down
21 changes: 21 additions & 0 deletions examples/getDisruptionList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Simple example code for running the staff version to access the DisruptionList
* NB: You will need a valid Token to access the SV version of the api
*/
const settings = require('../settings.json');
const LiveDepartureBoardService = require('../index');

// Set up the options for the call (Not the CRS list should be CRSList NOT crsList as in OpenLDBSVWS docs)
const options ={
CRSList: ["KGX", "LET"]
};

// create a staff version of the API
const api = new LiveDepartureBoardService(settings.tokens.staff, true);

// make sure we set userRef to true
api.call("GetDisruptionList", options, false)
.then(list => {
console.log(list);
})
.catch(error => console.error(error));
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ldbs-json",
"version": "1.2.0",
"version": "1.2.1",
"engines": {
"node": ">=7.6"
},
Expand Down
2 changes: 1 addition & 1 deletion soap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class DepartureBoardSoap {
let body = ``;
Object.keys(options).forEach(function(key){
let val="";
if(key == "filterList"){
if(key == "filterList" || key == "CRSList"){
options[key].forEach((crs) => {
val += `<ldb:crs>${crs}</ldb:crs>`;
});
Expand Down

0 comments on commit 5a80a90

Please sign in to comment.