diff --git a/index.js b/index.js index 31acdd57..a6c9e636 100644 --- a/index.js +++ b/index.js @@ -12,7 +12,7 @@ const defaults = { onLocation: parse.location, onProduct: parse.product, onRemark: parse.remark, - onAgency: parse.agency + onOperator: parse.operator } @@ -26,7 +26,8 @@ const request = (opt) => { json: true, body: JSON.stringify(body), headers: { 'Content-Type': 'application/json', - 'Accept-Encoding': 'gzip, deflate' + 'Accept-Encoding': 'gzip, deflate', + 'user-agent': 'https://github.com/derhuerst/hafas-client' } }) @@ -43,7 +44,7 @@ const request = (opt) => { if (Array.isArray(c.locL)) d.locations = c.locL.map(opt.onLocation) if (Array.isArray(c.prodL)) d.products = c.prodL.map(opt.onProduct) if (Array.isArray(c.remL)) d.remarks = c.remL.map(opt.onRemark) - if (Array.isArray(c.opL)) d.agencies = c.opL.map(opt.onAgency) + if (Array.isArray(c.opL)) d.operators = c.opL.map(opt.onOperator) return d }).catch((err) => {throw err}) } diff --git a/parse.js b/parse.js index cc1f40b7..d32b606f 100644 --- a/parse.js +++ b/parse.js @@ -127,10 +127,10 @@ const route = (tz, s, p, r) => (c) => { const parts = c.secL.map(part(tz, s, p, r, c)) return { parts - , from: parts[0].from - , start: parts[0].start - , to: parts[parts.length - 1].to - , end: parts[parts.length - 1].end + , origin: parts[0].origin + , destination: parts[0].destination + , departure: parts[parts.length - 1].departure + , arrival: parts[parts.length - 1].arrival } }