mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
journey leg, departure, movement: journeyId -> tripId 💥
This commit is contained in:
parent
f5eceafdf3
commit
00ea10d9c8
6 changed files with 10 additions and 9 deletions
|
@ -18,6 +18,7 @@ This version is not fully backwords-compatible. Check out [the migration guide](
|
||||||
- 3e672ee `journeys()`/`journeyLeg()`: `stopover.station` → `stopover.stop` 💥
|
- 3e672ee `journeys()`/`journeyLeg()`: `stopover.station` → `stopover.stop` 💥
|
||||||
- 021ae45: `journeys()`/`journeyLeg()`: leg stopovers: parse & expose platforms
|
- 021ae45: `journeys()`/`journeyLeg()`: leg stopovers: parse & expose platforms
|
||||||
- 85e0bdf `journeys()`: `startWithWalking` option with default `true` ✨
|
- 85e0bdf `journeys()`: `startWithWalking` option with default `true` ✨
|
||||||
|
- 2e6aefe journey leg, departure, movement: `journeyId` -> `tripId` 💥
|
||||||
|
|
||||||
## `2.7.0`
|
## `2.7.0`
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ With `opt`, you can override the default options, which look like this:
|
||||||
|
|
||||||
*Note:* As stated in the [*Friendly Public Transport Format* `1.0.1`](https://github.com/public-transport/friendly-public-transport-format/tree/1.0.1), the `when` field includes the current delay. The `delay` field, if present, expresses how much the former differs from the schedule.
|
*Note:* As stated in the [*Friendly Public Transport Format* `1.0.1`](https://github.com/public-transport/friendly-public-transport-format/tree/1.0.1), the `when` field includes the current delay. The `delay` field, if present, expresses how much the former differs from the schedule.
|
||||||
|
|
||||||
You may pass the `journeyId` field into [`journeyLeg(ref, lineName, [opt])`](journey-leg.md) to get details on the vehicle's journey.
|
You may pass the `tripId` field into [`journeyLeg(ref, lineName, [opt])`](journey-leg.md) to get details on the vehicle's journey.
|
||||||
|
|
||||||
As an example, we're going to use the [VBB profile](../p/vbb):
|
As an example, we're going to use the [VBB profile](../p/vbb):
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ The response may look like this:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
[ {
|
[ {
|
||||||
journeyId: '1|31431|28|86|17122017',
|
tripId: '1|31431|28|86|17122017',
|
||||||
trip: 31431,
|
trip: 31431,
|
||||||
station: {
|
station: {
|
||||||
type: 'station',
|
type: 'station',
|
||||||
|
@ -98,7 +98,7 @@ The response may look like this:
|
||||||
},
|
},
|
||||||
direction: 'S Spandau'
|
direction: 'S Spandau'
|
||||||
}, {
|
}, {
|
||||||
journeyId: '1|30977|8|86|17122017',
|
tripId: '1|30977|8|86|17122017',
|
||||||
trip: 30977,
|
trip: 30977,
|
||||||
station: { /* … */ },
|
station: { /* … */ },
|
||||||
when: null,
|
when: null,
|
||||||
|
@ -121,7 +121,7 @@ The response may look like this:
|
||||||
},
|
},
|
||||||
direction: 'S Westkreuz'
|
direction: 'S Westkreuz'
|
||||||
}, {
|
}, {
|
||||||
journeyId: '1|28671|4|86|17122017',
|
tripId: '1|28671|4|86|17122017',
|
||||||
trip: 28671,
|
trip: 28671,
|
||||||
station: {
|
station: {
|
||||||
type: 'station',
|
type: 'station',
|
||||||
|
|
|
@ -14,7 +14,7 @@ const createParseDeparture = (profile, opt, data) => {
|
||||||
const parseDeparture = (d) => {
|
const parseDeparture = (d) => {
|
||||||
const when = profile.parseDateTime(profile, d.date, d.stbStop.dTimeR || d.stbStop.dTimeS)
|
const when = profile.parseDateTime(profile, d.date, d.stbStop.dTimeR || d.stbStop.dTimeS)
|
||||||
const res = {
|
const res = {
|
||||||
journeyId: d.jid,
|
tripId: d.jid,
|
||||||
station: locations[parseInt(d.stbStop.locX)] || null,
|
station: locations[parseInt(d.stbStop.locX)] || null,
|
||||||
when: when.toISO(),
|
when: when.toISO(),
|
||||||
direction: profile.parseStationName(d.dirTxt),
|
direction: profile.parseStationName(d.dirTxt),
|
||||||
|
|
|
@ -151,7 +151,7 @@ const parseHint = (profile, h) => {
|
||||||
type: 'status',
|
type: 'status',
|
||||||
code: 'alternative-trip',
|
code: 'alternative-trip',
|
||||||
text,
|
text,
|
||||||
journeyId: h.jid
|
tripId: h.jid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (h.type === 'A') {
|
if (h.type === 'A') {
|
||||||
|
|
|
@ -14,7 +14,7 @@ const createParseMovement = (profile, opt, data) => {
|
||||||
|
|
||||||
const res = {
|
const res = {
|
||||||
direction: profile.parseStationName(m.dirTxt),
|
direction: profile.parseStationName(m.dirTxt),
|
||||||
journeyId: m.jid || null,
|
tripId: m.jid || null,
|
||||||
trip: m.jid && +m.jid.split('|')[1] || null, // todo: this seems brittle
|
trip: m.jid && +m.jid.split('|')[1] || null, // todo: this seems brittle
|
||||||
line: lines[m.prodX] || null,
|
line: lines[m.prodX] || null,
|
||||||
location: m.pos ? {
|
location: m.pos ? {
|
||||||
|
|
|
@ -231,8 +231,8 @@ const createValidateDeparture = (cfg) => {
|
||||||
a.ok(isObj(dep), name + ' must be an object')
|
a.ok(isObj(dep), name + ' must be an object')
|
||||||
// todo: let hafas-client add a .type field
|
// todo: let hafas-client add a .type field
|
||||||
|
|
||||||
a.strictEqual(typeof dep.journeyId, 'string', name + '.journeyId must be a string')
|
a.strictEqual(typeof dep.tripId, 'string', name + '.tripId must be a string')
|
||||||
a.ok(dep.journeyId, name + '.journeyId must not be empty')
|
a.ok(dep.tripId, name + '.tripId must not be empty')
|
||||||
a.strictEqual(typeof dep.trip, 'number', name + '.trip must be a number')
|
a.strictEqual(typeof dep.trip, 'number', name + '.trip must be a number')
|
||||||
|
|
||||||
val.station(val, dep.station, name + '.station')
|
val.station(val, dep.station, name + '.station')
|
||||||
|
|
Loading…
Add table
Reference in a new issue