Class: Oschii::GetDevices
- Defined in:
- lib/oschii/servlets.rb
Instance Attribute Summary
Attributes inherited from Servlet
Instance Method Summary collapse
Methods inherited from Servlet
Constructor Details
This class inherits a constructor from Oschii::Servlet
Instance Method Details
#do_GET(req, res) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/oschii/servlets.rb', line 20 def do_GET(req, res) res.status = 200 res.content_type = 'application/json' res.body = cloud.devices.sort_by { |k, _v| k }.map do |name, device| { name: device.name, ip: device.ip, details: device.device_details } end.to_json add_headers res end |