-
Notifications
You must be signed in to change notification settings - Fork 0
/
handler.js
82 lines (69 loc) · 2.71 KB
/
handler.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
'use strict';
const Themeparks = require("themeparks");
const save = require('./functions/save');
module.exports.magicKingdom = async (event, context, callback) => {
const disneyMagicKingdom = new Themeparks.Parks.WaltDisneyWorldMagicKingdom();
try {
const rides = await disneyMagicKingdom.GetWaitTimes();
save.data('magic-kingdom', rides);
callback(null, { message: 'magicKingdom function executed successfully!', event });
} catch (err) {
console.log('There was an error in magicKingdom');
console.error(err);
}
};
module.exports.epcot = async (event, context, callback) => {
const EPCOT = new Themeparks.Parks.WaltDisneyWorldEpcot();
try {
const rides = await EPCOT.GetWaitTimes();
save.data('epcot', rides);
callback(null, { message: 'Epcot function executed successfully!', event });
} catch (err) {
console.log('There was an error in Epcot');
console.error(err);
}
};
module.exports.hollywoodStudios = async (event, context, callback) => {
const hollywoodStudios = new Themeparks.Parks.WaltDisneyWorldHollywoodStudios();
try {
const rides = await hollywoodStudios.GetWaitTimes();
save.data('hollywood-studios', rides);
callback(null, { message: 'hollywoodStudios function executed successfully!', event });
} catch (err) {
console.log('There was an error in hollywoodStudios');
console.error(err);
}
};
module.exports.animalKingdom = async (event, context, callback) => {
const animalKingdom = new Themeparks.Parks.WaltDisneyWorldAnimalKingdom();
try {
const rides = await animalKingdom.GetWaitTimes();
save.data('animal-kingdom', rides);
callback(null, { message: 'animalKingdom function executed successfully!', event });
} catch (err) {
console.log('There was an error in animalKingdom');
console.error(err);
}
};
module.exports.universalStudios = async (event, context, callback) => {
const universalStudios = new Themeparks.Parks.UniversalStudiosFlorida();
try {
const rides = await universalStudios.GetWaitTimes();
save.data('universal-studios', rides);
callback(null, { message: 'universalStudios function executed successfully!', event });
} catch (err) {
console.log('There was an error in universalStudios');
console.error(err);
}
};
module.exports.islandsOfAdventure = async (event, context, callback) => {
const islandsOfAdventure = new Themeparks.Parks.UniversalIslandsOfAdventure();
try {
const rides = await islandsOfAdventure.GetWaitTimes();
save.data('islands-of-adventure', rides);
callback(null, { message: 'islandsOfAdventure function executed successfully!', event });
} catch (err) {
console.log('There was an error in islandsOfAdventure');
console.error(err);
}
};