lib/hue/light.rb in hue-0.1.2 vs lib/hue/light.rb in hue-0.1.3

- old
+ new

@@ -97,12 +97,12 @@ :name => new_name } uri = URI.parse(base_url) http = Net::HTTP.new(uri.host) - response = http.request_put(uri.path, MultiJson.dump(body)) - response = MultiJson.load(response.body).first + response = http.request_put(uri.path, JSON.dump(body)) + response = JSON(response.body).first if response['success'] @name = new_name # else # TODO: Error end @@ -110,11 +110,11 @@ def on? @state['on'] end - %w{on hue saturation brightness color_temperature}.each do |key| + %w{on hue saturation brightness color_temperature alert}.each do |key| define_method "#{key}=".to_sym do |value| set_state({key.to_sym => value}) instance_variable_set("@#{key}".to_sym, value) end end @@ -141,16 +141,16 @@ # Add transition body.merge!({:transitiontime => transition}) if transition uri = URI.parse("#{base_url}/state") http = Net::HTTP.new(uri.host) - response = http.request_put(uri.path, MultiJson.dump(body)) - MultiJson.load(response.body) + response = http.request_put(uri.path, JSON.dump(body)) + JSON(response.body) end # Refresh the state of the lamp def refresh - json = MultiJson.load(Net::HTTP.get(URI.parse(base_url))) + json = JSON(Net::HTTP.get(URI.parse(base_url))) unpack(json) end private