Method: Jamf::Computer.all

Defined in:
lib/jamf/api/classic/api_objects/computer.rb

.all(refresh = false, api: nil, cnx: Jamf.cnx) ⇒ Array<Hash{:name=>String, :id=> Integer}>

A larger set of info about the computers in the JSS.

Casper 9.4 introduced the API Resource /computers/subset/basic that returns an array of hashes with more data than just /computers/ (which was just :name and :id). Similar to /mobildevices/, this new list includes :udid, :serial_number, and :mac_address, as well as :model, :managed, :building, :department, :username, and :report_date

Because this requires a different, unusual, resource path, we’re completely re-defining APIObject.all for Jamf::Computer. Hopefully some day the original /computers/ resource will be updated to return this data.



315
316
317
318
319
320
321
322
323
324
# File 'lib/jamf/api/classic/api_objects/computer.rb', line 315

def self.all(refresh = false, api: nil, cnx: Jamf.cnx)
  cnx = api if api

  cache = cnx.c_object_list_cache
  cache_key = self::RSRC_LIST_KEY
  cache[cache_key] = nil if refresh
  return cache[cache_key] if cache[cache_key]

  cache[cache_key] = cnx.c_get(self::LIST_RSRC)[cache_key]
end