diff options
author | Collin Guarino <collin.guarino@gmail.com> | 2016-02-16 23:00:58 -0500 |
---|---|---|
committer | Collin Guarino <collin.guarino@gmail.com> | 2016-02-16 23:00:58 -0500 |
commit | b52b2b77e142d0315683b0a4d7565527f1264524 (patch) | |
tree | 374163050ee1a4f9cfb642a1c893862cdc2d926d | |
parent | 39254dee24bbca708bedbf463604ed412c385c78 (diff) |
Renamed all 'self' definitions to resemble the struct name.
-rw-r--r-- | bridge.go | 6 | ||||
-rw-r--r-- | light.go | 22 | ||||
-rw-r--r-- | schedule.go | 4 |
3 files changed, 16 insertions, 16 deletions
@@ -56,9 +56,9 @@ type Device struct { } // bridge.Get sends an http GET to the bridge -func (self *Bridge) Get(path string) ([]byte, io.Reader, error) { - resp, err := http.Get("http://" + self.IPAddress + path) - if self.Error(resp, err) { +func (bridge *Bridge) Get(path string) ([]byte, io.Reader, error) { + resp, err := http.Get("http://" + bridge.IPAddress + path) + if bridge.Error(resp, err) { return []byte{}, nil, err } return HandleResponse(resp) @@ -61,11 +61,11 @@ type LightState struct { // Light.SetName assigns a new name in the light's // attributes as recognized by the bridge. -func (self *Light) SetName(name string) error { - uri := fmt.Sprintf("/api/%s/lights/%d", self.Bridge.Username, self.Index) +func (light *Light) SetName(name string) error { + uri := fmt.Sprintf("/api/%s/lights/%d", light.Bridge.Username, light.Index) body := make(map[string]string) body["name"] = name - _, _, err := self.Bridge.Put(uri, body) + _, _, err := light.Bridge.Put(uri, body) if err != nil { return err } @@ -73,21 +73,21 @@ func (self *Light) SetName(name string) error { } // Light.Off turns the light source off -func (self *Light) Off() error { - return self.SetState(LightState{On: false}) +func (light *Light) Off() error { + return light.SetState(LightState{On: false}) } // Light.Off turns the light source on -func (self *Light) On() error { - return self.SetState(LightState{On: true}) +func (light *Light) On() error { + return light.SetState(LightState{On: true}) } // Light.Toggle switches the light source on and off -func (self *Light) Toggle() error { - if self.State.On { - return self.Off() +func (light *Light) Toggle() error { + if light.State.On { + return light.Off() } else { - return self.On() + return light.On() } return nil } diff --git a/schedule.go b/schedule.go index 5f9ca38..a251d3c 100644 --- a/schedule.go +++ b/schedule.go @@ -87,11 +87,11 @@ func (bridge *Bridge) CreateSchedule(schedule Schedule) error { return nil } -// func (self *Schedule) Disable() { +// func (schedule *Schedule) Disable() { // // } // -// func (self *Schedule) Enable() { +// func (schedule *Schedule) Enable() { // // } // |