From af5ce1561b1a5650528fc27f0b46ec9bbf39e1d2 Mon Sep 17 00:00:00 2001 From: Matte Noble Date: Tue, 6 Aug 2013 15:32:42 -0700 Subject: [PATCH] Fixing bugs from refactoring --- lib/wemo/switch.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/wemo/switch.rb b/lib/wemo/switch.rb index b9e812c..4f50acd 100644 --- a/lib/wemo/switch.rb +++ b/lib/wemo/switch.rb @@ -30,11 +30,11 @@ def off? end def on! - basic_service.send(Actions::SetBinaryState.new(state: "1")) + basic_event.send(Actions::SetBinaryState.new(state: "1")) end def off! - basic_service.send(Actions::SetBinaryState.new(state: "0")) + basic_event.send(Actions::SetBinaryState.new(state: "0")) end def set!(state) @@ -44,7 +44,11 @@ def set!(state) private def setup - Net::HTTP.get(URI.parse("http://#{location}/setup.xml")) + Net::HTTP.get(URI.parse("#{schemize(location)}/setup.xml")) + end + + def schemize(uri) + uri =~ /^http/ ? uri : "http://#{uri}" end def state