Commit 59b142eb77d43824a0cd73b904b0187d20bb94f1
friendly api
Ben Evans committed on 11/17/2018, 6:09:01 PMParent: b0f2a12e61821d424e901ca7ac7f981aa5ea59d0
Files changed
index.js | changed |
test.js | changed |
index.js | ||
---|---|---|
@@ -30,9 +30,9 @@ | ||
30 | 30 … | async authenticate() { |
31 | 31 … | await this._request(`http://${this.host}`) |
32 | 32 … | } |
33 | 33 … | |
34 | - async getStatus() { | |
34 … | + async status() { | |
35 | 35 … | const res = await this.request(`/api/monitoring/status`) |
36 | 36 … | return { |
37 | 37 … | /** |
38 | 38 … | * mobile signal strength |
@@ -51,9 +51,9 @@ | ||
51 | 51 … | currentDevices: parseInt(res.CurrentWifiUser) |
52 | 52 … | } |
53 | 53 … | } |
54 | 54 … | |
55 | - async getTrafficStatistics() { | |
55 … | + async traffic() { | |
56 | 56 … | const res = await this.request(`/api/monitoring/traffic-statistics`) |
57 | 57 … | return { |
58 | 58 … | currentConnectTime: parseInt(res.CurrentConnectTime), |
59 | 59 … | currentUpload: parseInt(res.CurrentUpload), |
@@ -65,9 +65,9 @@ | ||
65 | 65 … | totalConnectTime: parseInt(res.TotalConnectTime), |
66 | 66 … | } |
67 | 67 … | } |
68 | 68 … | |
69 | - async getCheckNotifications() { | |
69 … | + async notifications() { | |
70 | 70 … | const res = await this.request(`/api/monitoring/check-notifications`) |
71 | 71 … | return { |
72 | 72 … | unreadMessage: parseInt(res.UnreadMessage), |
73 | 73 … | smsStorageFull: parseInt(res.SmsStorageFull), |
test.js | ||
---|---|---|
@@ -9,20 +9,20 @@ | ||
9 | 9 … | t.end() |
10 | 10 … | }) |
11 | 11 … | |
12 | 12 … | test('get status', async t => { |
13 | - const status = await client.getStatus() | |
13 … | + const status = await client.status() | |
14 | 14 … | console.log(status) |
15 | 15 … | t.end() |
16 | 16 … | }) |
17 | 17 … | |
18 | 18 … | test('get traffic stats', async t => { |
19 | - const status = await client.getTrafficStatistics() | |
19 … | + const status = await client.traffic() | |
20 | 20 … | console.log(status) |
21 | 21 … | t.end() |
22 | 22 … | }) |
23 | 23 … | |
24 | 24 … | test('check notifications', async t => { |
25 | - const status = await client.getCheckNotifications() | |
25 … | + const status = await client.notifications() | |
26 | 26 … | console.log(status) |
27 | 27 … | t.end() |
28 | 28 … | }) |
Built with git-ssb-web