class M2X::MQTT::Command
Wrapper for AT&T M2X
Commands API m2x.att.com/developer/documentation/v2/device
Public Class Methods
new(client, attributes)
click to toggle source
# File lib/m2x/mqtt/command.rb, line 7 def initialize(client, attributes) @client = client @attributes = attributes end
Public Instance Methods
path()
click to toggle source
# File lib/m2x/mqtt/command.rb, line 12 def path @path ||= URI.parse(@attributes.fetch("url")).path end
process!(response_data={})
click to toggle source
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
# File lib/m2x/mqtt/command.rb, line 20 def process!(response_data={}) @client.post("#{path}/process", response_data) end
reject!(response_data={})
click to toggle source
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
# File lib/m2x/mqtt/command.rb, line 28 def reject!(response_data={}) @client.post("#{path}/reject", response_data) end