Class: Jess::MobileDevices
- Inherits:
-
Object
- Object
- Jess::MobileDevices
- Defined in:
- lib/jess/mobile_devices.rb
Overview
Mobile device-related JSS API operations
Instance Attribute Summary collapse
-
#http_client ⇒ Object
readonly
Returns the value of attribute http_client.
Instance Method Summary collapse
-
#all_ids ⇒ Object
Get all mobile device IDs.
-
#find(id) ⇒ Object
Retrieve a mobile device by ID.
-
#initialize(http_client) ⇒ MobileDevices
constructor
A new instance of MobileDevices.
Constructor Details
#initialize(http_client) ⇒ MobileDevices
Returns a new instance of MobileDevices.
8 9 10 |
# File 'lib/jess/mobile_devices.rb', line 8 def initialize(http_client) @http_client = http_client end |
Instance Attribute Details
#http_client ⇒ Object (readonly)
Returns the value of attribute http_client.
6 7 8 |
# File 'lib/jess/mobile_devices.rb', line 6 def http_client @http_client end |
Instance Method Details
#all_ids ⇒ Object
Get all mobile device IDs.
19 20 21 22 |
# File 'lib/jess/mobile_devices.rb', line 19 def all_ids json = JSON.parse(http_client.get("mobiledevices")) json["mobile_devices"].map { |c| c["id"] } end |
#find(id) ⇒ Object
Retrieve a mobile device by ID.
13 14 15 16 |
# File 'lib/jess/mobile_devices.rb', line 13 def find(id) json = JSON.parse(http_client.get("mobiledevices/id/#{id}")) MobileDevice.new(json.fetch("mobile_device")) end |