Class: AgentStatusBulb::Bulb
- Inherits:
-
Object
- Object
- AgentStatusBulb::Bulb
- Defined in:
- lib/agent_status_bulb/bulb.rb
Class Method Summary collapse
Instance Method Summary collapse
- #blue ⇒ Object
- #green ⇒ Object
-
#initialize(device) ⇒ Bulb
constructor
A new instance of Bulb.
- #off ⇒ Object
- #orange ⇒ Object
Constructor Details
#initialize(device) ⇒ Bulb
Returns a new instance of Bulb.
12 13 14 |
# File 'lib/agent_status_bulb/bulb.rb', line 12 def initialize(device) @device = device end |
Class Method Details
.from_config(config) ⇒ Object
7 8 9 10 |
# File 'lib/agent_status_bulb/bulb.rb', line 7 def self.from_config(config) client = Switchbot::Client.new(config.fetch(:token), config.fetch(:secret)) new(client.color_bulb(config.fetch(:device_id))) end |
Instance Method Details
#blue ⇒ Object
16 17 18 |
# File 'lib/agent_status_bulb/bulb.rb', line 16 def blue apply_color('0:0:255') end |
#green ⇒ Object
24 25 26 |
# File 'lib/agent_status_bulb/bulb.rb', line 24 def green apply_color('0:255:0') end |
#off ⇒ Object
28 29 30 |
# File 'lib/agent_status_bulb/bulb.rb', line 28 def off @device.off end |
#orange ⇒ Object
20 21 22 |
# File 'lib/agent_status_bulb/bulb.rb', line 20 def orange apply_color('255:125:0') end |