rename profile.journeyLeg to profile.trip 💥

This commit is contained in:
Jannis R 2018-06-29 15:14:26 +02:00 committed by Jannis Redmann
parent a187f8ee97
commit 4a454917dd
12 changed files with 19 additions and 10 deletions

View file

@ -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)`
- cabe5fa: option to parse & expose `station.lines`, default off
- c8ff217 rename `journeyLeg()` to `trip()`
- 8de4447 rename `profile.journeyLeg` to `profile.trip`
### bugfixes

View file

@ -36,7 +36,8 @@
## 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…

View file

@ -37,7 +37,7 @@ const insaProfile = {
products: products,
journeyLeg: false,
trip: false,
radar: false
}

View file

@ -140,7 +140,7 @@ We consider these improvements to be *optional*:
- **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.
- 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.
- **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.

View file

@ -413,7 +413,7 @@ const createClient = (profile, request = _request) => {
}
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
Object.defineProperty(client, 'profile', {value: profile})
return client

View file

@ -66,7 +66,7 @@ const defaultProfile = {
filters,
journeysNumF: true, // `journeys()` method: support for `numF` field?
journeyLeg: false,
trip: false,
radar: false
}

View file

@ -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

View file

@ -102,7 +102,7 @@ const dbProfile = {
formatStation,
journeyLeg: true // todo: #49
trip: true // todo: #49
}
module.exports = dbProfile

View file

@ -25,7 +25,7 @@ const insaProfile = {
products: products,
journeyLeg: true,
trip: true,
radar: true
}

View file

@ -103,7 +103,7 @@ const nahshProfile = {
parseJourney: createParseJourney,
parseMovement: createParseMovement,
journeyLeg: true,
trip: true,
radar: true // todo: see #34
}

View file

@ -71,7 +71,7 @@ const oebbProfile = {
parseLocation,
parseMovement: createParseMovement,
journeyLeg: true,
trip: true,
radar: true
}

View file

@ -142,7 +142,7 @@ const vbbProfile = {
formatStation,
journeysNumF: false,
journeyLeg: true,
trip: true,
radar: true
}