-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParser.js
43 lines (32 loc) · 1.24 KB
/
Parser.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
const axios = require("axios");
class Parser {
static Discovery = "Discovery";
static LockController = "LockController";
static ThermostatController = "ThermostatController";
static PowerController = "PowerController";
static didDirectiveExists(event) {
return "directive" in event;
}
static isPayloadVersionValid(event) {
return event.directive.header.payloadVersion === "3";
}
static didNamespaceExists(event) {
return event.directive && event.directive.header && event.directive.header.namespace;
}
static getNamespace(event) {
return event.directive.header.namespace;
}
static isDiscovery(namespace) {
return namespace === `Alexa.${this.Discovery}`
}
static isLockController(namespace) {
return namespace === `Alexa.${this.LockController}`;
}
static isThermostatController(namespace) {
return namespace === `Alexa.${this.ThermostatController}`;
}
static isPowerController(namespace) {
return namespace === `Alexa.${this.PowerController}`;
}
}
module.exports = Parser;