-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
52 lines (46 loc) · 1.51 KB
/
index.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
require('dotenv').config()
const dates = require('./helpers/dates');
const apiToken = process.env.TPAPITOKEN;
module.exports = ({token} = {}) => {
if(apiToken) {
token = apiToken;
}
if(!token && !apiToken) {
throw new Error("Looks like API token is not provided. You can do in by process.env.TPAPITOKEN or by passing object with key 'token' and token as value when require module. See readme for details.")
}
const latest = require('./api/latest')(token);
const monthMatrix = require('./api/monthMatrix')(token);
const weekMatrix = require('./api/weekMatrix')(token);
const nearestPlacesMatrix = require('./api/nearestPlacesMatrix')(token);
const cheap = require('./api/cheap')(token);
const monthly = require('./api/monthly')(token);
const direct = require('./api/direct')(token);
const calendar = require('./api/calendar')(token);
const holidaysByRoutes = require('./api/holidaysByRoutes')(token);
const minPricesCalendar = require('./api/minPricesCalendar')(token);
const directions = require('./api/directions')(token);
const prices = require('./api/prices')(token);
const city = require('./api/city')(token);
const prices_for_dates = require('./api/prices_for_dates')(token);
const grouped_prices = require('./api/grouped_prices')(token);
return {
helpers: {
daysBeforeNextMonth: dates.daysBeforeNextMonth
},
latest,
monthMatrix,
weekMatrix,
nearestPlacesMatrix,
cheap,
monthly,
direct,
calendar,
holidaysByRoutes,
minPricesCalendar,
directions,
prices,
city,
prices_for_dates,
grouped_prices
}
}