aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCollin Guarino <collin.guarino@gmail.com>2016-02-13 11:36:53 -0500
committerCollin Guarino <collin.guarino@gmail.com>2016-02-13 11:36:53 -0500
commit11c8df3ca1f1aac6bd893ea2ecb69f858faceda5 (patch)
treea6501da40543e232d221d07cbe0e298fa3b2156c
parentd676089ff95cef488963555e75929da20326f612 (diff)
Moved CreateUser to Bridge.CreateUser
-rw-r--r--bridge.go2
-rw-r--r--bridge_test.go3
2 files changed, 3 insertions, 2 deletions
diff --git a/bridge.go b/bridge.go
index ec2f050..4785175 100644
--- a/bridge.go
+++ b/bridge.go
@@ -171,7 +171,7 @@ func GetBridgeInfo(self *Bridge) error {
}
// CreateUser posts to ./api on the bridge to create a new whitelisted user.
-func CreateUser(bridge *Bridge, deviceType string) (string, error) {
+func (bridge *Bridge) CreateUser(deviceType string) (string, error) {
// Send an HTTP POST with the body content
params := map[string]string{"devicetype": deviceType}
body, _, err := bridge.Post("/api", params)
diff --git a/bridge_test.go b/bridge_test.go
index 43a635f..e7069a2 100644
--- a/bridge_test.go
+++ b/bridge_test.go
@@ -16,5 +16,6 @@ func TestNewBridge(t *testing.T) {
}
func TestCreateUser(t *testing.T) {
- CreateUser(NewBridge("192.168.1.128", "319b36233bd2328f3e40731b23479207"), "linux")
+ bridge := NewBridge("192.168.1.128", "319b36233bd2328f3e40731b23479207")
+ bridge.CreateUser("linux")
}