-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcaptran-wmata-dev.js
58 lines (50 loc) · 1.18 KB
/
captran-wmata-dev.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
'use strict'
const Wmata = require('./captran-wmata')
// shortcut query params for dev
const pentagon = {
busesNearby: {
api: 'busPositions',
Lat: 38.8690011,
Lon: -77.0544217,
Radius: 500
},
stopsNearby: {
api: 'stops',
Lat: 38.8690011,
Lon: -77.0544217,
Radius: 500
}
}
const lafeyette = {
busPredictions: {
api: 'stopPredictions',
StopID: '1001141'
}
}
const farragutMurrow = {
busPredictions: {
api: 'stopPredictions',
StopID: '1001133'
}
}
class WmataDev extends Wmata {
// returns a string
static get DEV () { return 'apple' }
// functions for testing and dev
queryBusesNearPentagon (callback) {
return this.query(pentagon.busesNearby, callback)
}
queryStopsNearPentagon (callback) {
return this.query(pentagon.stopsNearby, callback)
}
queryBusPredictionsNearWH (callback) {
return this.query(lafeyette.busPredictions, callback)
}
queryBusPredicctionsNearFarragut (callback) {
return this.query(farragutMurrow.busPredictions, callback)
}
consoleCall (params) {
this.callWmata(params).then(console.log)
} // or just throw in console.log as this.query's callback
}
module.exports = WmataDev