Class: JSS::MobileDevice
- Extended by:
- Matchable
- Includes:
- Creatable, Extendable, Locatable, MDM, ManagementHistory, Purchasable, Sitable, Updatable, Uploadable
- Defined in:
- lib/jss/api_object/mobile_device.rb,
lib/jss.rb more...
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: [:uuid, :guid], fetch_rsrc_key: :udid }, serial_number: { aliases: [:serialnumber, :sn], fetch_rsrc_key: :serialnumber }, wifi_mac_address: { aliases: [ :wifi_mac_addresse, :mac_address, :mac_addresse, :macaddress, :macaddresse, :macaddr ], fetch_rsrc_key: :macaddress } }.freeze
- NON_UNIQUE_NAMES =
true
- SEARCH_CLASS =
This class lets us seach for computers
JSS::AdvancedMobileDeviceSearch
- EXT_ATTRIB_CLASS =
This is the class for relevant Extension Attributes
JSS::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
-
#airplay_password ⇒ String
readonly
The airplay passwd on devices that can receive AirPlay (i.e. apple tvs).
- #applecare_id ⇒ String included from Purchasable
-
#applications ⇒ Array<Hash>
readonly
The applications on the device.
- #asset_tag ⇒ String
-
#available_mb ⇒ Intger
(also: #available)
readonly
How much space available on the device?.
-
#battery_level ⇒ Integer
(also: #battery_percent)
readonly
What percentage of the battery is remaining.
-
#ble_capable ⇒ Boolean
readonly
Is this device ble_capable?.
-
#bluetooth_mac_address ⇒ String
readonly
The bluetooth mac addr.
- #building ⇒ String included from Locatable
-
#capacity_mb ⇒ Integer
(also: #capacity)
readonly
Total storage on the device.
-
#certificates ⇒ Array<Hash>
readonly
The certificates on the device.
-
#configuration_profiles ⇒ Array<Hash>
readonly
One for each ConfigurationProfile on the device.
- #department ⇒ String included from Locatable
-
#device_id ⇒ String
readonly
An Apple TV identifier.
- #device_name ⇒ String readonly
-
#device_ownership_level ⇒ String
readonly
The device_ownership_level.
- #display_name ⇒ String readonly
- #email_address ⇒ String included from Locatable
- #exchange_activesync_device_identifier ⇒ String readonly
-
#extension_attributes ⇒ Array<Hash>
included
from Extendable
readonly
The extension attribute values for the object.
-
#initial_entry_date ⇒ Time
readonly
Uses the value from the API’s initial_entry_date_epoch.
-
#ip_address ⇒ String
readonly
The IP addr.
- #is_leased ⇒ Boolean (also: #leased?) included from Purchasable
- #is_purchased ⇒ Boolean (also: #purchased?) included from Purchasable
-
#languages ⇒ String
readonly
The languages.
-
#last_backup_time ⇒ Time
(also: #last_backup_date, #last_backup)
readonly
Uses the value from the API’s last_backup_time_epoch.
-
#last_cloud_backup_date ⇒ Time
readonly
Last_cloud_backup_date.
-
#last_enrollment ⇒ Time
readonly
The last time this device enrolled in Jamf.
-
#last_inventory_update ⇒ Time
readonly
Uses the value from the API’s last_inventory_update_utc.
- #lease_expires ⇒ Time included from Purchasable
- #life_expectancy ⇒ Integer included from Purchasable
-
#locales ⇒ String
readonly
The locales.
-
#managed ⇒ Boolean
(also: #managed?)
readonly
Is this device managed?.
-
#mobile_device_groups ⇒ Array<Hash>
readonly
One for each group to which the device belongs.
-
#model ⇒ String
readonly
The display name of the model.
-
#model_display ⇒ String
readonly
The display name of the model.
-
#model_identifier ⇒ String
readonly
The model identifier.
-
#model_number ⇒ String
readonly
The display name of the model.
-
#modem_firmware ⇒ String
readonly
The model firmware.
-
#need_to_update ⇒ Boolean
included
from Updatable
readonly
Do we have unsaved changes?.
-
#network ⇒ Hash
readonly
A Hash of network data.
-
#os_build ⇒ String
readonly
The OS build.
-
#os_type ⇒ String
readonly
The OS type.
-
#os_version ⇒ String
readonly
The OS version.
-
#percentage_used ⇒ Integer
readonly
How much of the capacity is in use?.
- #phone ⇒ String included from Locatable
- #po_date ⇒ Time included from Purchasable
- #po_number ⇒ String included from Purchasable
- #position ⇒ String included from Locatable
-
#provisioning_profiles ⇒ Array<Hash>
readonly
One per provisioning profile.
- #purchase_price ⇒ Float included from Purchasable
- #purchasing_account ⇒ String included from Purchasable
- #purchasing_contact ⇒ String included from Purchasable
- #real_name ⇒ String included from Locatable
- #room ⇒ String included from Locatable
-
#security ⇒ Hash
readonly
A Hash of security data.
- #serial_number ⇒ String (also: #sn, #serialnumber)
-
#shared ⇒ Boolean
readonly
Is this device shared?.
-
#sim_phone_number ⇒ String
(also: #device_phone_number)
readonly
The phone number of the device’s SIM card.
-
#supervised ⇒ Boolean
(also: #supervised?)
readonly
Is this device supervised?.
-
#tethered ⇒ String
readonly
The tether state of the device.
- #udid ⇒ String
- #username ⇒ String (also: #user) included from Locatable
- #vendor ⇒ String included from Purchasable
- #warranty_expires ⇒ Time included from Purchasable
-
#wifi_mac_address ⇒ String
readonly
The wifi mac addr.
Class Method Summary collapse
-
.all_apple_tvs(refresh = false, api: JSS.api) ⇒ Array<Hash>
The list of all iPads.
-
.all_ipads(refresh = false, api: JSS.api) ⇒ Array<Hash>
The list of all iPads.
-
.all_iphones(refresh = false, api: JSS.api) ⇒ Array<Hash>
The list of all iPhones.
-
.all_managed(refresh = false, api: JSS.api) ⇒ Array<Hash>
The list of all managed mobile devices.
-
.all_phone_numbers(refresh = false, api: JSS.api) ⇒ Array<String>
All mobiledevice phone numbers.
-
.all_supervised(refresh = false, api: JSS.api) ⇒ Array<Hash>
The list of all supervised mobile devices.
-
.all_unmanaged(refresh = false, api: JSS.api) ⇒ Array<Hash>
The list of all unmanaged mobile devices.
-
.all_unsupervised(refresh = false, api: JSS.api) ⇒ Array<Hash>
The list of all unsupervised mobile devices.
-
.match(term, api: JSS.api) ⇒ Array<Hash>
extended
from Matchable
Perform a match, returning an Array of Hashes, one for each item matched.
Instance Method Summary collapse
-
#app_store_app_history(status = nil) ⇒ Object
(also: #managed_app_history)
included
from ManagementHistory
Wrapper for app store history for both computers and mobile devices.
-
#audit_history ⇒ Object
(also: #audits)
included
from ManagementHistory
The audit_history for this object.
-
#blank_push ⇒ void
(also: #send_blank_push, #noop)
included
from MDM
Send a blank push to this object.
-
#casper_imaging_logs ⇒ Object
included
from ManagementHistory
The casper_imaging_logs for this computer.
-
#casper_remote_logs ⇒ Object
included
from ManagementHistory
The casper_remote_logs for this computer.
-
#clear_location ⇒ void
included
from Locatable
Clear all location data.
-
#clear_passcode ⇒ Object
included
from MDM
Send an clear_passcode command to this object.
-
#clear_restrictions_password ⇒ Object
included
from MDM
Send an clear_restrictions_password command to this object.
-
#clone(new_name, api: nil) ⇒ APIObject
included
from Creatable
make a clone of this API object, with a new name.
-
#completed_mdm_commands ⇒ Object
(also: #completed_commands)
included
from ManagementHistory
The completed_mdm_commands for this object.
-
#completed_policies ⇒ Object
included
from ManagementHistory
The array from .policy_logs, limited to status = :completed.
-
#computer_usage_logs ⇒ Object
(also: #usage_logs)
included
from ManagementHistory
The computer_usage_logs for this computer.
-
#create ⇒ Integer
included
from Creatable
Create a new object in the JSS.
-
#delete_user(user) ⇒ Object
included
from MDM
Send a delete_user command to this computer or group.
-
#device_lock(passcode_or_message = '') ⇒ Object
(also: #lock, #lock_device)
included
from MDM
Send a dev lock to this object.
-
#disable_app_analytics ⇒ Object
included
from MDM
Send a disable_app_analytics command to this object.
-
#disable_data_roaming ⇒ Object
included
from MDM
Send a disable_data_roaming command to this object.
-
#disable_diagnostic_submission ⇒ Object
included
from MDM
Send a disable_diagnostic_submission command to this object.
-
#disable_lost_mode ⇒ Object
included
from MDM
Send a disable_lost_mode command to this object.
-
#disable_voice_roaming ⇒ Object
included
from MDM
Send a disable_voice_roaming command to this object.
-
#ea_names ⇒ Array<String>
included
from Extendable
The names of all known EAs.
-
#ea_types ⇒ Hash{String => String}
included
from Extendable
EA names => data type (one of ‘String’, ‘Number’, or ‘Date’).
-
#ebook_history(status = nil) ⇒ Object
(also: #managed_ebook_history)
included
from ManagementHistory
The ebook_history for this mobile device.
-
#enable_app_analytics ⇒ Object
included
from MDM
Send an enable_app_analytics command to this object.
-
#enable_data_roaming ⇒ Object
included
from MDM
Send an enable_data_roaming command to this object.
-
#enable_diagnostic_submission ⇒ Object
included
from MDM
Send an enable_diagnostic_submission command to this object.
-
#enable_lost_mode(message: nil, phone_number: nil, footnote: nil, enforce_lost_mode: true, play_sound: false) ⇒ Object
included
from MDM
Send a enable_lost_mode command to one or more targets.
-
#enable_voice_roaming ⇒ Object
included
from MDM
Send an enable_voice_roaming command to this object.
-
#erase_device(passcode = '', preserve_data_plan: false) ⇒ Object
(also: #wipe_device, #wipe_computer, #wipe, #erase)
included
from MDM
Send an erase device command to this object.
-
#ext_attr_xml ⇒ REXML::Element
included
from Extendable
private
TODO: make this (and all XML amending) method take the in-progress XML doc and add (or not) the EA xml to it.
-
#ext_attrs ⇒ Object
included
from Extendable
An easier-to-use hash of EA name to EA value.
-
#failed_app_store_apps ⇒ Object
(also: #failed_managed_apps)
included
from ManagementHistory
shortcut for app_store_app_history where status = :failed.
-
#failed_ebooks ⇒ Object
(also: #failed_managed_ebooks)
included
from ManagementHistory
shortcut for ebook_history where status = :failed.
-
#failed_mdm_commands ⇒ Object
(also: #failed_commands)
included
from ManagementHistory
The failed_mdm_commands for this object.
-
#failed_policies ⇒ Object
included
from ManagementHistory
The array from .policy_logs, limited to status = :failed.
-
#flush_mdm_commands(status) ⇒ void
included
from MDM
flush pending and/or failed MDM commands for this object.
-
#has_location? ⇒ Boolean
included
from Locatable
Does this item have location data?.
-
#has_purchasing? ⇒ Boolean
included
from Purchasable
Does this item have any purchasing info?.
-
#initialize(args = {}) ⇒ MobileDevice
constructor
When creating new records with .make, udid:, serial_number:, and asset_tag: can be provided in the args.
-
#installed_app_store_apps ⇒ Object
(also: #installed_managed_apps)
included
from ManagementHistory
shortcut for app_store_app_history where status = :installed.
-
#installed_ebooks ⇒ Object
(also: #installed_managed_ebooks)
included
from ManagementHistory
shortcut for ebook_history where status = :installed.
-
#last_mdm_contact ⇒ Object
included
from ManagementHistory
The time of the last completed mdm command for this object.
-
#location ⇒ Hash<String>
included
from Locatable
All the location data in a Hash, as it comes from the API.
-
#location_xml ⇒ REXML::Element
included
from Locatable
private
Return a REXML <location> element to be included in the rest_xml of objects that have a Location subset.
-
#mac_app_store_app_history(status = nil) ⇒ Object
included
from ManagementHistory
The mac_app_store_app_history for this computer.
-
#management_history(subset = nil) ⇒ Object
(also: #history)
included
from ManagementHistory
The raw management history data for this object.
-
#mdm_command_history(status = nil) ⇒ Object
(also: #commands, #management_command_history)
included
from ManagementHistory
The mdm_command_history for this object.
-
#mobile_device_app_history(status = nil) ⇒ Object
included
from ManagementHistory
The mobile_device_app_history for this mobile device.
-
#name=(new_name) ⇒ Object
initialize.
-
#parse_ext_attrs ⇒ void
included
from Extendable
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.
-
#parse_location ⇒ void
included
from Locatable
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_purchasing ⇒ Object
included
from Purchasable
private
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
included
from MDM
Send a passcode_lock_grace_period command to this object.
-
#pending_app_store_apps ⇒ Object
(also: #pending_managed_apps)
included
from ManagementHistory
shortcut for app_store_app_history where status = :pending.
-
#pending_ebooks ⇒ Object
(also: #pending_managed_ebooks)
included
from ManagementHistory
shortcut for ebook_history where status = :pending.
-
#pending_mdm_commands ⇒ Object
(also: #pending_commands)
included
from ManagementHistory
The pending_mdm_commands for this object.
-
#play_lost_mode_sound ⇒ Object
included
from MDM
Send a play_lost_mode_sound command to this object.
-
#policy_logs ⇒ Object
included
from ManagementHistory
The policy_logs for this computer.
-
#purchasing ⇒ Hash<String>
included
from Purchasable
All the purchasing data in a Hash, as it comes from the API.
-
#purchasing_xml ⇒ REXML::Element
included
from Purchasable
private
A <purchasing> element to be included in the rest_xml of objects that mix-in this module.
-
#restart_device ⇒ Object
(also: #restart)
included
from MDM
Send a restart_device command to this object.
-
#screen_sharing_logs ⇒ Object
included
from ManagementHistory
The screen_sharing_logs for this computer.
-
#set_ext_attr(name, value, validate_popup_choice: true, refresh: false) ⇒ void
included
from Extendable
Set the value of an extension attribute.
-
#shut_down_device ⇒ Object
(also: #shutdown_device, #shut_down, #shutdown)
included
from MDM
Send a shut_down_device command to this object.
-
#site=(new_site) ⇒ void
included
from Sitable
Change the site of this object.
-
#site_assigned? ⇒ Boolean
included
from Sitable
Does this object have a site assigned?.
-
#site_id ⇒ Integer
included
from Sitable
The id of the site for this object.
-
#site_name ⇒ String
(also: #site)
included
from Sitable
The name of the site for this object.
-
#site_object ⇒ JSS::Site
included
from Sitable
The JSS::Site instance for this object’s site.
-
#unlock_user_account(user) ⇒ Object
included
from MDM
Send an unlock_user_account command to this computer or group.
-
#unmanage_device ⇒ Object
(also: #remove_mdm_profile)
included
from MDM
Send an unmanage device command to this object.
-
#unsaved_eas? ⇒ Boolean
included
from Extendable
are there any changes in the EAs needing to be saved?.
-
#unset_site ⇒ void
included
from Sitable
Set the site to nothing.
- #update ⇒ Object
-
#update_inventory ⇒ Object
(also: #recon)
included
from MDM
Send an update_inventory command to this object.
-
#upload(type, local_file) ⇒ String
included
from Uploadable
Upload a file to the JSS via the REST Resource of the object to which this module is mixed in.
-
#user_location_history ⇒ Object
included
from ManagementHistory
The user_location_history for this object.
-
#validate_popup_value(name, value, refresh) ⇒ Object
included
from Extendable
Used by set_ext_attr.
-
#wallpaper(wallpaper_setting: nil, wallpaper_content: nil, wallpaper_id: nil) ⇒ Object
(also: #set_wallpaper)
included
from MDM
Send a wallpaper command to this object.
Constructor Details
permalink #initialize(args = {}) ⇒ MobileDevice
When creating new records with .make, udid:, serial_number:, and asset_tag: can be provided in the args.
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 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 |
# File 'lib/jss/api_object/mobile_device.rb', line 418 def initialize(args = {}) super args 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
permalink #airplay_password ⇒ String (readonly)
Returns the airplay passwd on devices that can receive AirPlay (i.e. apple tvs).
244 245 246 |
# File 'lib/jss/api_object/mobile_device.rb', line 244 def airplay_password @airplay_password end |
permalink #applecare_id ⇒ String Originally defined in module Purchasable
permalink #applications ⇒ Array<Hash> (readonly)
Returns the applications on the device.
339 340 341 |
# File 'lib/jss/api_object/mobile_device.rb', line 339 def applications @applications end |
permalink #asset_tag ⇒ String
206 207 208 |
# File 'lib/jss/api_object/mobile_device.rb', line 206 def asset_tag @asset_tag end |
permalink #available_mb ⇒ Intger (readonly) Also known as: available
Returns how much space available on the device?.
286 287 288 |
# File 'lib/jss/api_object/mobile_device.rb', line 286 def available_mb @available_mb end |
permalink #battery_level ⇒ Integer (readonly) Also known as: battery_percent
Returns what percentage of the battery is remaining.
297 298 299 |
# File 'lib/jss/api_object/mobile_device.rb', line 297 def battery_level @battery_level end |
permalink #ble_capable ⇒ Boolean (readonly)
Returns is this device ble_capable?.
241 242 243 |
# File 'lib/jss/api_object/mobile_device.rb', line 241 def ble_capable @ble_capable end |
permalink #bluetooth_mac_address ⇒ String (readonly)
Returns the bluetooth mac addr.
304 305 306 |
# File 'lib/jss/api_object/mobile_device.rb', line 304 def bluetooth_mac_address @bluetooth_mac_address end |
permalink #capacity_mb ⇒ Integer (readonly) Also known as: capacity
Returns total storage on the device.
290 291 292 |
# File 'lib/jss/api_object/mobile_device.rb', line 290 def capacity_mb @capacity_mb end |
permalink #certificates ⇒ Array<Hash> (readonly)
The certificates on the device
Each has has two keys:
-
:identity => Boolean
-
:common_name => String, possibly a udid
348 349 350 |
# File 'lib/jss/api_object/mobile_device.rb', line 348 def certificates @certificates end |
permalink #configuration_profiles ⇒ Array<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
359 360 361 |
# File 'lib/jss/api_object/mobile_device.rb', line 359 def configuration_profiles @configuration_profiles end |
permalink #device_id ⇒ String (readonly)
Returns An Apple TV identifier.
215 216 217 |
# File 'lib/jss/api_object/mobile_device.rb', line 215 def device_id @device_id end |
permalink #device_name ⇒ String (readonly)
212 213 214 |
# File 'lib/jss/api_object/mobile_device.rb', line 212 def device_name @device_name end |
permalink #device_ownership_level ⇒ String (readonly)
Returns the device_ownership_level.
232 233 234 |
# File 'lib/jss/api_object/mobile_device.rb', line 232 def device_ownership_level @device_ownership_level end |
permalink #display_name ⇒ String (readonly)
209 210 211 |
# File 'lib/jss/api_object/mobile_device.rb', line 209 def display_name @display_name end |
permalink #exchange_activesync_device_identifier ⇒ String (readonly)
218 219 220 |
# File 'lib/jss/api_object/mobile_device.rb', line 218 def exchange_activesync_device_identifier @exchange_activesync_device_identifier end |
permalink #extension_attributes ⇒ Array<Hash> (readonly) Originally defined in module Extendable
Returns The extension attribute values for the object.
permalink #initial_entry_date ⇒ Time (readonly)
Returns uses the value from the API’s initial_entry_date_epoch.
320 321 322 |
# File 'lib/jss/api_object/mobile_device.rb', line 320 def initial_entry_date @initial_entry_date end |
permalink #ip_address ⇒ String (readonly)
Returns the IP addr.
310 311 312 |
# File 'lib/jss/api_object/mobile_device.rb', line 310 def ip_address @ip_address end |
permalink #is_leased ⇒ Boolean Also known as: leased? Originally defined in module Purchasable
permalink #is_purchased ⇒ Boolean Also known as: purchased? Originally defined in module Purchasable
permalink #languages ⇒ String (readonly)
Returns the languages.
247 248 249 |
# File 'lib/jss/api_object/mobile_device.rb', line 247 def languages @languages end |
permalink #last_backup_time ⇒ Time (readonly) Also known as: last_backup_date, last_backup
Returns uses the value from the API’s last_backup_time_epoch.
323 324 325 |
# File 'lib/jss/api_object/mobile_device.rb', line 323 def last_backup_time @last_backup_time end |
permalink #last_cloud_backup_date ⇒ Time (readonly)
Returns last_cloud_backup_date.
334 335 336 |
# File 'lib/jss/api_object/mobile_device.rb', line 334 def last_cloud_backup_date @last_cloud_backup_date end |
permalink #last_enrollment ⇒ Time (readonly)
Returns the last time this device enrolled in Jamf.
331 332 333 |
# File 'lib/jss/api_object/mobile_device.rb', line 331 def last_enrollment @last_enrollment end |
permalink #last_inventory_update ⇒ Time (readonly)
Returns uses the value from the API’s last_inventory_update_utc.
328 329 330 |
# File 'lib/jss/api_object/mobile_device.rb', line 328 def last_inventory_update @last_inventory_update end |
permalink #lease_expires ⇒ Time Originally defined in module Purchasable
permalink #life_expectancy ⇒ Integer Originally defined in module Purchasable
permalink #locales ⇒ String (readonly)
Returns the locales.
250 251 252 |
# File 'lib/jss/api_object/mobile_device.rb', line 250 def locales @locales end |
permalink #managed ⇒ Boolean (readonly) Also known as: managed?
Returns is this device managed?.
224 225 226 |
# File 'lib/jss/api_object/mobile_device.rb', line 224 def managed @managed end |
permalink #mobile_device_groups ⇒ Array<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
368 369 370 |
# File 'lib/jss/api_object/mobile_device.rb', line 368 def mobile_device_groups @mobile_device_groups end |
permalink #model ⇒ String (readonly)
Returns the display name of the model.
271 272 273 |
# File 'lib/jss/api_object/mobile_device.rb', line 271 def model @model end |
permalink #model_display ⇒ String (readonly)
Returns the display name of the model.
277 278 279 |
# File 'lib/jss/api_object/mobile_device.rb', line 277 def model_display @model_display end |
permalink #model_identifier ⇒ String (readonly)
Returns the model identifier.
280 281 282 |
# File 'lib/jss/api_object/mobile_device.rb', line 280 def model_identifier @model_identifier end |
permalink #model_number ⇒ String (readonly)
Returns the display name of the model.
274 275 276 |
# File 'lib/jss/api_object/mobile_device.rb', line 274 def model_number @model_number end |
permalink #modem_firmware ⇒ String (readonly)
Returns the model firmware.
256 257 258 |
# File 'lib/jss/api_object/mobile_device.rb', line 256 def modem_firmware @modem_firmware end |
permalink #need_to_update ⇒ Boolean (readonly) Originally defined in module Updatable
Returns do we have unsaved changes?.
permalink #network ⇒ Hash (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”
388 389 390 |
# File 'lib/jss/api_object/mobile_device.rb', line 388 def network @network end |
permalink #os_build ⇒ String (readonly)
Returns the OS build.
262 263 264 |
# File 'lib/jss/api_object/mobile_device.rb', line 262 def os_build @os_build end |
permalink #os_type ⇒ String (readonly)
Returns the OS type.
265 266 267 |
# File 'lib/jss/api_object/mobile_device.rb', line 265 def os_type @os_type end |
permalink #os_version ⇒ String (readonly)
Returns the OS version.
259 260 261 |
# File 'lib/jss/api_object/mobile_device.rb', line 259 def os_version @os_version end |
permalink #percentage_used ⇒ Integer (readonly)
Returns how much of the capacity is in use?.
294 295 296 |
# File 'lib/jss/api_object/mobile_device.rb', line 294 def percentage_used @percentage_used end |
permalink #po_date ⇒ Time Originally defined in module Purchasable
permalink #po_number ⇒ String Originally defined in module Purchasable
permalink #provisioning_profiles ⇒ Array<Hash> (readonly)
One per provisioning profile
394 395 396 |
# File 'lib/jss/api_object/mobile_device.rb', line 394 def provisioning_profiles @provisioning_profiles end |
permalink #purchase_price ⇒ Float Originally defined in module Purchasable
permalink #purchasing_account ⇒ String Originally defined in module Purchasable
permalink #purchasing_contact ⇒ String Originally defined in module Purchasable
permalink #security ⇒ Hash (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
407 408 409 |
# File 'lib/jss/api_object/mobile_device.rb', line 407 def security @security end |
permalink #serial_number ⇒ String Also known as: sn, serialnumber
198 199 200 |
# File 'lib/jss/api_object/mobile_device.rb', line 198 def serial_number @serial_number end |
permalink #shared ⇒ Boolean (readonly)
Returns is this device shared?.
238 239 240 |
# File 'lib/jss/api_object/mobile_device.rb', line 238 def shared @shared end |
permalink #sim_phone_number ⇒ String (readonly) Also known as: device_phone_number
Returns the phone number of the device’s SIM card.
313 314 315 |
# File 'lib/jss/api_object/mobile_device.rb', line 313 def sim_phone_number @sim_phone_number end |
permalink #supervised ⇒ Boolean (readonly) Also known as: supervised?
Returns is this device supervised?.
228 229 230 |
# File 'lib/jss/api_object/mobile_device.rb', line 228 def supervised @supervised end |
permalink #tethered ⇒ String (readonly)
Returns the tether state of the device.
235 236 237 |
# File 'lib/jss/api_object/mobile_device.rb', line 235 def tethered @tethered end |
permalink #udid ⇒ String
203 204 205 |
# File 'lib/jss/api_object/mobile_device.rb', line 203 def udid @udid end |
permalink #vendor ⇒ String Originally defined in module Purchasable
permalink #warranty_expires ⇒ Time Originally defined in module Purchasable
Class Method Details
permalink .all_apple_tvs(refresh = false, api: JSS.api) ⇒ Array<Hash>
Returns the list of all iPads.
184 185 186 |
# File 'lib/jss/api_object/mobile_device.rb', line 184 def self.all_apple_tvs(refresh = false, api: JSS.api) all(refresh, api: api).select { |d| d[:model_identifier].start_with? 'AppleTV' } end |
permalink .all_ipads(refresh = false, api: JSS.api) ⇒ Array<Hash>
Returns the list of all iPads.
179 180 181 |
# File 'lib/jss/api_object/mobile_device.rb', line 179 def self.all_ipads(refresh = false, api: JSS.api) all(refresh, api: api).select { |d| d[:model].start_with? 'iPad' } end |
permalink .all_iphones(refresh = false, api: JSS.api) ⇒ Array<Hash>
Returns the list of all iPhones.
174 175 176 |
# File 'lib/jss/api_object/mobile_device.rb', line 174 def self.all_iphones(refresh = false, api: JSS.api) all(refresh, api: api).select { |d| d[:model].start_with? 'iPhone' } end |
permalink .all_managed(refresh = false, api: JSS.api) ⇒ Array<Hash>
Returns the list of all managed mobile devices.
154 155 156 |
# File 'lib/jss/api_object/mobile_device.rb', line 154 def self.all_managed(refresh = false, api: JSS.api) all(refresh, api: api).select { |d| d[:managed] } end |
permalink .all_phone_numbers(refresh = false, api: JSS.api) ⇒ Array<String>
Returns all mobiledevice phone numbers.
149 150 151 |
# File 'lib/jss/api_object/mobile_device.rb', line 149 def self.all_phone_numbers(refresh = false, api: JSS.api) all(refresh, api: api).map { |i| i[:phone_number] }.reject(&:empty?) end |
permalink .all_supervised(refresh = false, api: JSS.api) ⇒ Array<Hash>
Returns the list of all supervised mobile devices.
164 165 166 |
# File 'lib/jss/api_object/mobile_device.rb', line 164 def self.all_supervised(refresh = false, api: JSS.api) all(refresh, api: api).select { |d| d[:supervised] } end |
permalink .all_unmanaged(refresh = false, api: JSS.api) ⇒ Array<Hash>
Returns the list of all unmanaged mobile devices.
159 160 161 |
# File 'lib/jss/api_object/mobile_device.rb', line 159 def self.all_unmanaged(refresh = false, api: JSS.api) all(refresh, api: api).reject { |d| d[:managed] } end |
permalink .all_unsupervised(refresh = false, api: JSS.api) ⇒ Array<Hash>
Returns the list of all unsupervised mobile devices.
169 170 171 |
# File 'lib/jss/api_object/mobile_device.rb', line 169 def self.all_unsupervised(refresh = false, api: JSS.api) all(refresh, api: api).reject { |d| d[:supervised] } end |
Instance Method Details
permalink #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
permalink #audit_history ⇒ Object Also known as: audits Originally defined in module ManagementHistory
The audit_history for this object
permalink #blank_push ⇒ void 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
permalink #casper_imaging_logs ⇒ Object Originally defined in module ManagementHistory
The casper_imaging_logs for this computer
permalink #casper_remote_logs ⇒ Object Originally defined in module ManagementHistory
The casper_remote_logs for this computer
permalink #clear_location ⇒ void Originally defined in module Locatable
This method returns an undefined value.
Clear all location data
permalink #clear_passcode ⇒ Object Originally defined in module MDM
Send an clear_passcode command to this object
permalink #clear_restrictions_password ⇒ Object Originally defined in module MDM
Send an clear_restrictions_password command to this object
permalink #clone(new_name, api: nil) ⇒ APIObject Originally defined in module Creatable
make a clone of this API object, with a new name. The class must be creatable
permalink #completed_mdm_commands ⇒ Object Also known as: completed_commands Originally defined in module ManagementHistory
The completed_mdm_commands for this object
permalink #completed_policies ⇒ Object Originally defined in module ManagementHistory
The array from .policy_logs, limited to status = :completed
permalink #computer_usage_logs ⇒ Object Also known as: usage_logs Originally defined in module ManagementHistory
The computer_usage_logs for this computer
permalink #delete_user(user) ⇒ Object Originally defined in module MDM
Send a delete_user command to this computer or group
permalink #device_lock(passcode_or_message = '') ⇒ Object Also known as: lock, lock_device Originally defined in module MDM
Send a dev lock to this object
permalink #disable_app_analytics ⇒ Object Originally defined in module MDM
Send a disable_app_analytics command to this object
permalink #disable_data_roaming ⇒ Object Originally defined in module MDM
Send a disable_data_roaming command to this object
permalink #disable_diagnostic_submission ⇒ Object Originally defined in module MDM
Send a disable_diagnostic_submission command to this object
permalink #disable_lost_mode ⇒ Object Originally defined in module MDM
Send a disable_lost_mode command to this object
permalink #disable_voice_roaming ⇒ Object Originally defined in module MDM
Send a disable_voice_roaming command to this object
permalink #ea_names ⇒ Array<String> Originally defined in module Extendable
Returns the names of all known EAs.
permalink #ea_types ⇒ Hash{String => String} Originally defined in module Extendable
Returns EA names => data type (one of ‘String’, ‘Number’, or ‘Date’).
permalink #ebook_history(status = nil) ⇒ Object Also known as: managed_ebook_history Originally defined in module ManagementHistory
The ebook_history for this mobile device
permalink #enable_app_analytics ⇒ Object Originally defined in module MDM
Send an enable_app_analytics command to this object
permalink #enable_data_roaming ⇒ Object Originally defined in module MDM
Send an enable_data_roaming command to this object
permalink #enable_diagnostic_submission ⇒ Object Originally defined in module MDM
Send an enable_diagnostic_submission command to this object
permalink #enable_lost_mode(message: nil, phone_number: nil, footnote: nil, enforce_lost_mode: true, 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
permalink #enable_voice_roaming ⇒ Object Originally defined in module MDM
Send an enable_voice_roaming command to this object
permalink #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
permalink #ext_attr_xml ⇒ REXML::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
permalink #ext_attrs ⇒ Object 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.
permalink #failed_app_store_apps ⇒ Object Also known as: failed_managed_apps Originally defined in module ManagementHistory
shortcut for app_store_app_history where status = :failed
permalink #failed_ebooks ⇒ Object Also known as: failed_managed_ebooks Originally defined in module ManagementHistory
shortcut for ebook_history where status = :failed
permalink #failed_mdm_commands ⇒ Object Also known as: failed_commands Originally defined in module ManagementHistory
The failed_mdm_commands for this object
permalink #failed_policies ⇒ Object Originally defined in module ManagementHistory
The array from .policy_logs, limited to status = :failed
permalink #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
permalink #has_location? ⇒ Boolean Originally defined in module Locatable
Returns Does this item have location data?.
permalink #has_purchasing? ⇒ Boolean Originally defined in module Purchasable
Returns does this item have any purchasing info?.
permalink #installed_app_store_apps ⇒ Object Also known as: installed_managed_apps Originally defined in module ManagementHistory
shortcut for app_store_app_history where status = :installed
permalink #installed_ebooks ⇒ Object Also known as: installed_managed_ebooks Originally defined in module ManagementHistory
shortcut for ebook_history where status = :installed
permalink #last_mdm_contact ⇒ Object Originally defined in module ManagementHistory
The time of the last completed mdm command for this object
permalink #location ⇒ Hash<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.
permalink #location_xml ⇒ REXML::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
permalink #mac_app_store_app_history(status = nil) ⇒ Object Originally defined in module ManagementHistory
The mac_app_store_app_history for this computer
permalink #management_history(subset = nil) ⇒ Object Also known as: history Originally defined in module ManagementHistory
The raw management history data for this object
permalink #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
permalink #mobile_device_app_history(status = nil) ⇒ Object Originally defined in module ManagementHistory
The mobile_device_app_history for this mobile device
permalink #name=(new_name) ⇒ Object
initialize
492 493 494 495 |
# File 'lib/jss/api_object/mobile_device.rb', line 492 def name=(new_name) super @needs_mdm_name_change = true if managed? && supervised? end |
permalink #parse_ext_attrs ⇒ void 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
permalink #parse_location ⇒ void 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
permalink #parse_purchasing ⇒ Object 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
permalink #passcode_lock_grace_period(secs) ⇒ Object Originally defined in module MDM
Send a passcode_lock_grace_period command to this object
permalink #pending_app_store_apps ⇒ Object Also known as: pending_managed_apps Originally defined in module ManagementHistory
shortcut for app_store_app_history where status = :pending
permalink #pending_ebooks ⇒ Object Also known as: pending_managed_ebooks Originally defined in module ManagementHistory
shortcut for ebook_history where status = :pending
permalink #pending_mdm_commands ⇒ Object Also known as: pending_commands Originally defined in module ManagementHistory
The pending_mdm_commands for this object
permalink #play_lost_mode_sound ⇒ Object Originally defined in module MDM
Send a play_lost_mode_sound command to this object
permalink #policy_logs ⇒ Object Originally defined in module ManagementHistory
The policy_logs for this computer
permalink #purchasing ⇒ Hash<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.
permalink #purchasing_xml ⇒ REXML::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.
permalink #restart_device ⇒ Object Also known as: restart Originally defined in module MDM
Send a restart_device command to this object
permalink #screen_sharing_logs ⇒ Object Originally defined in module ManagementHistory
The screen_sharing_logs for this computer
permalink #set_ext_attr(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.
permalink #shut_down_device ⇒ Object Also known as: shutdown_device, shut_down, shutdown Originally defined in module MDM
Send a shut_down_device command to this object
permalink #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
permalink #site_assigned? ⇒ Boolean Originally defined in module Sitable
Does this object have a site assigned?
permalink #site_id ⇒ Integer Originally defined in module Sitable
The id of the site for this object.
permalink #site_name ⇒ String 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’
permalink #site_object ⇒ JSS::Site Originally defined in module Sitable
The JSS::Site instance for this object’s site
permalink #unlock_user_account(user) ⇒ Object Originally defined in module MDM
Send an unlock_user_account command to this computer or group
permalink #unmanage_device ⇒ Object 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.
permalink #unsaved_eas? ⇒ Boolean Originally defined in module Extendable
are there any changes in the EAs needing to be saved?
permalink #unset_site ⇒ void Originally defined in module Sitable
This method returns an undefined value.
Set the site to nothing
permalink #update ⇒ Object
[View source]
520 521 522 523 524 525 526 |
# File 'lib/jss/api_object/mobile_device.rb', line 520 def update super return @id unless @needs_mdm_name_change set_device_name @name if managed? && supervised? @needs_mdm_name_change = false @id end |
permalink #update_inventory ⇒ Object Also known as: recon Originally defined in module MDM
Send an update_inventory command to this object
permalink #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.
permalink #user_location_history ⇒ Object Originally defined in module ManagementHistory
The user_location_history for this object
permalink #validate_popup_value(name, value, refresh) ⇒ Object Originally defined in module Extendable
Used by set_ext_attr