Class: Jess::MobileDevices

Inherits:
Object
  • Object
show all
Defined in:
lib/jess/mobile_devices.rb

Overview

Mobile device-related JSS API operations

Instance Attribute Summary collapse

Instance Method Summary collapse

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_clientObject (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_idsObject

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