mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
rename profile.journeyLeg to profile.trip 💥
This commit is contained in:
parent
a187f8ee97
commit
4a454917dd
12 changed files with 19 additions and 10 deletions
|
@ -31,6 +31,7 @@ This version is not fully backwords-compatible. Check out [the migration guide](
|
||||||
- 8881d8a & b6fbaa5: change parsers signature to `parse…(profile, opt, data)`
|
- 8881d8a & b6fbaa5: change parsers signature to `parse…(profile, opt, data)`
|
||||||
- cabe5fa: option to parse & expose `station.lines`, default off
|
- cabe5fa: option to parse & expose `station.lines`, default off
|
||||||
- c8ff217 rename `journeyLeg()` to `trip()`
|
- c8ff217 rename `journeyLeg()` to `trip()`
|
||||||
|
- 8de4447 rename `profile.journeyLeg` to `profile.trip`
|
||||||
|
|
||||||
### bugfixes
|
### bugfixes
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,8 @@
|
||||||
|
|
||||||
## If you use `hafas-client` with a custom profile…
|
## If you use `hafas-client` with a custom profile…
|
||||||
|
|
||||||
…write your profile in [the new format](writing-a-profile.md). Then, you can pass it into `hafas-client` just like before. #32/b7c1ee3
|
- …write your profile in [the new format](writing-a-profile.md). Then, you can pass it into `hafas-client` just like before. #32/b7c1ee3
|
||||||
|
- …rename the `profile.journeyLeg` flag to `profile.trip`. 8de4447
|
||||||
|
|
||||||
## If you use `hafas-client` with custom parse functions…
|
## If you use `hafas-client` with custom parse functions…
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ const insaProfile = {
|
||||||
|
|
||||||
products: products,
|
products: products,
|
||||||
|
|
||||||
journeyLeg: false,
|
trip: false,
|
||||||
radar: false
|
radar: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ We consider these improvements to be *optional*:
|
||||||
|
|
||||||
- **Check if the endpoint supports the journey legs call.**
|
- **Check if the endpoint supports the journey legs call.**
|
||||||
- In the app, check if you can query details for the status of a single journey leg. It should load realtime delays and the current progress.
|
- In the app, check if you can query details for the status of a single journey leg. It should load realtime delays and the current progress.
|
||||||
- If this feature is supported, add `journeyLeg: true` to the profile.
|
- If this feature is supported, add `trip: true` to the profile.
|
||||||
- **Check if the endpoint supports the live map call.** Does the app have a "live map" showing all vehicles within an area? If so, add `radar: true` to the profile.
|
- **Check if the endpoint supports the live map call.** Does the app have a "live map" showing all vehicles within an area? If so, add `radar: true` to the profile.
|
||||||
- **Consider transforming station & line names** into the formats that's most suitable for *local users*. Some examples:
|
- **Consider transforming station & line names** into the formats that's most suitable for *local users*. Some examples:
|
||||||
- `M13 (Tram)` -> `M13`. With Berlin context, it is obvious that `M13` is a tram.
|
- `M13 (Tram)` -> `M13`. With Berlin context, it is obvious that `M13` is a tram.
|
||||||
|
|
2
index.js
2
index.js
|
@ -413,7 +413,7 @@ const createClient = (profile, request = _request) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const client = {departures, arrivals, journeys, locations, station, nearby}
|
const client = {departures, arrivals, journeys, locations, station, nearby}
|
||||||
if (profile.journeyLeg) client.trip = trip
|
if (profile.trip) client.trip = trip
|
||||||
if (profile.radar) client.radar = radar
|
if (profile.radar) client.radar = radar
|
||||||
Object.defineProperty(client, 'profile', {value: profile})
|
Object.defineProperty(client, 'profile', {value: profile})
|
||||||
return client
|
return client
|
||||||
|
|
|
@ -66,7 +66,7 @@ const defaultProfile = {
|
||||||
filters,
|
filters,
|
||||||
|
|
||||||
journeysNumF: true, // `journeys()` method: support for `numF` field?
|
journeysNumF: true, // `journeys()` method: support for `numF` field?
|
||||||
journeyLeg: false,
|
trip: false,
|
||||||
radar: false
|
radar: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,13 @@ const validateProfile = (profile) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('trip' in profile && 'boolean' !== typeof profile.trip) {
|
||||||
|
throw new Error('profile.trip must be a boolean.')
|
||||||
|
}
|
||||||
|
if ('journeyLeg' in profile) {
|
||||||
|
throw new Error('profile.journeyLeg has been removed. Use profile.trip.')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = validateProfile
|
module.exports = validateProfile
|
||||||
|
|
|
@ -102,7 +102,7 @@ const dbProfile = {
|
||||||
|
|
||||||
formatStation,
|
formatStation,
|
||||||
|
|
||||||
journeyLeg: true // todo: #49
|
trip: true // todo: #49
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = dbProfile
|
module.exports = dbProfile
|
||||||
|
|
|
@ -25,7 +25,7 @@ const insaProfile = {
|
||||||
|
|
||||||
products: products,
|
products: products,
|
||||||
|
|
||||||
journeyLeg: true,
|
trip: true,
|
||||||
radar: true
|
radar: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ const nahshProfile = {
|
||||||
parseJourney: createParseJourney,
|
parseJourney: createParseJourney,
|
||||||
parseMovement: createParseMovement,
|
parseMovement: createParseMovement,
|
||||||
|
|
||||||
journeyLeg: true,
|
trip: true,
|
||||||
radar: true // todo: see #34
|
radar: true // todo: see #34
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ const oebbProfile = {
|
||||||
parseLocation,
|
parseLocation,
|
||||||
parseMovement: createParseMovement,
|
parseMovement: createParseMovement,
|
||||||
|
|
||||||
journeyLeg: true,
|
trip: true,
|
||||||
radar: true
|
radar: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ const vbbProfile = {
|
||||||
formatStation,
|
formatStation,
|
||||||
|
|
||||||
journeysNumF: false,
|
journeysNumF: false,
|
||||||
journeyLeg: true,
|
trip: true,
|
||||||
radar: true
|
radar: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue