Burgestrand/ruhue — pull request #4 by femto113 (2012-12-05 23:32:05+00:00)
Title: added simple object model for lights

Just playing around, so this probably isn't as well thought through as it could be, but it's definitely a step forward in easy of control. I've added a Light class to the Client which provides an object oriented interface to a single light. You can now do things like the following in the console

[7] pry(main)> client.lights
=> {"1"=>{"name"=>"Hue Lamp 1"},
"2"=>{"name"=>"Hue Lamp 2"},
"3"=>{"name"=>"Hue Lamp 3"}}
[8] pry(main)> my_desk = client.light(1)
[9] pry(main)> my_desk.name
=> "Hue Lamp 1"
[10] pry(main)> my_desk.name = "Ken's Desk"
=> "Ken's Desk"
[11] pry(main)> my_desk.bri = 255
=> 255 # and light gets bright
[12] pry(main)> my_desk.bri = 10
=> 10 # and light gets dim
[14] pry(main)> my_desk.hsl = Color::RGB::Orchid.to_hsl
=> HSL [302.26 deg, 58.89%, 64.71%] # and light turns a nice pink color