class M2X::MQTT::Resource
Wrapper for M2X::Client resources
Attributes
attributes[R]
Public Class Methods
new(client, attributes)
click to toggle source
# File lib/m2x/mqtt/resource.rb, line 12 def initialize(client, attributes) @client = client @attributes = attributes end
Public Instance Methods
inspect()
click to toggle source
# File lib/m2x/mqtt/resource.rb, line 17 def inspect "<#{self.class.name}: #{attributes.inspect}>" end
path()
click to toggle source
# File lib/m2x/mqtt/resource.rb, line 21 def path raise NotImplementedError end
refresh()
click to toggle source
Refresh the resource details and return self
# File lib/m2x/mqtt/resource.rb, line 35 def refresh view self end
view()
click to toggle source
Return the resource details
# File lib/m2x/mqtt/resource.rb, line 26 def view @client.get(path) res = @client.get_response @attributes = res["body"] if res["status"] < 300 && res["body"] end