Skip to content

Commit

Permalink
adapt docs & examples to 0a0cddc 📝
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Jul 24, 2018
1 parent 5d9d738 commit f20931b
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 13 deletions.
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This version is not fully backwords-compatible. Check out [the migration guide](

### breaking changes 💥

- c4935bc new mandatory `User-Agent` parameter
- b7c1ee3 profiles: new products markup ([guide](https://github.com/public-transport/hafas-client/blob/ebe4fa64d871f711ced99d528c0171b180edc135/docs/writing-a-profile.md#3-products))
- 40b559f change `radar(n, w, s, e)` signature to `radar({north, west, south, east})`
- 005f3f8 remove `journey.departure`, `journey.arrival`, …
Expand Down
2 changes: 1 addition & 1 deletion docs/departures.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ As an example, we're going to use the [VBB profile](../p/vbb):
const createClient = require('hafas-client')
const vbbProfile = require('hafas-client/p/vbb')

const client = createClient(vbbProfile)
const client = createClient(vbbProfile, 'my-awesome-program')

// S Charlottenburg
client.departures('900000024101', {duration: 3})
Expand Down
2 changes: 1 addition & 1 deletion docs/journeys.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ As an example, we're going to use the [VBB profile](../p/vbb):
const createClient = require('hafas-client')
const vbbProfile = require('hafas-client/p/vbb')

const client = createClient(vbbProfile)
const client = createClient(vbbProfile, 'my-awesome-program')

// Hauptbahnhof to Heinrich-Heine-Str.
client.journeys('900000003201', '900000100008', {
Expand Down
2 changes: 1 addition & 1 deletion docs/locations.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ As an example, we're going to use the [VBB profile](../p/vbb):
const createClient = require('hafas-client')
const vbbProfile = require('hafas-client/p/vbb')

const client = createClient(vbbProfile)
const client = createClient(vbbProfile, 'my-awesome-program')

client.locations('Alexanderplatz', {results: 3})
.then(console.log)
Expand Down
13 changes: 13 additions & 0 deletions docs/migrating-to-3.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Migrating to `hafas-client@3`

## New `User-Agent` parameter

Pass an additional `User-Agent` string into `createClient`:

```js
const createClient = require('hafas-client')
const dbProfile = require('hafas-client/p/db')

const client = createClient(dbProfile, 'my-awesome-program')
```

Pick a name that describes your program and – if possible – the website/repo of it.

## If you use the `journeyLeg()` method…

…change the `journeyLeg(id, lineName)` call to `trip(id, lineName)`. c8ff217
Expand Down
2 changes: 1 addition & 1 deletion docs/nearby.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ As an example, we're going to use the [VBB profile](../p/vbb):
const createClient = require('hafas-client')
const vbbProfile = require('hafas-client/p/vbb')

const client = createClient(vbbProfile)
const client = createClient(vbbProfile, 'my-awesome-program')

client.nearby({
type: 'location',
Expand Down
2 changes: 1 addition & 1 deletion docs/radar.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ As an example, we're going to use the [VBB profile](../p/vbb):
const createClient = require('hafas-client')
const vbbProfile = require('hafas-client/p/vbb')

const client = createClient(vbbProfile)
const client = createClient(vbbProfile, 'my-awesome-program')

client.radar({
north: 52.52411,
Expand Down
2 changes: 1 addition & 1 deletion docs/station.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ As an example, we're going to use the [VBB profile](../p/vbb):
const createClient = require('hafas-client')
const vbbProfile = require('hafas-client/p/vbb')
const client = createClient(vbbProfile)
const client = createClient(vbbProfile, 'my-awesome-program')
client.station('900000042101') // U Spichernstr.
.then(console.log)
Expand Down
2 changes: 1 addition & 1 deletion docs/trip.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Let's say you used [`journeys`](journeys.md) and now want to get more up-to-date
const createClient = require('hafas-client')
const vbbProfile = require('hafas-client/p/vbb')

const client = createClient(vbbProfile)
const client = createClient(vbbProfile, 'my-awesome-program')

// Hauptbahnhof to Heinrich-Heine-Str.
client.journeys('900000003201', '900000100008', {results: 1})
Expand Down
2 changes: 1 addition & 1 deletion p/db/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const createClient = require('../../')
const dbProfile = require('.')

const client = createClient(dbProfile)
const client = createClient(dbProfile, 'hafas-client-example')

// Berlin Jungfernheide to München Hbf
client.journeys('8011167', '8000261', {results: 1, tickets: true})
Expand Down
2 changes: 1 addition & 1 deletion p/insa/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const createClient = require('../..')
const insaProfile = require('.')

const client = createClient(insaProfile)
const client = createClient(insaProfile, 'hafas-client-example')

// from Magdeburg-Neustadt to Magdeburg-Buckau
client.journeys('008010226', '008013456', {results: 1})
Expand Down
2 changes: 1 addition & 1 deletion p/nahsh/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const createClient = require('../..')
const nahshProfile = require('.')

const client = createClient(nahshProfile)
const client = createClient(nahshProfile, 'hafas-client-example')

// Flensburg Hbf to Kiel Hbf
client.journeys('8000103', '8000199', {results: 10, tickets: true})
Expand Down
2 changes: 1 addition & 1 deletion p/oebb/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const createClient = require('../..')
const oebbProfile = require('.')

const client = createClient(oebbProfile)
const client = createClient(oebbProfile, 'hafas-client-example')

// Wien Westbahnhof to Salzburg Hbf
client.journeys('1291501', '8100002', {results: 1})
Expand Down
2 changes: 1 addition & 1 deletion p/vbb/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const createClient = require('../..')
const vbbProfile = require('.')

const client = createClient(vbbProfile)
const client = createClient(vbbProfile, 'hafas-client-example')

// Hauptbahnhof to Charlottenburg
client.journeys('900000003201', '900000024101', {results: 1, polylines: true})
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const createClient = require('hafas-client')
const dbProfile = require('hafas-client/p/db')

// create a client with Deutsche Bahn profile
const client = createClient(dbProfile)
const client = createClient(dbProfile, 'my-awesome-program')

// Berlin Jungfernheide to München Hbf
client.journeys('8011167', '8000261', {results: 1})
Expand Down

0 comments on commit f20931b

Please sign in to comment.