Class: WemoDevice::Device
- Inherits:
-
Object
- Object
- WemoDevice::Device
- Defined in:
- lib/wemo_device/device.rb
Class Method Summary collapse
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(response) ⇒ Device
constructor
A new instance of Device.
- #location ⇒ Object
- #unique_service_name ⇒ Object
Constructor Details
#initialize(response) ⇒ Device
Returns a new instance of Device.
20 21 22 |
# File 'lib/wemo_device/device.rb', line 20 def initialize(response) @response = response end |
Class Method Details
.lookup ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/wemo_device/device.rb', line 8 def lookup # Wemo devices are responding only when search target is the URN. # `ssdp:all` and other search target doesn't work. SSDP.new.lookup(URN, 3).select do |response| # There are many devices that ignores `ST`, like Philips Hue. response.search_target == URN end.map do |response| Device.new(response) end end |
Instance Method Details
#description ⇒ Object
32 33 34 |
# File 'lib/wemo_device/device.rb', line 32 def description @description ||= Description.new(@response.location) end |
#location ⇒ Object
28 29 30 |
# File 'lib/wemo_device/device.rb', line 28 def location @response.location end |
#unique_service_name ⇒ Object
24 25 26 |
# File 'lib/wemo_device/device.rb', line 24 def unique_service_name @response.unique_service_name end |