Class: M2X::MQTT::Distribution
- Defined in:
- lib/m2x/mqtt/distribution.rb
Overview
Wrapper for AT&T M2X Distribution API m2x.att.com/developer/documentation/v2/distribution
Constant Summary collapse
- PATH =
"/distributions"
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#add_device(serial) ⇒ Object
Add a new device to an existing distribution.
- #path ⇒ Object
Methods inherited from Resource
#initialize, #inspect, #refresh, #view
Constructor Details
This class inherits a constructor from M2X::MQTT::Resource
Instance Method Details
#add_device(serial) ⇒ Object
Add a new device to an existing distribution
Accepts a ‘serial` parameter, that must be a unique identifier within this distribution.
m2x.att.com/developer/documentation/v2/distribution#Add-Device-to-an-existing-Distribution
17 18 19 |
# File 'lib/m2x/mqtt/distribution.rb', line 17 def add_device(serial) @client.post("#{path}/devices", serial: serial) end |
#path ⇒ Object
7 8 9 |
# File 'lib/m2x/mqtt/distribution.rb', line 7 def path @path ||= "#{ PATH }/#{ URI.encode(@attributes.fetch("id")) }" end |