Class: Jamf::MobileDevice

Inherits:
APIObject show all
Extended by:
Matchable
Includes:
Creatable, Extendable, Locatable, MDM, ManagementHistory, Purchasable, Sitable, Updatable, Uploadable
Defined in:
lib/jamf/api/classic/api_objects/mobile_device.rb

Overview

This class represents a Mobile Device stored in the JSS.


Adding devices to the JSS

When creating new MobileDevices in the JSS with this class (using make) you must specify a udid, and serial_number before calling ‘create` or `save`. You can provide these values with the `.make` call, or afterward using setters.


Management History & Logs

MobileDevice Management History and logs can now be retrieved both from a MobileDevice instance, and directly via class methods without fetching an instance. This is handled by the mixed-in ManagementHistory module, Q.V. for details.


MDM Commands

See the MDM mixin module for Class and Instance methods for sending MDM commands to mobiledevices.

To send MDM commands without fetching mobiledevice instances, use the class methods, which can take multiple identifiers at once.

NOTE: If the #name= method is used to change the name of a supervized device, the DeviceName MDM command will be sent to the device when the changes are sent to the server via APIObject#save or #update

Constant Summary collapse

RSRC_BASE =

The base for REST resources of this class

'mobiledevices'.freeze
RSRC_LIST_KEY =

the hash key used for the JSON list output of all objects in the JSS

:mobile_devices
RSRC_OBJECT_KEY =

The hash key used for the JSON object output. It’s also used in various error messages

:mobile_device
SITE_SUBSET =

Where is the Site data in the API JSON?

:general
OTHER_LOOKUP_KEYS =

these keys, as well as :id and :name, can be used to look up objects of this class in the JSS the wierd alises wifi_mac_addresse, mac_addresse and macaddresse are for proper pluralization of ‘mac_address’ and such

{
  udid: {
    aliases: %i[uuid guid],
    fetch_rsrc_key: :udid
  },
  serial_number: {
    aliases: %i[serialnumber sn],
    fetch_rsrc_key: :serialnumber
  },
  wifi_mac_address: {
    aliases: %i[
      wifi_macaddr
      mac_address
      macaddr
    ],
    fetch_rsrc_key: :macaddress
  }
}.freeze
HW_PREFIX_TV =
'AppleTV'.freeze
HW_PREFIX_IPAD =
'iPad'.freeze
HW_PREFIX_IPHONE =
'iPhone'.freeze
NON_UNIQUE_NAMES =
true
UPLOAD_TYPES =

file uploads can send attachments to the JSS using :mobiledevices as the sub-resource.

{ attachment: :mobiledevices }.freeze
SEARCH_CLASS =

This class lets us seach for computers

Jamf::AdvancedMobileDeviceSearch
EXT_ATTRIB_CLASS =

This is the class for relevant Extension Attributes

Jamf::MobileDeviceExtensionAttribute
MDM_COMMAND_TARGET =

What kind of devices are we for MDM purposes?

:mobiledevices
OBJECT_HISTORY_OBJECT_TYPE =

the object type for this object in the object history table. See APIObject#add_object_history_entry

21

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ MobileDevice

When creating new records with .make, udid:, serial_number:, and asset_tag: can be provided in the args.



438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 438

def initialize(**args)
  super
  if @in_jss

    gen = @init_data[:general]

    # identifiers
    @serial_number = gen[:serial_number]
    @udid = gen[:udid]
    @asset_tag = gen[:asset_tag]
    @device_id = gen[:device_id]
    @device_name = gen[:device_name]
    @display_name = gen[:display_name]
    @exchange_activesync_device_identifier = gen[:exchange_activesync_device_identifier]

    # settings
    @managed = gen[:managed]
    @supervised = gen[:supervised]
    @device_ownership_level = gen[:device_ownership_level]
    @tethered = gen[:tethered]
    @shared = gen[:shared]
    @ble_capable = gen[:ble_capable]

    @airplay_password = gen[:airplay_password]
    @languages = gen[:languages]
    @locales = gen[:locales]

    # software
    @os_type = gen[:os_type]
    @os_build = gen[:os_build]
    @os_version = gen[:os_version]
    @modem_firmware = gen[:modem_firmware]

    # hardware
    @model = gen[:model]
    @model_number = gen[:model_number]
    @model_identifier = gen[:model_identifier]
    @model_display = gen[:model_display]

    # usage
    @capacity_mb = gen[:capacity_mb]
    @available_mb = gen[:available_mb]
    @percentage_used = gen[:percentage_used]
    @battery_level = gen[:battery_level]

    # network
    @bluetooth_mac_address = gen[:bluetooth_mac_address]
    @wifi_mac_address = gen[:wifi_mac_address]
    @sim_phone_number = gen[:phone_number]
    @ip_address = gen[:ip_address]

    # timestamps
    @initial_entry_date = JSS.epoch_to_time gen[:initial_entry_date_epoch]
    @last_backup_time = JSS.epoch_to_time gen[:last_backup_time_epoch]
    @last_cloud_backup_date = JSS.epoch_to_time gen[:last_cloud_backup_date_epoch]
    @last_inventory_update = JSS.epoch_to_time gen[:last_inventory_update_epoch]
    @last_enrollment = JSS.epoch_to_time gen[:last_enrollment_epoch]

    # subsets
    @mobile_device_groups = @init_data[:mobile_device_groups]
    @network = @init_data[:network]
    @extension_attributes = @init_data[:extension_attributes]
    @certificates = @init_data[:certificates]
    @configuration_profiles = @init_data[:configuration_profiles]
    @provisioning_profiles = @init_data[:provisioning_profiles]
    @security = @init_data[:security]
    @applications = @init_data[:applications]
  else
    @udid = args[:udid]
    @serial_number = args[:serial_number]
    @asset_tag = args[:asset_tag]
  end
end

Instance Attribute Details

#airplay_passwordString (readonly)

Returns the airplay passwd on devices that can receive AirPlay (i.e. apple tvs).

Returns:

  • (String)

    the airplay passwd on devices that can receive AirPlay (i.e. apple tvs)



264
265
266
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 264

def airplay_password
  @airplay_password
end

#applecare_idString Originally defined in module Purchasable

Returns:

#applicationsArray<Hash> (readonly)

Returns the applications on the device.

Returns:

  • (Array<Hash>)

    the applications on the device



359
360
361
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 359

def applications
  @applications
end

#asset_tagString

Returns:



226
227
228
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 226

def asset_tag
  @asset_tag
end

#available_mbIntger (readonly) Also known as: available

Returns how much space available on the device?.

Returns:

  • (Intger)

    how much space available on the device?



306
307
308
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 306

def available_mb
  @available_mb
end

#battery_levelInteger (readonly) Also known as: battery_percent

Returns what percentage of the battery is remaining.

Returns:

  • (Integer)

    what percentage of the battery is remaining



317
318
319
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 317

def battery_level
  @battery_level
end

#ble_capableBoolean (readonly)

Returns is this device ble_capable?.

Returns:

  • (Boolean)

    is this device ble_capable?



261
262
263
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 261

def ble_capable
  @ble_capable
end

#bluetooth_mac_addressString (readonly)

Returns the bluetooth mac addr.

Returns:

  • (String)

    the bluetooth mac addr



324
325
326
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 324

def bluetooth_mac_address
  @bluetooth_mac_address
end

#buildingString Originally defined in module Locatable

Returns:

#capacity_mbInteger (readonly) Also known as: capacity

Returns total storage on the device.

Returns:

  • (Integer)

    total storage on the device



310
311
312
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 310

def capacity_mb
  @capacity_mb
end

#certificatesArray<Hash> (readonly)

The certificates on the device

Each has has two keys:

  • :identity => Boolean

  • :common_name => String, possibly a udid

Returns:



368
369
370
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 368

def certificates
  @certificates
end

#configuration_profilesArray<Hash> (readonly)

One for each ConfigurationProfile on the device

The Hash keys are:

  • :identifier => a unique id, often the sams as the uuid

  • :display_name => its name in the JSS

  • :uuid => the ConfigurationProfile uuid

  • :version => a String

Returns:



379
380
381
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 379

def configuration_profiles
  @configuration_profiles
end

#departmentString Originally defined in module Locatable

Returns:

#device_idString (readonly)

Returns An Apple TV identifier.

Returns:

  • (String)

    An Apple TV identifier



235
236
237
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 235

def device_id
  @device_id
end

#device_nameString (readonly)

Returns:



232
233
234
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 232

def device_name
  @device_name
end

#device_ownership_levelString (readonly)

Returns the device_ownership_level.

Returns:

  • (String)

    the device_ownership_level



252
253
254
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 252

def device_ownership_level
  @device_ownership_level
end

#display_nameString (readonly)

Returns:



229
230
231
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 229

def display_name
  @display_name
end

#email_addressString Originally defined in module Locatable

Returns:

#exchange_activesync_device_identifierString (readonly)

Returns:



238
239
240
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 238

def exchange_activesync_device_identifier
  @exchange_activesync_device_identifier
end

#extension_attributesArray<Hash> (readonly) Originally defined in module Extendable

Returns The extension attribute values for the object.

Returns:

  • (Array<Hash>)

    The extension attribute values for the object

#initial_entry_dateTime (readonly)

Returns uses the value from the API’s initial_entry_date_epoch.

Returns:

  • (Time)

    uses the value from the API’s initial_entry_date_epoch



340
341
342
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 340

def 
  @initial_entry_date
end

#ip_addressString (readonly)

Returns the IP addr.

Returns:



330
331
332
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 330

def ip_address
  @ip_address
end

#is_leasedBoolean Also known as: leased? Originally defined in module Purchasable

Returns:

  • (Boolean)

#is_purchasedBoolean Also known as: purchased? Originally defined in module Purchasable

Returns:

  • (Boolean)

#languagesString (readonly)

Returns the languages.

Returns:



267
268
269
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 267

def languages
  @languages
end

#last_backup_timeTime (readonly) Also known as: last_backup_date, last_backup

Returns uses the value from the API’s last_backup_time_epoch.

Returns:

  • (Time)

    uses the value from the API’s last_backup_time_epoch



343
344
345
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 343

def last_backup_time
  @last_backup_time
end

#last_cloud_backup_dateTime (readonly)

Returns last_cloud_backup_date.

Returns:

  • (Time)

    last_cloud_backup_date



354
355
356
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 354

def last_cloud_backup_date
  @last_cloud_backup_date
end

#last_enrollmentTime (readonly)

Returns the last time this device enrolled in Jamf.

Returns:

  • (Time)

    the last time this device enrolled in Jamf



351
352
353
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 351

def last_enrollment
  @last_enrollment
end

#last_inventory_updateTime (readonly)

Returns uses the value from the API’s last_inventory_update_utc.

Returns:

  • (Time)

    uses the value from the API’s last_inventory_update_utc



348
349
350
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 348

def last_inventory_update
  @last_inventory_update
end

#lease_expiresTime Originally defined in module Purchasable

Returns:

#life_expectancyInteger Originally defined in module Purchasable

Returns:

  • (Integer)

#localesString (readonly)

Returns the locales.

Returns:



270
271
272
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 270

def locales
  @locales
end

#managedBoolean (readonly) Also known as: managed?

Returns is this device managed?.

Returns:

  • (Boolean)

    is this device managed?



244
245
246
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 244

def managed
  @managed
end

#mobile_device_groupsArray<Hash> (readonly)

One for each group to which the device belongs

The Hash keys are:

  • :name => the group name

  • :id => the group id in the JSS

Returns:



388
389
390
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 388

def mobile_device_groups
  @mobile_device_groups
end

#modelString (readonly)

Returns the display name of the model.

Returns:

  • (String)

    the display name of the model



291
292
293
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 291

def model
  @model
end

#model_displayString (readonly)

Returns the display name of the model.

Returns:

  • (String)

    the display name of the model



297
298
299
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 297

def model_display
  @model_display
end

#model_identifierString (readonly)

Returns the model identifier.

Returns:

  • (String)

    the model identifier



300
301
302
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 300

def model_identifier
  @model_identifier
end

#model_numberString (readonly)

Returns the display name of the model.

Returns:

  • (String)

    the display name of the model



294
295
296
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 294

def model_number
  @model_number
end

#modem_firmwareString (readonly)

Returns the model firmware.

Returns:

  • (String)

    the model firmware



276
277
278
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 276

def modem_firmware
  @modem_firmware
end

#need_to_updateBoolean (readonly) Originally defined in module Updatable

Returns do we have unsaved changes?.

Returns:

  • (Boolean)

    do we have unsaved changes?

#networkHash (readonly)

A Hash of network data

The Hash keys are:

  • :voice_roaming_enabled=>“Disabled”,

  • :current_mobile_network_code=>“nnn”,

  • :imei=>“nn nnnnnn nnnnnn n”,

  • :home_mobile_country_code=>“nnn”,

  • :iccid=>“nnnn nnnn nnnn nnnn nnnn”,

  • :home_mobile_network_code=>“nnn”,

  • :current_carrier_network=>“”,

  • :data_roaming_enabled=>false,

  • :home_carrier_network=>“AT&T”,

  • :carrier_settings_version=>“16.0”,

  • :roaming=>false,

  • :cellular_technology=>“GSM”,

  • :current_mobile_country_code=>“nnn”

Returns:



408
409
410
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 408

def network
  @network
end

#os_buildString (readonly)

Returns the OS build.

Returns:



282
283
284
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 282

def os_build
  @os_build
end

#os_typeString (readonly)

Returns the OS type.

Returns:



285
286
287
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 285

def os_type
  @os_type
end

#os_versionString (readonly)

Returns the OS version.

Returns:



279
280
281
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 279

def os_version
  @os_version
end

#percentage_usedInteger (readonly)

Returns how much of the capacity is in use?.

Returns:

  • (Integer)

    how much of the capacity is in use?



314
315
316
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 314

def percentage_used
  @percentage_used
end

#phoneString Originally defined in module Locatable

Returns:

#po_dateTime Originally defined in module Purchasable

Returns:

#po_numberString Originally defined in module Purchasable

Returns:

#positionString Originally defined in module Locatable

Returns:

#provisioning_profilesArray<Hash> (readonly)

One per provisioning profile

Returns:



414
415
416
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 414

def provisioning_profiles
  @provisioning_profiles
end

#purchase_priceFloat Originally defined in module Purchasable

Returns:

  • (Float)

#purchasing_accountString Originally defined in module Purchasable

Returns:

#purchasing_contactString Originally defined in module Purchasable

Returns:

#real_nameString Originally defined in module Locatable

Returns:

#roomString Originally defined in module Locatable

Returns:

#securityHash (readonly)

A Hash of security data

The Hash has these keys, all of which are Boolean

  • :passcode_present=>true,

  • :passcode_compliant=>true,

  • :passcode_compliant_with_profile=>true,

  • :data_protection=>true,

  • :block_level_encryption_capable=>true,

  • :file_level_encryption_capable=>true

Returns:



427
428
429
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 427

def security
  @security
end

#serial_numberString Also known as: sn, serialnumber

Returns:



218
219
220
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 218

def serial_number
  @serial_number
end

#sharedBoolean (readonly)

Returns is this device shared?.

Returns:

  • (Boolean)

    is this device shared?



258
259
260
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 258

def shared
  @shared
end

#sim_phone_numberString (readonly) Also known as: device_phone_number

Returns the phone number of the device’s SIM card.

Returns:

  • (String)

    the phone number of the device’s SIM card



333
334
335
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 333

def sim_phone_number
  @sim_phone_number
end

#supervisedBoolean (readonly) Also known as: supervised?

Returns is this device supervised?.

Returns:

  • (Boolean)

    is this device supervised?



248
249
250
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 248

def supervised
  @supervised
end

#tetheredString (readonly)

Returns the tether state of the device.

Returns:

  • (String)

    the tether state of the device



255
256
257
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 255

def tethered
  @tethered
end

#udidString

Returns:



223
224
225
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 223

def udid
  @udid
end

#usernameString Also known as: user Originally defined in module Locatable

Returns:

#vendorString Originally defined in module Purchasable

Returns:

#warranty_expiresTime Originally defined in module Purchasable

Returns:

#wifi_mac_addressString (readonly)

Returns the wifi mac addr.

Returns:

  • (String)

    the wifi mac addr



327
328
329
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 327

def wifi_mac_address
  @wifi_mac_address
end

Class Method Details

.all_apple_tvs(refresh = false, api: nil, cnx: Jamf.cnx) ⇒ Array<Hash>

Returns the list of all iPads.

Returns:



202
203
204
205
206
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 202

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

  all(refresh, cnx: cnx).select { |d| d[:model_identifier].start_with? 'AppleTV' }
end

.all_ipads(refresh = false, api: nil, cnx: Jamf.cnx) ⇒ Array<Hash>

Returns the list of all iPads.

Returns:



195
196
197
198
199
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 195

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

  all(refresh, cnx: cnx).select { |d| d[:model].start_with? 'iPad' }
end

.all_iphones(refresh = false, api: nil, cnx: Jamf.cnx) ⇒ Array<Hash>

Returns the list of all iPhones.

Returns:



188
189
190
191
192
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 188

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

  all(refresh, cnx: cnx).select { |d| d[:model].start_with? 'iPhone' }
end

.all_managed(refresh = false, api: nil, cnx: Jamf.cnx) ⇒ Array<Hash>

Returns the list of all managed mobile devices.

Returns:

  • (Array<Hash>)

    the list of all managed mobile devices



160
161
162
163
164
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 160

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

  all(refresh, cnx: cnx).select { |d| d[:managed] }
end

.all_phone_numbers(refresh = false, api: nil, cnx: Jamf.cnx) ⇒ Array<String>

Returns all mobiledevice phone numbers.

Returns:



153
154
155
156
157
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 153

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

  all(refresh, cnx: cnx).map { |i| i[:phone_number] }.reject(&:empty?)
end

.all_supervised(refresh = false, api: nil, cnx: Jamf.cnx) ⇒ Array<Hash>

Returns the list of all supervised mobile devices.

Returns:

  • (Array<Hash>)

    the list of all supervised mobile devices



174
175
176
177
178
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 174

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

  all(refresh, cnx: cnx).select { |d| d[:supervised] }
end

.all_unmanaged(refresh = false, api: nil, cnx: Jamf.cnx) ⇒ Array<Hash>

Returns the list of all unmanaged mobile devices.

Returns:

  • (Array<Hash>)

    the list of all unmanaged mobile devices



167
168
169
170
171
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 167

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

  all(refresh, cnx: cnx).reject { |d| d[:managed] }
end

.all_unsupervised(refresh = false, api: nil, cnx: Jamf.cnx) ⇒ Array<Hash>

Returns the list of all unsupervised mobile devices.

Returns:

  • (Array<Hash>)

    the list of all unsupervised mobile devices



181
182
183
184
185
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 181

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

  all(refresh, cnx: cnx).reject { |d| d[:supervised] }
end

.match(term, api: nil, cnx: Jamf.cnx) ⇒ Array<Hash> Originally defined in module Matchable

Perform a match, returning an Array of Hashes, one for each item matched

At the moment, it appears the search is an “exact match” search regardless of the prefs of the user connected to the API.

Parameters:

  • term (String)

    the term to match.

Returns:

Raises:

Instance Method Details

#app_store_app_history(status = nil) ⇒ Object Also known as: managed_app_history Originally defined in module ManagementHistory

Wrapper for app store history for both computers and mobile devices

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#audit_historyObject Also known as: audits Originally defined in module ManagementHistory

The audit_history for this object

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#blank_pushvoid Also known as: send_blank_push, noop Originally defined in module MDM

This method returns an undefined value.

Send a blank push to this object

#casper_imaging_logsObject Originally defined in module ManagementHistory

The casper_imaging_logs for this computer

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#casper_remote_logsObject Originally defined in module ManagementHistory

The casper_remote_logs for this computer

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#clear_locationvoid Originally defined in module Locatable

This method returns an undefined value.

Clear all location data

#clear_passcodeObject Originally defined in module MDM

Send an clear_passcode command to this object

#clear_restrictions_passwordObject Originally defined in module MDM

Send an clear_restrictions_password command to this object

#clone(new_name, api: nil, cnx: nil) ⇒ APIObject Originally defined in module Creatable

make a clone of this API object, with a new name. The class must be creatable

Parameters:

  • name (String)

    the name for the new object

  • cnx (Jamf::Connection) (defaults to: nil)

    the API in which to create the object Defaults to the API used to instantiate this object

Returns:

  • (APIObject)

    An unsaved clone of this APIObject with the given name

Raises:

#completed_mdm_commandsObject Also known as: completed_commands Originally defined in module ManagementHistory

The completed_mdm_commands for this object

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#completed_policiesObject Originally defined in module ManagementHistory

The array from .policy_logs, limited to status = :completed

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#computer_usage_logsObject Also known as: usage_logs Originally defined in module ManagementHistory

The computer_usage_logs for this computer

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#delete_user(user) ⇒ Object Originally defined in module MDM

Send a delete_user command to this computer or group

Parameters:

  • user (String)

    the username of the acct to delete

#device_lock(passcode_or_message = '') ⇒ Object Also known as: lock, lock_device Originally defined in module MDM

Send a dev lock to this object

Parameters:

  • passcode_or_message (String) (defaults to: '')

    a six-char passcode, required for computers & computergroups Or an optional message to display on mobiledevices & mobiledevicegroups

#disable_app_analyticsObject Originally defined in module MDM

Send a disable_app_analytics command to this object

#disable_data_roamingObject Originally defined in module MDM

Send a disable_data_roaming command to this object

#disable_diagnostic_submissionObject Originally defined in module MDM

Send a disable_diagnostic_submission command to this object

#disable_lost_modeObject Originally defined in module MDM

Send a disable_lost_mode command to this object

#disable_remote_desktopObject Originally defined in module MDM

Send a disable_remote_desktop command to this computer or group

#disable_voice_roamingObject Originally defined in module MDM

Send a disable_voice_roaming command to this object

#ea_namesArray<String> Originally defined in module Extendable

Returns the names of all known EAs.

Returns:

#ea_typesHash{String => String} Originally defined in module Extendable

Returns EA names => data type (one of ‘String’, ‘Number’, or ‘Date’).

Returns:

  • (Hash{String => String})

    EA names => data type (one of ‘String’, ‘Number’, or ‘Date’)

#ebook_history(status = nil) ⇒ Object Also known as: managed_ebook_history Originally defined in module ManagementHistory

The ebook_history for this mobile device

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#enable_app_analyticsObject Originally defined in module MDM

Send an enable_app_analytics command to this object

#enable_data_roamingObject Originally defined in module MDM

Send an enable_data_roaming command to this object

#enable_diagnostic_submissionObject Originally defined in module MDM

Send an enable_diagnostic_submission command to this object

#enable_lost_mode(message: nil, phone: nil, footnote: nil, enforce_lost_mode: false, play_sound: false) ⇒ Object Originally defined in module MDM

Send a enable_lost_mode command to one or more targets

Either or both of message and phone number must be provided

Parameters:

  • message (String) (defaults to: nil)

    The message to display on the lock screen

  • phone_number (String)

    The phone number to display on the lock screen

  • footnote (String) (defaults to: nil)

    Optional footnote to display on the lock screen

  • play_sound (Boolean) (defaults to: false)

    Play a sound when entering lost mode

  • enforce_lost_mode (Boolean) (defaults to: false)

    Re-enable lost mode when re-enrolled after wipe. Default is false

#enable_remote_desktopObject Originally defined in module MDM

Send an enable_remote_desktop command to this computer or group

#enable_voice_roamingObject Originally defined in module MDM

Send an enable_voice_roaming command to this object

#erase_device(passcode = '', preserve_data_plan: false) ⇒ Object Also known as: wipe_device, wipe_computer, wipe, erase Originally defined in module MDM

Send an erase device command to this object

Parameters:

  • passcode (String) (defaults to: '')

    a six-char passcode, required for computers & computergroups

#ext_attr_xmlREXML::Element Originally defined in module Extendable

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

TODO: make this (and all XML amending) method take the in-progress XML doc and add (or not) the EA xml to it. See how Sitable#add_site_to_xml works, as called from Computer.rest_xml

Returns:

  • (REXML::Element)

    An <extension_attribute> element to be included in the rest_xml of objects that mix-in this module.

#ext_attrsObject Originally defined in module Extendable

An easier-to-use hash of EA name to EA value. This isn’t created until its needed, to speed up instantiation.

#failed_app_store_appsObject Also known as: failed_managed_apps Originally defined in module ManagementHistory

shortcut for app_store_app_history where status = :failed

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#failed_ebooksObject Also known as: failed_managed_ebooks Originally defined in module ManagementHistory

shortcut for ebook_history where status = :failed

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#failed_mdm_commandsObject Also known as: failed_commands Originally defined in module ManagementHistory

The failed_mdm_commands for this object

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#failed_policiesObject Originally defined in module ManagementHistory

The array from .policy_logs, limited to status = :failed

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#flush_mdm_commands(status) ⇒ void Originally defined in module MDM

This method returns an undefined value.

flush pending and/or failed MDM commands for this object

Parameters:

  • status (String)

    a key from Commandable::FLUSHABLE_STATUSES

#has_location?Boolean Originally defined in module Locatable

Returns Does this item have location data?.

Returns:

  • (Boolean)

    Does this item have location data?

#has_purchasing?Boolean Originally defined in module Purchasable

Returns does this item have any purchasing info?.

Returns:

  • (Boolean)

    does this item have any purchasing info?

#installed_app_store_appsObject Also known as: installed_managed_apps Originally defined in module ManagementHistory

shortcut for app_store_app_history where status = :installed

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#installed_ebooksObject Also known as: installed_managed_ebooks Originally defined in module ManagementHistory

shortcut for ebook_history where status = :installed

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#ipad?Boolean

Returns:

  • (Boolean)


517
518
519
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 517

def ipad?
  model_identifier.start_with? HW_PREFIX_IPAD
end

#iphone?Boolean

Returns:

  • (Boolean)


521
522
523
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 521

def iphone?
  model_identifier.start_with? HW_PREFIX_IPHONE
end

#last_mdm_contactObject Originally defined in module ManagementHistory

The time of the last completed mdm command for this object

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#locationHash<String> Originally defined in module Locatable

All the location data in a Hash, as it comes from the API.

The reason it isn’t stored this way is to prevent editing of the hash directly.

Returns:

#location_xmlREXML::Element Originally defined in module Locatable

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return a REXML <location> element to be included in the rest_xml of objects that have a Location subset

Returns:

  • (REXML::Element)

#mac_app_store_app_history(status = nil) ⇒ Object Originally defined in module ManagementHistory

The mac_app_store_app_history for this computer

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#management_history(subset = nil) ⇒ Object Also known as: history Originally defined in module ManagementHistory

The raw management history data for this object

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#mdm_command_history(status = nil) ⇒ Object Also known as: commands, management_command_history Originally defined in module ManagementHistory

The mdm_command_history for this object

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#mobile_device_app_history(status = nil) ⇒ Object Originally defined in module ManagementHistory

The mobile_device_app_history for this mobile device

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#name=(new_name) ⇒ Object



525
526
527
528
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 525

def name=(new_name)
  super
  @needs_mdm_name_change = true if managed? && supervised?
end

#parse_ext_attrsvoid Originally defined in module Extendable

This method returns an undefined value.

Populate @extension_attributes (the Array of Hashes that comes from the API) and @ext_attr_names, which is a Hash mapping the EA names to their values. This is called during initialization for all objects that mix in this module

#parse_locationvoid Originally defined in module Locatable

This method returns an undefined value.

Call this during initialization of objects that have a Location subset and the location attributes will be populated (as primary attributes) from @init_data

#parse_purchasingObject Originally defined in module Purchasable

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Call this during initialization of objects that have a Purchasing subset and the purchasing attribute will be populated from @init_data

#passcode_lock_grace_period(secs) ⇒ Object Originally defined in module MDM

Send a passcode_lock_grace_period command to this object

Parameters:

  • secs (Integer)

    The numer of seconds for the grace period

#pending_app_store_appsObject Also known as: pending_managed_apps Originally defined in module ManagementHistory

shortcut for app_store_app_history where status = :pending

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#pending_ebooksObject Also known as: pending_managed_ebooks Originally defined in module ManagementHistory

shortcut for ebook_history where status = :pending

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#pending_mdm_commandsObject Also known as: pending_commands Originally defined in module ManagementHistory

The pending_mdm_commands for this object

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#play_lost_mode_soundObject Originally defined in module MDM

Send a play_lost_mode_sound command to this object

#policy_logsObject Originally defined in module ManagementHistory

The policy_logs for this computer

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#purchasingHash<String> Originally defined in module Purchasable

All the purchasing data in a Hash, as it comes from the API.

The reason it isn’t stored this way is to prevent editing of the hash directly.

Returns:

#purchasing_xmlREXML::Element Originally defined in module Purchasable

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns A <purchasing> element to be included in the rest_xml of objects that mix-in this module.

Returns:

  • (REXML::Element)

    A <purchasing> element to be included in the rest_xml of objects that mix-in this module.

#restart_deviceObject Also known as: restart Originally defined in module MDM

Send a restart_device command to this object

#screen_sharing_logsObject Originally defined in module ManagementHistory

The screen_sharing_logs for this computer

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#set_ext_attr(ea_name, value, validate_popup_choice: true, refresh: false) ⇒ void Originally defined in module Extendable

This method returns an undefined value.

Set the value of an extension attribute

The new value is validated based on the data type of the Ext. Attrib:

  • If the ext. attrib. is defined with a data type of Integer/Number, the value must be an Integer.

  • If defined with a data type of Date, the value will be parsed as a timestamp, and parsing may raise an exception. Dates can’t be blank.

  • If defined wth data type of String, ‘to_s` will be called on the value.

By default, the full EA definition object is fetched to see if the EA’s input type is ‘popup menu’, and if so, the new value must be one of the defined popup choices, or blank.

The EA definitions used for popup validation are cached, so we don’t have to reach out to the server every time. If you expect the definition to have changed since it was cached, provide a truthy value to the refresh: parameter

To bypass popup validation complepletely, provide a falsey value to the validate_popup_choice: parameter. WARNING: beware that your value is the correct type and format, or you might get errors when saving back to the API.

Note that while the Jamf Pro Web interface does not allow editing the values of Extension Attributes populated by Scripts or LDAP, the API does allow it. Bear in mind however that those values will be reset again at the next recon.

Parameters:

  • name (String)

    the name of the extension attribute to set

  • value (String, Time, Integer)

    the new value for the extension attribute for this user

  • validate_popup_choice (Boolean) (defaults to: true)

    validate the new value against the E.A. definition. Defaults to true.

  • refresh (Boolean) (defaults to: false)

    Re-read the ext. attrib definition from the API, for popup validation.

Raises:

  • (ArgumentError)

#shut_down_deviceObject Also known as: shutdown_device, shut_down, shutdown Originally defined in module MDM

Send a shut_down_device command to this object

#site=(new_site) ⇒ void Originally defined in module Sitable

This method returns an undefined value.

Change the site of this object. Any of the NON_SITES values will unset the site

Parameters:

  • new_site (Integer, String)

    The new site

Raises:

#site_assigned?Boolean Originally defined in module Sitable

Does this object have a site assigned?

Returns:

  • (Boolean)

    Does this object have a site assigned?

#site_idInteger Originally defined in module Sitable

The id of the site for this object.

Returns:

  • (Integer)

    The id of the site for this object.

#site_nameString Also known as: site Originally defined in module Sitable

The name of the site for this object. For backward compatibility, this is aliased to just ‘site’

Returns:

  • (String)

    The name of the site for this object.

#site_objectJamf::Site Originally defined in module Sitable

The Jamf::Site instance for this object’s site

Returns:

  • (Jamf::Site)

    The Jamf::Site instance for this object’s site

#tv?Boolean Also known as: apple_tv?

initialize

Returns:

  • (Boolean)


512
513
514
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 512

def tv?
  model_identifier.start_with? HW_PREFIX_TV
end

#unlock_user_account(user) ⇒ Object Originally defined in module MDM

Send an unlock_user_account command to this computer or group

Parameters:

  • user (String)

    the username of the acct to unlock

#unmanage_deviceObject Also known as: remove_mdm_profile Originally defined in module MDM

Send an unmanage device command to this object

NOTE: when used with computers, the mdm profile will probably be re-installed immediately unless the computer is also no longer managed by Jamf Pro itself. To fully unmanage a computer, use the Computer#make_unmanaged instance method.

#unsaved_eas?Boolean Originally defined in module Extendable

are there any changes in the EAs needing to be saved?

Returns:

  • (Boolean)

#unset_sitevoid Originally defined in module Sitable

This method returns an undefined value.

Set the site to nothing

#update(no_mdm_rename: false) ⇒ Object

Parameters:

  • no_mdm_rename (Boolean) (defaults to: false)

    should a MDM ‘set device name` command be sent if the device is managed and supervised?



554
555
556
557
558
559
560
561
# File 'lib/jamf/api/classic/api_objects/mobile_device.rb', line 554

def update(no_mdm_rename: false)
  super()
  return @id if no_mdm_rename || !@needs_mdm_name_change

  set_device_name @name if managed? && supervised?
  @needs_mdm_name_change = false
  @id
end

#update_inventoryObject Also known as: recon Originally defined in module MDM

Send an update_inventory command to this object

#upload(type, local_file, force_ipa_upload: false) ⇒ Boolean Originally defined in module Uploadable

instance method wrapper for class method

Upload a file to the JSS to be stored with this instance of the class mixing in the Uploadable module

Parameters:

  • type (Symbol)

    the type of upload happening. Must be one of the keys defined in the class’s UPLOAD_TYPES Hash.

  • local_file (String, Pathname)

    String or Pathname pointing to the locally-readable file to be uploaded.

  • force_ipa_upload (Boolean) (defaults to: false)

    Should the server upload the .ipa file to JCDS or AWS if such are confgured for use?

Returns:

  • (Boolean)

    was the upload successful?

Raises:

#user_location_historyObject Originally defined in module ManagementHistory

The user_location_history for this object

See Also:

  • matching method in {Jamf::ManagementHistory::ClassMethods}

#validate_ea_value(ea_name, value, validate_popup_choice, refresh) ⇒ Object Originally defined in module Extendable

is the value being passed to set_ext_attr valid? Converts values as needed (e.g. strings to integers or Times)

If the EA is defined to hold a string, any value is accepted and converted with #to_s

Note: All EAs can be blank

Parameters:

  • name (String)

    the name of the extension attribute to set

  • value (String, Time, Integer)

    the new value for the extension attribute for this user

  • validate_popup_choice (Boolean)

    validate the new value against the E.A. definition. Defaults to true.

  • refresh (Boolean)

    Re-read the ext. attrib definition from the API, for popup validation.

Returns:

  • (Object)

    the possibly modified valid value

#validate_integer_ea_value(ea_name, value) ⇒ Object Originally defined in module Extendable

raise error if the value isn’t an integer

#validate_popup_value(ea_name, value, refresh) ⇒ Object Originally defined in module Extendable

Raise an error if the named EA has a popup menu, but the provided value isn’t one of the menu items

#wallpaper(wallpaper_setting: nil, wallpaper_content: nil, wallpaper_id: nil) ⇒ Object Also known as: set_wallpaper Originally defined in module MDM

Send a wallpaper command to this object

Parameters:

  • wallpaper_setting (Symbol) (defaults to: nil)

    :lock_screen, :home_screen, or :lock_and_home_screen

  • wallpaper_content (String, Pathname) (defaults to: nil)

    The local path to a .png or .jpg to use as the walpaper image, required if no wallpaper_id

  • wallpaper_id (Symbol) (defaults to: nil)

    The id of an Icon in Jamf Pro to use as the wallpaper image, required if no wallpaper_content