Class: Guh::DeviceClass
Overview
This class wraps everything related to available Devices.
Class Method Summary collapse
-
.all(options = {}) ⇒ Object
Returns a list of all supported Devices.
-
.find(id) ⇒ Object
Finds a DeviceClass with a specific ID.
Methods inherited from Base
configure, get, guh_ip_address, guh_ip_address=, guh_port, guh_port=, introspect, version
Class Method Details
.all(options = {}) ⇒ Object
Returns a list of all supported Devices.
Example:
Guh::DeviceClass.all
# => a list of all supported devices
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/guh/device_class.rb', line 16 def self.all(={}) params = {} params['vendorId'] = [:vendor_id] unless [:vendor_id].nil? response = get({ id: generate_request_id, method: "Devices.GetSupportedDevices", params: params }) return response['deviceClasses'] end |
.find(id) ⇒ Object
Finds a DeviceClass with a specific ID
Example:
Guh::DeviceClass.find("{2062d64d-3232-433c-88bc-0d33c0ba2ba6}")
# => a list of all supported devices of a specific vendor
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/guh/device_class.rb', line 38 def self.find(id) device_classes = self.all device_class = device_classes.detect{|dc| dc['id']==id} if device_class return device_class else raise DeviceClassNotFound, "Could not find a DeviceClass with the id #{id}" end end |