Class: M2X::MQTT::Command
Overview
Wrapper for AT&T M2X Commands API m2x.att.com/developer/documentation/v2/device
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#initialize(client, attributes) ⇒ Command
constructor
A new instance of Command.
- #path ⇒ Object
-
#process!(response_data = {}) ⇒ Object
Mark the command as processed, with optional response data.
-
#reject!(response_data = {}) ⇒ Object
Mark the command as rejected, with optional response data.
Methods inherited from Resource
Constructor Details
#initialize(client, attributes) ⇒ Command
Returns a new instance of Command.
7 8 9 10 |
# File 'lib/m2x/mqtt/command.rb', line 7 def initialize(client, attributes) @client = client @attributes = attributes end |
Instance Method Details
#path ⇒ Object
12 13 14 |
# File 'lib/m2x/mqtt/command.rb', line 12 def path @path ||= URI.parse(@attributes.fetch("url")).path end |
#process!(response_data = {}) ⇒ Object
Mark the command as processed, with optional response data. Check the API response after calling to verify success (no status conflict).
m2x.att.com/developer/documentation/v2/commands#Device-Marks-a-Command-as-Processed
20 21 22 |
# File 'lib/m2x/mqtt/command.rb', line 20 def process!(response_data={}) @client.post("#{path}/process", response_data) end |
#reject!(response_data = {}) ⇒ Object
Mark the command as rejected, with optional response data. Check the API response after calling to verify success (no status conflict).
m2x.att.com/developer/documentation/v2/commands#Device-Marks-a-Command-as-Rejected
28 29 30 |
# File 'lib/m2x/mqtt/command.rb', line 28 def reject!(response_data={}) @client.post("#{path}/reject", response_data) end |