Class: JSS::MobileDevice

Inherits:
APIObject show all
Extended by:
Matchable
Includes:
Extendable, Locatable, Purchasable, Updatable, Uploadable
Defined in:
lib/jss-api/api_object/mobile_device.rb,
lib/jss-api.rb

Overview

This class represents a Mobile Device stored in the JSS.


Adding devices to the JSS

This class cannot be used to add new mobile devices to the JSS. That can only be done via the enrollment process. See JSS::MobileDeviceInvitation for sending an enrollment invite to a device.


Editing values

Only a few values can be changed via the API, using these methods, q.v:

  • #asset_tag= String

  • #extension_attribute= Hash of :name or :id, and :value

  • #location= Hash of values in @location, not all are required

  • #purchasing= Hash of values in @purchasing, not all are required

After modfying any values, #save must be called to save changes to the JSS.


MDM Commands

The following methods can be used to send an APNS command to the device represented by an instance of JSS::MobileDevice, equivalent to clicking one of the buttons on the Management Commands section of the Management tab of the Mobile Device details page in the JSS UI.

The methods supported are:

  • blank_push (aliases blank, noop, send_blank_push)

  • update_inventory (alias recon)

  • device_lock (aliases lock, lock_device)

  • erase_device (aliases wipe)

  • clear_passcode

  • unmanage_device (alias unmanage)

Each returns true if the command as sent.

See Also:

Constant Summary collapse

RSRC_BASE =

The base for REST resources of this class

"mobiledevices"
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
VALID_DATA_KEYS =

these keys, as well as :id and :name, are present in valid API JSON data for this class

[:device_name, :capacity, :tethered ]
SEARCH_CLASS =

This class lets us seach for computers

JSS::AdvancedMobileDeviceSearch
EXT_ATTRIB_CLASS =

This is the class for relevant Extension Attributes

JSS::MobileDeviceExtensionAttribute
MOBILE_DEV_MDM_COMMANDS =

The MDM commands sendable via the api and alternative versions

{
  :blank_push => "BlankPush",
  :send_blank_push => "BlankPush",
  :blank => "BlankPush",
  :noop => "BlankPush",
  :update_inventory => "UpdateInventory",
  :recon => "UpdateInventory",
  :device_lock => "DeviceLock",
  :lock => "DeviceLock",
  :lock_device => "DeviceLock",
  :erase_device => "EraseDevice",
  :erase => "EraseDevice",
  :wipe => "EraseDevice",
  :clear_passcode => "ClearPasscode",
  :unmanage_device => "UnmanageDevice",
  :unmanage => "UnmanageDevice"
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ MobileDevice

Returns a new instance of MobileDevice.



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# File 'lib/jss-api/api_object/mobile_device.rb', line 393

def initialize(args = {})

  super args, [:udid, :serialnumber, :macaddress]

  gen = @init_data[:general]
  @airplay_password = gen[:airplay_password]
  @asset_tag = gen[:asset_tag]
  @available_mb = gen[:available_mb]
  @battery_level = gen[:battery_level]
  @bluetooth_mac_address = gen[:bluetooth_mac_address]
  @capacity_mb = gen[:capacity_mb]
  @computer = gen[:computer]
  @device_id = gen[:device_id]
  @device_name = gen[:device_name]
  @display_name = gen[:display_name]
  @initial_entry_date = JSS.epoch_to_time gen[:initial_entry_date_epoch]
  @ip_address = gen[:ip_address]
  @languages = gen[:languages]
  @last_backup_time = JSS.epoch_to_time  gen[:last_backup_time_epoch]
  @last_inventory_update = JSS.epoch_to_time gen[:last_inventory_update_epoch]
  @locales = gen[:locales]
  @managed = gen[:managed]
  @model_display = gen[:model_display]
  @model_identifier = gen[:model_identifier]
  @modem_firmware = gen[:modem_firmware]
  @os_build = gen[:os_build]
  @os_version = gen[:os_version]
  @percentage_used = gen[:percentage_used]
  @phone_number = gen[:phone_number]
  @serial_number = gen[:serial_number]
  @site = JSS::APIObject.get_name(gen[:site])
  @supervised = gen[:supervised]
  @tethered = gen[:tethered]
  @udid = gen[:udid]
  @wifi_mac_address = gen[:wifi_mac_address]

  parse_location
  parse_purchasing
  parse_ext_attrs

  @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]

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)



225
226
227
# File 'lib/jss-api/api_object/mobile_device.rb', line 225

def airplay_password
  @airplay_password
end

#applecare_idString Originally defined in module Purchasable

Returns:

#applicationsArray<Hash> (readonly)

Returns the applications on the devices.

Returns:

  • (Array<Hash>)

    the applications on the devices



314
315
316
# File 'lib/jss-api/api_object/mobile_device.rb', line 314

def applications
  @applications
end

#asset_tagString (readonly)

Returns the asset tag.

Returns:



228
229
230
# File 'lib/jss-api/api_object/mobile_device.rb', line 228

def asset_tag
  @asset_tag
end

#available_mbIntger (readonly)

Returns how much space available on the device?.

Returns:

  • (Intger)

    how much space available on the device?



231
232
233
# File 'lib/jss-api/api_object/mobile_device.rb', line 231

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



240
241
242
# File 'lib/jss-api/api_object/mobile_device.rb', line 240

def battery_level
  @battery_level
end

#bluetooth_mac_addressString (readonly)

Returns the bluetooth mac addr.

Returns:

  • (String)

    the bluetooth mac addr



243
244
245
# File 'lib/jss-api/api_object/mobile_device.rb', line 243

def bluetooth_mac_address
  @bluetooth_mac_address
end

#buildingString Originally defined in module Locatable

Returns:

#capacity_mbInteger (readonly)

Returns total storage on the device.

Returns:

  • (Integer)

    total storage on the device



234
235
236
# File 'lib/jss-api/api_object/mobile_device.rb', line 234

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:



323
324
325
# File 'lib/jss-api/api_object/mobile_device.rb', line 323

def certificates
  @certificates
end

#computerHash (readonly)

Returns {:name=>“xxx”, :id=>nnn} the computer associated with this device.

Returns:

  • (Hash)

    {:name=>“xxx”, :id=>nnn} the computer associated with this device



249
250
251
# File 'lib/jss-api/api_object/mobile_device.rb', line 249

def computer
  @computer
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:



334
335
336
# File 'lib/jss-api/api_object/mobile_device.rb', line 334

def configuration_profiles
  @configuration_profiles
end

#departmentString Originally defined in module Locatable

Returns:

#device_idString (readonly)

Returns what is this??.

Returns:



252
253
254
# File 'lib/jss-api/api_object/mobile_device.rb', line 252

def device_id
  @device_id
end

#email_addressString Originally defined in module Locatable

Returns:

#ext_attrsHash (readonly) Originally defined in module Extendable

Returns A mapping of Ext Attrib names to their values.

Returns:

  • (Hash)

    A mapping of Ext Attrib names to their values

#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



258
259
260
# File 'lib/jss-api/api_object/mobile_device.rb', line 258

def 
  @initial_entry_date
end

#ip_addressString (readonly)

Returns the IP addr.

Returns:



261
262
263
# File 'lib/jss-api/api_object/mobile_device.rb', line 261

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 language setting.

Returns:

  • (String)

    the language setting



264
265
266
# File 'lib/jss-api/api_object/mobile_device.rb', line 264

def languages
  @languages
end

#last_backup_timeTime (readonly)

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



268
269
270
# File 'lib/jss-api/api_object/mobile_device.rb', line 268

def last_backup_time
  @last_backup_time
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



271
272
273
# File 'lib/jss-api/api_object/mobile_device.rb', line 271

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:



274
275
276
# File 'lib/jss-api/api_object/mobile_device.rb', line 274

def locales
  @locales
end

#managedBoolean (readonly) Also known as: managed?

Returns is this device managed?.

Returns:

  • (Boolean)

    is this device managed?



277
278
279
# File 'lib/jss-api/api_object/mobile_device.rb', line 277

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:



344
345
346
# File 'lib/jss-api/api_object/mobile_device.rb', line 344

def mobile_device_groups
  @mobile_device_groups
end

#model_displayString (readonly)

Returns the display name of the model.

Returns:

  • (String)

    the display name of the model



280
281
282
# File 'lib/jss-api/api_object/mobile_device.rb', line 280

def model_display
  @model_display
end

#model_identifierString (readonly)

Returns the model identifier.

Returns:

  • (String)

    the model identifier



283
284
285
# File 'lib/jss-api/api_object/mobile_device.rb', line 283

def model_identifier
  @model_identifier
end

#modem_firmwareString (readonly)

Returns the model firmware.

Returns:

  • (String)

    the model firmware



286
287
288
# File 'lib/jss-api/api_object/mobile_device.rb', line 286

def modem_firmware
  @modem_firmware
end

#nameString (readonly)

Returns the API’s device_name and display_name are not used.

Returns:

  • (String)

    the API’s device_name and display_name are not used.



255
256
257
# File 'lib/jss-api/api_object/mobile_device.rb', line 255

def name
  @name
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:



364
365
366
# File 'lib/jss-api/api_object/mobile_device.rb', line 364

def network
  @network
end

#os_buildString (readonly)

Returns the OS build.

Returns:



292
293
294
# File 'lib/jss-api/api_object/mobile_device.rb', line 292

def os_build
  @os_build
end

#os_versionString (readonly)

Returns the OS version.

Returns:



289
290
291
# File 'lib/jss-api/api_object/mobile_device.rb', line 289

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?



237
238
239
# File 'lib/jss-api/api_object/mobile_device.rb', line 237

def percentage_used
  @percentage_used
end

#phoneString Originally defined in module Locatable

Returns:

#phone_numberString (readonly)

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

Returns:

  • (String)

    the phone number of the device’s SIM card



295
296
297
# File 'lib/jss-api/api_object/mobile_device.rb', line 295

def phone_number
  @phone_number
end

#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:



370
371
372
# File 'lib/jss-api/api_object/mobile_device.rb', line 370

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:



383
384
385
# File 'lib/jss-api/api_object/mobile_device.rb', line 383

def security
  @security
end

#serial_numberString (readonly) Also known as: sn, serialnumber

Returns the serial numbee.

Returns:

  • (String)

    the serial numbee



298
299
300
# File 'lib/jss-api/api_object/mobile_device.rb', line 298

def serial_number
  @serial_number
end

#siteString (readonly)

Returns the site associated with this device.

Returns:

  • (String)

    the site associated with this device



302
303
304
# File 'lib/jss-api/api_object/mobile_device.rb', line 302

def site
  @site
end

#supervisedBoolean (readonly)

Returns Is this device supervised?.

Returns:

  • (Boolean)

    Is this device supervised?



305
306
307
# File 'lib/jss-api/api_object/mobile_device.rb', line 305

def supervised
  @supervised
end

#tetheredString (readonly)

Returns the tether state of the device.

Returns:

  • (String)

    the tether state of the device



308
309
310
# File 'lib/jss-api/api_object/mobile_device.rb', line 308

def tethered
  @tethered
end

#udidString (readonly)

Returns the udid.

Returns:



311
312
313
# File 'lib/jss-api/api_object/mobile_device.rb', line 311

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



246
247
248
# File 'lib/jss-api/api_object/mobile_device.rb', line 246

def wifi_mac_address
  @wifi_mac_address
end

Class Method Details

.all_ipads(refresh = false) ⇒ Array<Hash>

Returns the list of all iPads.

Returns:



135
136
137
# File 'lib/jss-api/api_object/mobile_device.rb', line 135

def self.all_ipads(refresh = false)
  self.all(refresh).select{|d| d[:model].start_with? "iPad" }
end

.all_iphones(refresh = false) ⇒ Array<Hash>

Returns the list of all iPhones.

Returns:



130
131
132
# File 'lib/jss-api/api_object/mobile_device.rb', line 130

def self.all_iphones(refresh = false)
  self.all(refresh).select{|d| d[:model].start_with? "iPhone" }
end

.all_managed(refresh = false) ⇒ Array<Hash>

Returns the list of all managed mobile devices.

Returns:

  • (Array<Hash>)

    the list of all managed mobile devices



120
121
122
# File 'lib/jss-api/api_object/mobile_device.rb', line 120

def self.all_managed(refresh = false)
  self.all(refresh).select{|d| d[:managed] }
end

.all_phone_numbers(refresh = false) ⇒ Array<String>

Returns all mobiledevice phone numbers.

Returns:



105
106
107
# File 'lib/jss-api/api_object/mobile_device.rb', line 105

def self.all_phone_numbers(refresh = false)
  self.all(refresh).map{|i| i[:phone_number]}.select{|p| not p.empty?}
end

.all_serial_numbers(refresh = false) ⇒ Array<String>

Returns all mobiledevice serial_numbers.

Returns:



100
101
102
# File 'lib/jss-api/api_object/mobile_device.rb', line 100

def self.all_serial_numbers(refresh = false)
  self.all(refresh).map{|i| i[:serial_number]}
end

.all_udids(refresh = false) ⇒ Array<String>

Returns all mobiledevice udids.

Returns:



115
116
117
# File 'lib/jss-api/api_object/mobile_device.rb', line 115

def self.all_udids(refresh = false)
  self.all(refresh).map{|i| i[:udid]}
end

.all_unmanaged(refresh = false) ⇒ Array<Hash>

Returns the list of all unmanaged mobile devices.

Returns:

  • (Array<Hash>)

    the list of all unmanaged mobile devices



125
126
127
# File 'lib/jss-api/api_object/mobile_device.rb', line 125

def self.all_unmanaged(refresh = false)
  self.all(refresh).select{|d| not d[:managed] }
end

.all_wifi_mac_addresses(refresh = false) ⇒ Array<String>

Returns all mobiledevice wifi mac addrs.

Returns:



110
111
112
# File 'lib/jss-api/api_object/mobile_device.rb', line 110

def self.all_wifi_mac_addresses(refresh = false)
  self.all(refresh).map{|i| i[:wifi_mac_address]}
end

.match(term) ⇒ 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:

.send_mdm_command(dev, command) ⇒ Boolean

Send an MDM command to a managed mobile device.

See also #blank_push, #update_inventory, #device_lock, #erase_device, #clear_passcode, and #unmanage_device

Parameters:

  • dev (Integer, String)

    the id, name, serialnum, udid, phone num, or wifi macaddr of the device

  • command (Symbol)

    the command to send, one of the keys of MOBILE_DEV_MDM_COMMANDS

Returns:

  • (Boolean)

    true if command was sent successfully

Raises:



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/jss-api/api_object/mobile_device.rb', line 151

def self.send_mdm_command(dev,command)

  raise JSS::NoSuchItemError, "Unknown command '#{command}'" unless MOBILE_DEV_MDM_COMMANDS.keys.include? command
  command_xml ="#{JSS::APIConnection::XML_HEADER}<mobile_device><command>#{MOBILE_DEV_MDM_COMMANDS[command]}</command></mobile_device>"
  the_id = nil
  self.all_managed.each do |mmd|
    if [mmd[:id], mmd[:name], mmd[:serial_number], mmd[:phone_number], mmd[:udid], mmd[:wifi_mac_address]].include? dev
      the_id = mmd[:id]
      break
    end
  end # each do mmd

  if the_id
    response = JSS::API.put_rsrc( "#{RSRC_BASE}/id/#{the_id}", command_xml)
    response =~ %r{<notification_sent>(.+)</notification_sent>}
    return ($1 and $1 == "true")
  end
  raise JSS::UnmanagedError, "Cannot send command to unknown/unmanaged device '#{dev}'"
end

Instance Method Details

#blank_pushBoolean Also known as: noop, send_blank_push

Send a blank_push MDM command

Returns:

  • (Boolean)

See Also:



450
451
452
# File 'lib/jss-api/api_object/mobile_device.rb', line 450

def blank_push
  self.class.send_mdm_command @id, :blank_push
end

#clear_passcodeBoolean

Send a clear_passcode MDM command

Returns:

  • (Boolean)

See Also:



498
499
500
# File 'lib/jss-api/api_object/mobile_device.rb', line 498

def clear_passcode
  self.class.send_mdm_command @id, :clear_passcode
end

#device_lockBoolean Also known as: lock, lock_device

Send a device_lock MDM command

Returns:

  • (Boolean)

See Also:



474
475
476
# File 'lib/jss-api/api_object/mobile_device.rb', line 474

def device_lock
  self.class.send_mdm_command @id, :device_lock
end

#erase_deviceBoolean Also known as: erase, wipe

Send an erase_device MDM command

Returns:

  • (Boolean)

See Also:



486
487
488
# File 'lib/jss-api/api_object/mobile_device.rb', line 486

def erase_device
  self.class.send_mdm_command @id, :erase_device
end

#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.

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

Returns:

  • (REXML::Element)

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

#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?

#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)

#name=(newname) ⇒ void Originally defined in module Updatable

This method returns an undefined value.

Change the name of this item Remember to #update to push changes to the server.

Parameters:

  • newname (String)

    the new name

Raises:

#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 index in the @extension_attributes Array.

Classes including this module should call this in #initialize

#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

#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.

#set_ext_attr(name, value) ⇒ void Originally defined in module Extendable

This method returns an undefined value.

Set the value of an extension attribute

If the extension attribute is defined as a popup menu, the value must be one of the defined popup choices.

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

If the ext. attrib. is defined with a data type of Date, the value will be converted to a Time

Parameters:

  • name (String)

    the name of the extension attribute to set

  • value (String, Time, Time, Integer)

    the new value for the extension attribute for this user

#unmanage_deviceBoolean Also known as: unmanage, make_unmanaged

Send a unmanage_device MDM command

Returns:

  • (Boolean)

See Also:



509
510
511
# File 'lib/jss-api/api_object/mobile_device.rb', line 509

def unmanage_device
  @managed = false if self.class.send_mdm_command(@id, :unmanage_device)
end

#updateBoolean Originally defined in module Updatable

Save changes to the JSS

Returns:

  • (Boolean)

    success

Raises:

#update_inventoryBoolean Also known as: recon

Send an update_inventory MDM command

Returns:

  • (Boolean)

See Also:



463
464
465
# File 'lib/jss-api/api_object/mobile_device.rb', line 463

def update_inventory
  self.class.send_mdm_command @id, :update_inventory
end

#upload(type, local_file) ⇒ String Originally defined in module Uploadable

Upload a file to the JSS via the REST Resource of the object to which this module is mixed in.

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.

Returns:

  • (String)

    The xml response from the server.

Raises: