-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
part of #207
- Loading branch information
Showing
10 changed files
with
250 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"auth": { | ||
"type": "AID", | ||
"aid": "and20201hf7mcf9bv3nv8g5f" | ||
}, | ||
"client": { | ||
"type": "AND", | ||
"id": "VAO" | ||
}, | ||
"endpoint": "https://fahrplan.vmobil.at/bin/mgate.exe", | ||
"ext": "VAO.11", | ||
"ver": "1.27", | ||
"defaultLanguage": "de" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
'use strict' | ||
|
||
const createClient = require('../..') | ||
const vvvProfile = require('.') | ||
|
||
const client = createClient(vvvProfile, 'hafas-client example') | ||
|
||
const bregenzLandeskrankenhaus = '480195700' | ||
const bludenzGymnasium = '480031300' | ||
|
||
// client.journeys(bregenzLandeskrankenhaus, bludenzGymnasium, { | ||
// results: 1, stopovers: true, | ||
// }) | ||
// .then(({journeys}) => { | ||
// const [journey] = journeys | ||
// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true}) | ||
// }) | ||
// .then(({journeys}) => { | ||
// const [journey] = journeys | ||
// const leg = journey.legs[0] | ||
// return client.trip(leg.tripId, leg.line.name, {polyline: true}) | ||
// }) | ||
|
||
// client.departures(bregenzLandeskrankenhaus, {duration: 1}) | ||
// client.arrivals(bregenzLandeskrankenhaus, {duration: 10, linesOfStops: true}) | ||
|
||
client.locations('krankenhaus', {results: 3}) | ||
// client.stop(bregenzLandeskrankenhaus, {linesOfStops: true}) | ||
// client.nearby({ | ||
// type: 'location', | ||
// id: '980010311', | ||
// address: 'AustraΓe 37, 6700 Bludenz', | ||
// latitude: 47.149626, | ||
// longitude: 9.822693, | ||
// }, {distance: 1000}) | ||
// client.reachableFrom({ | ||
// type: 'location', | ||
// id: '980010311', | ||
// address: 'AustraΓe 37, 6700 Bludenz', | ||
// latitude: 47.149626, | ||
// longitude: 9.822693, | ||
// }, { | ||
// maxDuration: 30, | ||
// }) | ||
|
||
.then((data) => { | ||
console.log(require('util').inspect(data, {depth: null, colors: true})) | ||
}) | ||
.catch(console.error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
'use strict' | ||
|
||
const baseProfile = require('./base.json') | ||
|
||
const products = [{ | ||
id: 'train-and-s-bahn', | ||
mode: 'train', | ||
bitmasks: [1, 2], | ||
name: 'Bahn & S-Bahn', | ||
short: 'Bahn & S-Bahn', | ||
default: true, | ||
}, { | ||
id: 'u-bahn', | ||
mode: 'train', | ||
bitmasks: [4], | ||
name: 'U-Bahn', | ||
short: 'U-Bahn', | ||
default: true, | ||
}, { | ||
id: 'tram', | ||
mode: 'train', | ||
bitmasks: [16], | ||
name: 'StraΓenbahn', | ||
short: 'StraΓenbahn', | ||
default: true, | ||
}, { | ||
id: 'city-bus', | ||
mode: 'bus', | ||
bitmasks: [128], | ||
name: 'Stadtbus', | ||
short: 'Stadtbus', | ||
default: true, | ||
}, { | ||
id: 'regional-bus', | ||
mode: 'bus', | ||
bitmasks: [64], | ||
name: 'Regionalbus', | ||
short: 'Regionalbus', | ||
default: true, | ||
}, { | ||
id: 'long-distance-bus', | ||
mode: 'bus', | ||
bitmasks: [32], | ||
name: 'Fernbus', | ||
short: 'Fernbus', | ||
default: true, | ||
}, { | ||
id: 'other-bus', | ||
mode: 'bus', | ||
bitmasks: [2048], | ||
name: 'sonstige Busse', | ||
short: 'sonstige Busse', | ||
default: true, | ||
}, { | ||
id: 'aerial-lift', | ||
mode: 'gondola', | ||
bitmasks: [256], | ||
name: 'Seil-/Zahnradbahn', | ||
short: 'Seil-/Zahnradbahn', | ||
default: true, | ||
}, { | ||
id: 'ferry', | ||
mode: 'watercraft', | ||
bitmasks: [512], | ||
name: 'Schiff', | ||
short: 'Schiff', | ||
default: true, | ||
}, { | ||
id: 'on-call', | ||
mode: 'taxi', | ||
bitmasks: [1024], | ||
name: 'Anrufsammeltaxi', | ||
short: 'AST', | ||
default: true, | ||
}] | ||
|
||
const vosProfile = { | ||
...baseProfile, | ||
auth: { | ||
aid: 'and20201hf7mcf9bv3nv8g5f', | ||
type: 'USER', | ||
user: 'mobile', | ||
}, | ||
addMicMac: true, | ||
salt: '6633673735743766726667323938336A', | ||
locale: 'at-DE', | ||
timezone: 'Europe/Vienna', | ||
|
||
products, | ||
|
||
departuresGetPasslist: false, | ||
departuresStbFltrEquiv: false, | ||
refreshJourneyUseOutReconL: true, | ||
trip: true, | ||
reachableFrom: true, | ||
} | ||
|
||
module.exports = vosProfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# VVV profile for `hafas-client` | ||
|
||
[*Verkehrsverbund Vorarlberg (VVV)*](https://de.wikipedia.org/wiki/Verkehrsverbund_Vorarlberg) is the local transport provider of [Vorarlberg](https://en.wikipedia.org/wiki/Vorarlberg) that runs its apps under the [*VMOBIL*](https://www.vmobil.at) brand. This profile adds *VVV*/*VMOBIL* support to `hafas-client`. | ||
|
||
## Usage | ||
|
||
```js | ||
const createClient = require('hafas-client') | ||
const vvvProfile = require('hafas-client/p/vvv') | ||
|
||
// create a client with VVV profile | ||
const client = createClient(vvvProfile, 'my-awesome-program') | ||
``` | ||
|
||
Check out the [code examples](example.js). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"ver":"1.27","ext":"VAO.11","lang":"deu","id":"zv4scgiqm2qcyg8x","err":"OK","cInfo":{"code":"OK","url":"","msg":""},"graph":{"id":"standard","index":0},"subGraph":{"id":"global","index":0},"view":{"id":"standard","index":0,"type":"WGS84"},"svcResL":[{"meth":"LocMatch","err":"OK","res":{"common":{"remL":[{"type":"W","code":"WW","txtN":"WEBVIEW","url":"https://app.verkehrsauskunft.at/bin/query.exe/dn?tpl=webview_poi&performLocating=128&look_station=960076303&look_nv=get_infotext|yes|get_attributes|yes&look_stationpool=130"}],"icoL":[{"res":"prod_bus","txtS":"4","fg":{"r":255,"g":255,"b":255},"bg":{"r":0,"g":121,"b":58},"zIdx":1000},{"res":"PCAT_KRANKENANSTALT","zIdx":900},{"res":"prod_ic_bus","txtS":"11","fg":{"r":255,"g":255,"b":255},"bg":{"r":0,"g":121,"b":58},"zIdx":1000},{"res":"prod_bus","txtS":"1","fg":{"r":255,"g":255,"b":255},"bg":{"r":0,"g":121,"b":58},"zIdx":1000},{"res":"prod_ic_bus","txtS":"878","fg":{"r":255,"g":255,"b":255},"bg":{"r":0,"g":121,"b":58},"zIdx":1000}]},"match":{"field":"S","state":"L","locL":[{"lid":"A=1@O=Bregenz Landeskrankenhaus@X=9743201@Y=47497806@U=81@L=480195700@B=1@p=1628121247@","type":"S","name":"Bregenz Landeskrankenhaus","nameFormatted":{"text":"Bregenz Landeskrankenhaus"},"icoX":0,"extId":"480195700","state":"F","crd":{"x":9743201,"y":47497806,"floor":0},"meta":true,"pCls":192,"wt":191,"isMainMast":true,"gidL":["at:48:1957"]},{"lid":"A=4@O=Landeskrankenhaus Bregenz@X=9745287@Y=47496736@U=130@L=960076303@B=1@p=1628123037@","type":"P","name":"Landeskrankenhaus Bregenz","nameFormatted":{"text":"Landeskrankenhaus Bregenz"},"icoX":1,"extId":"960076303","state":"F","crd":{"x":9745287,"y":47496736,"floor":0},"mcpData":{"type":"P","occupancy":"N","mcpid":"0","externalId":"vao-betrieb_K803"},"msgL":[{"type":"REM","remX":0,"sty":"I","dspl":"U","tagL":["RES_LOC_WEB","RES_LOC_FLY_WEB"],"sort":684195840}]},{"lid":"A=1@O=Bregenz Gebietskrankenkasse@X=9731335@Y=47499819@U=81@L=480046500@B=1@p=1628121247@","type":"S","name":"Bregenz Gebietskrankenkasse","nameFormatted":{"text":"Bregenz Gebietskrankenkasse"},"icoX":2,"extId":"480046500","state":"F","crd":{"x":9731335,"y":47499819,"floor":0},"meta":true,"pCls":192,"wt":88,"isMainMast":true,"gidL":["at:48:465"]},{"lid":"A=1@O=Bludenz Krankenhaus@X=9821371@Y=47158993@U=81@L=480038800@B=1@p=1628121247@","type":"S","name":"Bludenz Krankenhaus","nameFormatted":{"text":"Bludenz Krankenhaus"},"icoX":3,"extId":"480038800","state":"F","crd":{"x":9821371,"y":47158993,"floor":0},"meta":true,"pCls":128,"wt":58,"isMainMast":true,"gidL":["at:48:388"]},{"lid":"A=1@O=Eggenburg Krankenhaus@X=15821365@Y=48646079@U=81@L=431557000@B=1@p=1628121247@","type":"S","name":"Eggenburg Krankenhaus","nameFormatted":{"text":"Eggenburg Krankenhaus"},"icoX":4,"extId":"431557000","state":"F","crd":{"x":15821365,"y":48646079,"floor":0},"meta":true,"pCls":64,"wt":10,"isMainMast":true,"gidL":["at:43:15570"]}]}}}]} |
35 changes: 35 additions & 0 deletions
35
test/e2e/fixtures/fb997e87e2c2921529ca6a49c7d9859d.headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"statusCode": 200, | ||
"headers": { | ||
"date": "Thu, 05 Aug 2021 18:09:48 GMT", | ||
"server": "Apache", | ||
"content-length": "1039", | ||
"content-type": "application/json; charset=utf-8", | ||
"connection": "close" | ||
}, | ||
"url": "https://fahrplan.vmobil.at/bin/mgate.exe?mic=b612903e01707306710b6fbabc65bcee&mac=2287c0d8d5f08f184f1e71f246aee38c", | ||
"time": 266, | ||
"request": { | ||
"method": "POST", | ||
"headers": { | ||
"Content-Type": [ | ||
"application/json" | ||
], | ||
"Accept-Encoding": [ | ||
"gzip, br, deflate" | ||
], | ||
"Accept": [ | ||
"application/json" | ||
], | ||
"user-agent": [ | ||
"pb8f7fad7961dublic-transport/hafas-client:test" | ||
], | ||
"Content-Length": [ | ||
"296" | ||
], | ||
"Connection": [ | ||
"close" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict' | ||
|
||
const tap = require('tap') | ||
|
||
const {createWhen} = require('./lib/util') | ||
const createClient = require('../..') | ||
const vvvProfile = require('../../p/vvv') | ||
const createValidate = require('./lib/validate-fptf-with') | ||
|
||
const when = createWhen(vvvProfile.timezone, vvvProfile.locale) | ||
const cfg = { | ||
when, | ||
stationCoordsOptional: false, | ||
products: vvvProfile.products, | ||
maxLatitude: 47.9504, | ||
maxLongitude: 17.0892, | ||
minLatitude: 45.7206, | ||
minLongitude: 7.8635, | ||
} | ||
const validate = createValidate(cfg) | ||
|
||
const client = createClient(vvvProfile, 'public-transport/hafas-client:test') | ||
|
||
const bregenzLandeskrankenhaus = '480195700' | ||
|
||
tap.test('locations named "bregenz krankenhaus"', async (t) => { | ||
const locations = await client.locations('bregenz krankenhaus') | ||
|
||
validate(t, locations, 'locations', 'locations') | ||
t.ok(locations.some((l) => { | ||
return l.station && l.station.id === bregenzLandeskrankenhaus || l.id === bregenzLandeskrankenhaus | ||
}), 'Bregenz Landeskrankenhaus not found') | ||
|
||
t.end() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule transport-apis
updated
3 files
+88 β0 | data/at/ivb-hafas-mgate.json | |
+88 β0 | data/at/salzburg-hafas-mgate.json | |
+74 β0 | data/de/gvh-hafas-mgate.json |