Преглед изворни кода

Add Set Controller endpoint

Paul Molluzzo пре 9 година
родитељ
комит
cc12122989
2 измењених фајлова са 13 додато и 1 уклоњено
  1. 4 0
      src/hydrawise.js
  2. 9 1
      test/index.js

+ 4 - 0
src/hydrawise.js

@@ -27,6 +27,10 @@ class Hydrawise {
   statusschedule(tag = '', hours = '168') {
     return this.request('GET', 'statusschedule', {tag, hours});
   }
+
+  setcontroller(controller_id) {
+    return this.request('GET', 'setcontroller', {controller_id, json: true});
+  }
 }
 
 export default Hydrawise;

+ 9 - 1
test/index.js

@@ -23,7 +23,15 @@ test('Status Schedule', t => {
 
 test('Status Schedule All', t => {
   return hydrawise.statusschedule('hydrawise_all').then(data => {
-    console.log(data);
+    if (data.error_msg) {
+      t.fail(`Error: ${data.error_msg}`);
+    }
+    t.pass();
+  });
+});
+
+test('Set Controller', t => {
+  return hydrawise.setcontroller('11742').then(data => {
     if (data.error_msg) {
       t.fail(`Error: ${data.error_msg}`);
     }