From 86fc27e34024544ab455f6203f769cd71005d296 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Fri, 29 Jun 2018 14:42:40 +0200 Subject: [PATCH] docs: journeyLeg() -> trip() :memo: --- docs/departures.md | 2 +- docs/journeys.md | 2 +- docs/radar.md | 2 +- docs/readme.md | 2 +- docs/{journey-leg.md => trip.md} | 16 +++++++++------- 5 files changed, 13 insertions(+), 11 deletions(-) rename docs/{journey-leg.md => trip.md} (81%) diff --git a/docs/departures.md b/docs/departures.md index 344958b4..9930b5ad 100644 --- a/docs/departures.md +++ b/docs/departures.md @@ -36,7 +36,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. -You may pass the `tripId` field into [`journeyLeg(ref, lineName, [opt])`](journey-leg.md) to get details on the vehicle's journey. +You may pass the `tripId` field into [`trip(id, lineName, [opt])`](trip.md) to get details on the vehicle's trip. As an example, we're going to use the [VBB profile](../p/vbb): diff --git a/docs/journeys.md b/docs/journeys.md index ebbf55ce..1e7868a2 100644 --- a/docs/journeys.md +++ b/docs/journeys.md @@ -272,4 +272,4 @@ departure of last journey 2017-12-17T19:07:00.000+01:00 departure of first (later) journey 2017-12-17T19:19:00.000+01:00 ``` -If you pass `polylines: true`, each journey leg will have a `polyline` field. Refer to [the section in the `journeyLeg()` docs](journey-leg.md#polyline-option) for details. +If you pass `polylines: true`, each journey leg will have a `polyline` field. Refer to [the section in the `trip()` docs](trip.md#polyline-option) for details. diff --git a/docs/radar.md b/docs/radar.md index e42155c0..d10077ac 100644 --- a/docs/radar.md +++ b/docs/radar.md @@ -163,4 +163,4 @@ The response may look like this: }, /* … */ ] ``` -If you pass `polylines: true`, each journey leg will have a `polyline` field, as documented in [the corresponding section in the `journeyLeg()` docs](journey-leg.md#polyline-option), with the exception that station info is missing. +If you pass `polylines: true`, each movement will have a `polyline` field, as documented in [the corresponding section in the `trip()` docs](trip.md#polyline-option), with the exception that station info is missing. diff --git a/docs/readme.md b/docs/readme.md index 61699d2d..f7d3a42b 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -1,7 +1,7 @@ # API documentation - [`journeys(from, to, [opt])`](journeys.md) – get journeys between locations -- [`journeyLeg(ref, lineName, [opt])`](journey-leg.md) – get details for a leg of a journey +- [`trip(id, lineName, [opt])`](trip.md) – get details for a trip - [`departures(station, [opt])`](departures.md) – query the next departures at a station - [`arrivals(station, [opt])`](arrivals.md) – query the next arrivals at a station - [`locations(query, [opt])`](locations.md) – find stations, POIs and addresses diff --git a/docs/journey-leg.md b/docs/trip.md similarity index 81% rename from docs/journey-leg.md rename to docs/trip.md index de7fddc8..3122dd81 100644 --- a/docs/journey-leg.md +++ b/docs/trip.md @@ -1,8 +1,10 @@ -# `journeyLeg(ref, lineName, [opt])` +# `trip(id, lineName, [opt])` -This method can be used to refetch information about a leg of a journey. Note that it is not supported by every profile/endpoint. +This method can be used to refetch information about a trip – a vehicle stopping at a set of stops at specific times. -Let's say you used [`journeys`](journeys.md) and now want to get more up-to-date data about the arrival/departure of a leg. You'd pass in a journey leg `id` like `'1|24983|22|86|18062017'`. `lineName` must be the name of the journey leg's `line.name`. You can get them like this: +*Note*: This method is not supported by every profile/endpoint. + +Let's say you used [`journeys`](journeys.md) and now want to get more up-to-date data about the arrival/departure of a leg. You'd pass in the trip ID from `leg.id`, e.g. `'1|24983|22|86|18062017'`, and the name of the line from `leg.line.name` like this: ```js const createClient = require('hafas-client') @@ -14,7 +16,7 @@ const client = createClient(vbbProfile) client.journeys('900000003201', '900000100008', {results: 1}) .then(([journey]) => { const leg = journey.legs[0] - return client.journeyLeg(leg.id, leg.line.name) + return client.trip(leg.id, leg.line.name) }) .then(console.log) .catch(console.error) @@ -26,7 +28,7 @@ With `opt`, you can override the default options, which look like this: { when: new Date(), stopovers: true, // return stations on the way? - polyline: false, // return a shape for the leg? + polyline: false, // return a shape for the trip? remarks: true // parse & expose hints & warnings? } ``` @@ -43,7 +45,7 @@ const vbbProfile = require('hafas-client/p/vbb') const client = createClient(vbbProfile) -client.journeyLeg('1|31431|28|86|17122017', 'S9', {when: 1513534689273}) +client.trip('1|31431|28|86|17122017', 'S9', {when: 1513534689273}) .then(console.log) .catch(console.error) ``` @@ -121,7 +123,7 @@ The response looked like this: ### `polyline` option -If you pass `polyline: true`, the leg will have a `polyline` field, containing a [GeoJSON](http://geojson.org) [`FeatureCollection`](https://tools.ietf.org/html/rfc7946#section-3.3) of [`Point`s](https://tools.ietf.org/html/rfc7946#appendix-A.1). Every `Point` next to a station will have `properties` containing the station's metadata. +If you pass `polyline: true`, the trip will have a `polyline` field, containing a [GeoJSON](http://geojson.org) [`FeatureCollection`](https://tools.ietf.org/html/rfc7946#section-3.3) of [`Point`s](https://tools.ietf.org/html/rfc7946#appendix-A.1). Every `Point` next to a station will have `properties` containing the station's metadata. We'll look at an example for *U6* from *Alt-Mariendorf* to *Alt-Tegel*, taken from the [VBB profile](../p/vbb):