Class: JSS::MobileDeviceApplication
- Includes:
- Categorizable, Creatable, Scopable, SelfServable, Sitable, Updatable, Uploadable, VPPable
- Defined in:
- lib/jss/api_object/mobile_device_application.rb,
lib/jss.rb
Overview
A Mobile Device Application in the JSS
Constant Summary collapse
- RSRC_BASE =
The base for REST resources of this class
'mobiledeviceapplications'.freeze
- RSRC_LIST_KEY =
the hash key used for the JSON list output of all objects in the JSS
:mobile_device_applications
- RSRC_OBJECT_KEY =
The hash key used for the JSON object output. It's also used in various error messages
:mobile_device_application
- SCOPE_TARGET_KEY =
See JSS::Scopable
:mobile_devices
- UPLOAD_TYPES =
see JSS::Uploadable
{ icon: :mobiledeviceapplicationsicon, app: :mobiledeviceapplicationsipa, attachment: :mobiledeviceapplications }.freeze
- OTHER_LOOKUP_KEYS =
see JSS::APIObject
{ bundle_id: { aliases: %i[bundleid], fetch_rsrc_key: :bundleid } }.freeze
- OBJECT_HISTORY_OBJECT_TYPE =
the object type for this object in the object history table. See APIObject#add_object_history_entry
23
- SITE_SUBSET =
Where is the Site data in the API JSON?
:general
- CATEGORY_SUBSET =
Where is the Category in the API JSON?
:general
- CATEGORY_DATA_TYPE =
How is the category stored in the API data?
Hash
- OS_TYPES =
possible values for os_type
{ ios: 'iOS', tvos: 'tvOS' }
Instance Attribute Summary collapse
- #assign_vpp_device_based_licenses ⇒ Boolean (also: #vpp_device_based?) included from VPPable
-
#bundle_id ⇒ String
E.g.
-
#configuration_prefs ⇒ String
Pre-configuration data for installing the app.
-
#deploy_as_managed_app ⇒ Boolean
Should this app be mananged?.
- #description ⇒ String
-
#display_name ⇒ String
The user-facing name (i.e. in self service).
-
#external_url ⇒ String
If :host_externally is true, the URL for the app.
-
#free ⇒ Boolean
(also: #free?)
Is this a free app?.
-
#host_externally ⇒ Boolean
Does the app itself come from outside the JSS?.
-
#icon ⇒ JSS::Icon?
(also: #self_service_icon)
included
from SelfServable
The icon used in self-service.
-
#in_self_service ⇒ Boolean
(also: #in_self_service?)
included
from SelfServable
readonly
Is this thing available in Self Service?.
- #internal_app ⇒ Boolean readonly
-
#ipa ⇒ Hash
readonly
The .ipa file info.
-
#itunes_country_region ⇒ String
readonly
The app's country/region code in the iTunes store.
-
#itunes_store_url ⇒ String
readonly
The URL of this item in the iTunes store, if applicable.
-
#itunes_sync_time ⇒ Integer
readonly
The last time the app and data was synced from iTunes (I think).
-
#keep_description_and_icon_up_to_date ⇒ Boolean
Should the JSS update the icon and description from the app source?.
-
#make_available_after_install ⇒ Boolean
(also: #self_service_make_available_after_install)
Will this still appear in SelfSvc after installation (I think).
-
#need_to_update ⇒ Boolean
included
from Updatable
readonly
Do we have unsaved changes?.
-
#os_type ⇒ String
Is this an iOS or tvOS app?.
-
#prevent_backup_of_app_data ⇒ Boolean
Should this app be able to backup its data when the device does its backups (to icloud or itunes)?.
-
#provisioning_profile ⇒ Hash
readonly
The provisioning profile info for this app.
- #remaining_vpp_licenses ⇒ Integer (also: #vpp_licenses_remaining) included from VPPable readonly
-
#remove_app_when_mdm_profile_is_removed ⇒ Boolean
Should the app be removed when the device is unmanaged?.
-
#scope ⇒ Object
included
from Scopable
Attribtues.
-
#self_service_categories ⇒ Array<Hash>
included
from SelfServable
readonly
Each Hash has these keys about the category - :id => [Integer] the JSS id of the category - :name => [String] the name of the category.
-
#self_service_description ⇒ String
included
from SelfServable
The verbage that appears in SelfSvc for this item.
-
#self_service_display_name ⇒ String
(also: #self_service_dislay_name)
included
from SelfServable
The name to display in macOS Self Service.
-
#self_service_feature_on_main_page ⇒ Boolean
included
from SelfServable
Only applicable to macOS targets.
-
#self_service_force_users_to_view_description ⇒ Boolean
included
from SelfServable
Should an extra window appear before the user can install the item? (OSX SSvc only).
-
#self_service_install_button_text ⇒ String
included
from SelfServable
defaults to 'Install'.
-
#self_service_notification_message ⇒ String
included
from SelfServable
The message text of the notification.
-
#self_service_notification_subject ⇒ String
included
from SelfServable
object name.
-
#self_service_notification_type ⇒ Symbol
included
from SelfServable
How should notifications be sent either :ssvc_only or :ssvc_and_nctr.
-
#self_service_notifications_enabled ⇒ Boolean
(also: #self_service_notifications_enabled?)
included
from SelfServable
Should jamf send notifications to self service?.
-
#self_service_reinstall_button_text ⇒ String
included
from SelfServable
defaults to 'Reinstall'.
-
#self_service_reminder_frequency ⇒ Integer
included
from SelfServable
How often (in days) should reminders be given.
-
#self_service_reminders_enabled ⇒ Boolean
(also: #self_service_reminders_enabled?)
included
from SelfServable
Should self service give reminders by displaying the notification repeatedly?.
-
#self_service_removal_password ⇒ String
included
from SelfServable
readonly
The password needed for removal, in plain text.
-
#self_service_user_removable ⇒ Symbol
included
from SelfServable
One of the keys in PROFILE_REMOVAL_BY_USER.
-
#take_over_management ⇒ Boolean
If the user installs this app on their own, should Jamf take over managing it?.
- #total_vpp_licenses ⇒ Integer (also: #vpp_licenses_total) included from VPPable readonly
-
#url ⇒ String
The URL for downloading this app.
- #used_vpp_licenses ⇒ Integer (also: #vpp_licenses_used) included from VPPable readonly
- #version ⇒ String
- #vpp_admin_account_id ⇒ Integer (also: #vpp_account_id) included from VPPable readonly
- #vpp_codes ⇒ Hash included from VPPable readonly
Instance Method Summary collapse
-
#add_self_service_category(new_cat, display_in: true, feature_in: false) ⇒ void
(also: #set_self_service_category, #change_self_service_category)
included
from SelfServable
Add or change one of the categories for this item in self service.
-
#add_to_self_service ⇒ void
included
from SelfServable
Add this object to self service if not already there.
-
#category=(new_cat) ⇒ void
included
from Categorizable
Change the category of this object.
-
#category_assigned? ⇒ Boolean
(also: #categorized?)
included
from Categorizable
Does this object have a category assigned?.
-
#category_id ⇒ Integer
included
from Categorizable
The id of the category for this object.
-
#category_name ⇒ String
(also: #category)
included
from Categorizable
The name of the category for this object.
-
#category_object ⇒ JSS::Category
included
from Categorizable
The JSS::Category instance for this object's category.
-
#clone(new_name, api: nil) ⇒ APIObject
included
from Creatable
make a clone of this API object, with a new name.
-
#create ⇒ Object
included
from SelfServable
HACK: ity hack hack…
-
#evaluate_new_category(new_cat) ⇒ Array<String, Integer>
included
from Categorizable
Given a category name or id, return the name and id TODO: use APIObject.exist? and/or APIObject.valid_id.
-
#initialize(args) ⇒ MobileDeviceApplication
constructor
See JSS::APIObject#initialize.
-
#name=(newname) ⇒ void
included
from Updatable
Change the name of this item Remember to #update to push changes to the server.
-
#parse_scope ⇒ void
included
from Scopable
private
Call this during initialization of objects that have a scope and the scope instance will be created from @init_data.
-
#pretty_print_instance_variables ⇒ Array
Remove the various cached data from the instance_variables used to create pretty-print (pp) output.
-
#remove_from_self_service ⇒ void
included
from SelfServable
Remove this object from self service if it's there.
-
#remove_self_service_category(cat) ⇒ void
included
from SelfServable
Remove a category from those for this item in SSvc.
-
#save_ipa(path, overwrite = false) ⇒ void
Save the application to a file.
-
#self_service_execute_url ⇒ String
included
from SelfServable
The url to view this thing in Self Service.
-
#self_service_payload ⇒ Symbol
included
from SelfServable
What does this object deploy to the device via self service?.
-
#self_service_targets ⇒ Array<Symbol>
included
from SelfServable
What devices types can get this thing in Self Service.
-
#self_service_view_url ⇒ String
included
from SelfServable
The url to view this thing in Self Service.
-
#should_update ⇒ void
included
from Scopable
When the scope changes, it calls this to tell us that an update is needed.
-
#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.
-
#unset_category ⇒ void
included
from Categorizable
Set the category to nothing.
-
#unset_site ⇒ void
included
from Sitable
Set the site to nothing.
-
#update ⇒ Object
included
from SelfServable
HACK: ity hack hack…
-
#upload(type, local_file, force_ipa_upload: false) ⇒ Boolean
included
from Uploadable
instance method wrapper for class method.
-
#upload_ipa(path, force_ipa_upload: false) ⇒ void
Upload a new app .ipa file.
-
#user_removable? ⇒ Boolean?
included
from SelfServable
Can this thing be removed by the user?.
-
#vpp_admin_account_name ⇒ String
(also: #vpp_account_name)
included
from VPPable
The name of the vpp admin acct for this object.
Constructor Details
#initialize(args) ⇒ MobileDeviceApplication
See JSS::APIObject#initialize
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 195 def initialize(args) super general = @init_data[:general] @display_name = general[:display_name] @description = general[:description] @bundle_id = general[:bundle_id] @version = general[:version] @ipa = general[:ipa] @os_type = general[:os_type] @provisioning_profile = general[:provisioning_profile] @url = general[:url] @itunes_store_url = general[:itunes_store_url] @make_available_after_install = general[:make_available_after_install] @itunes_country_region = general[:itunes_country_region] @itunes_sync_time = general[:itunes_sync_time] @deploy_as_managed_app = general[:deploy_as_managed_app] @remove_app_when_mdm_profile_is_removed = general[:remove_app_when_mdm_profile_is_removed] @prevent_backup_of_app_data = general[:prevent_backup_of_app_data] @keep_description_and_icon_up_to_date = general[:keep_description_and_icon_up_to_date] @free = general[:free] @take_over_management = general[:take_over_management] @host_externally = general[:host_externally] @external_url = general[:external_url] @configuration_prefs = @init_data[:app_configuration][:preferences] end |
Instance Attribute Details
#assign_vpp_device_based_licenses ⇒ Boolean Also known as: vpp_device_based? Originally defined in module VPPable
#bundle_id ⇒ String
Returns e.g. com.company.appname.
122 123 124 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 122 def bundle_id @bundle_id end |
#configuration_prefs ⇒ String
Returns Pre-configuration data for installing the app. Currently there's only one key in the :configuration hash, :preferences, which contains a plist <dict> element with config data.
186 187 188 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 186 def configuration_prefs @configuration_prefs end |
#deploy_as_managed_app ⇒ Boolean
Returns Should this app be mananged?.
156 157 158 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 156 def deploy_as_managed_app @deploy_as_managed_app end |
#description ⇒ String
119 120 121 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 119 def description @description end |
#display_name ⇒ String
Returns The user-facing name (i.e. in self service).
116 117 118 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 116 def display_name @display_name end |
#external_url ⇒ String
Returns If :host_externally is true, the URL for the app.
181 182 183 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 181 def external_url @external_url end |
#free ⇒ Boolean Also known as: free?
Returns is this a free app?.
170 171 172 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 170 def free @free end |
#host_externally ⇒ Boolean
Returns Does the app itself come from outside the JSS?.
178 179 180 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 178 def host_externally @host_externally end |
#icon ⇒ JSS::Icon? Also known as: self_service_icon Originally defined in module SelfServable
Returns The icon used in self-service.
#in_self_service ⇒ Boolean (readonly) Also known as: in_self_service? Originally defined in module SelfServable
Returns Is this thing available in Self Service?.
#internal_app ⇒ Boolean (readonly)
128 129 130 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 128 def internal_app @internal_app end |
#ipa ⇒ Hash (readonly)
Returns The .ipa file info.
131 132 133 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 131 def ipa @ipa end |
#itunes_country_region ⇒ String (readonly)
Returns The app's country/region code in the iTunes store.
150 151 152 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 150 def itunes_country_region @itunes_country_region end |
#itunes_store_url ⇒ String (readonly)
Returns The URL of this item in the iTunes store, if applicable.
143 144 145 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 143 def itunes_store_url @itunes_store_url end |
#itunes_sync_time ⇒ Integer (readonly)
Returns The last time the app and data was synced from iTunes (I think).
153 154 155 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 153 def itunes_sync_time @itunes_sync_time end |
#keep_description_and_icon_up_to_date ⇒ Boolean
Returns should the JSS update the icon and description from the app source?.
167 168 169 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 167 def keep_description_and_icon_up_to_date @keep_description_and_icon_up_to_date end |
#make_available_after_install ⇒ Boolean Also known as: self_service_make_available_after_install
Returns Will this still appear in SelfSvc after installation (I think).
146 147 148 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 146 def make_available_after_install @make_available_after_install end |
#need_to_update ⇒ Boolean (readonly) Originally defined in module Updatable
Returns do we have unsaved changes?.
#os_type ⇒ String
Returns Is this an iOS or tvOS app?.
140 141 142 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 140 def os_type @os_type end |
#prevent_backup_of_app_data ⇒ Boolean
Returns Should this app be able to backup its data when the device does its backups (to icloud or itunes)?.
163 164 165 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 163 def prevent_backup_of_app_data @prevent_backup_of_app_data end |
#provisioning_profile ⇒ Hash (readonly)
Returns The provisioning profile info for this app.
134 135 136 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 134 def provisioning_profile @provisioning_profile end |
#remaining_vpp_licenses ⇒ Integer (readonly) Also known as: vpp_licenses_remaining Originally defined in module VPPable
#remove_app_when_mdm_profile_is_removed ⇒ Boolean
Returns Should the app be removed when the device is unmanaged?.
159 160 161 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 159 def remove_app_when_mdm_profile_is_removed @remove_app_when_mdm_profile_is_removed end |
#self_service_categories ⇒ Array<Hash> (readonly) Originally defined in module SelfServable
Each Hash has these keys about the category
-
:id => [Integer] the JSS id of the category
-
:name => [String] the name of the category
Most objects also include one or both of these keys:
-
:display_in => [Boolean] should the item be displayed in this category in SSvc? (not MobDevConfProfiles)
-
:feature_in => [Boolean] should the item be featured in this category in SSVC? (macOS targets only)
#self_service_description ⇒ String Originally defined in module SelfServable
Returns The verbage that appears in SelfSvc for this item.
#self_service_display_name ⇒ String Also known as: self_service_dislay_name Originally defined in module SelfServable
Returns The name to display in macOS Self Service.
#self_service_feature_on_main_page ⇒ Boolean Originally defined in module SelfServable
Only applicable to macOS targets
#self_service_force_users_to_view_description ⇒ Boolean Originally defined in module SelfServable
Returns Should an extra window appear before the user can install the item? (OSX SSvc only).
#self_service_install_button_text ⇒ String Originally defined in module SelfServable
defaults to 'Install'
#self_service_notification_message ⇒ String Originally defined in module SelfServable
Returns The message text of the notification.
#self_service_notification_subject ⇒ String Originally defined in module SelfServable
object name.
#self_service_notification_type ⇒ Symbol Originally defined in module SelfServable
Returns How should notifications be sent either :ssvc_only or :ssvc_and_nctr.
#self_service_notifications_enabled ⇒ Boolean Also known as: self_service_notifications_enabled? Originally defined in module SelfServable
Returns Should jamf send notifications to self service?.
#self_service_reinstall_button_text ⇒ String Originally defined in module SelfServable
defaults to 'Reinstall'
#self_service_reminder_frequency ⇒ Integer Originally defined in module SelfServable
Returns How often (in days) should reminders be given.
#self_service_reminders_enabled ⇒ Boolean Also known as: self_service_reminders_enabled? Originally defined in module SelfServable
Returns Should self service give reminders by displaying the notification repeatedly?.
#self_service_removal_password ⇒ String (readonly) Originally defined in module SelfServable
Returns The password needed for removal, in plain text.
#self_service_user_removable ⇒ Symbol Originally defined in module SelfServable
Returns one of the keys in PROFILE_REMOVAL_BY_USER.
#take_over_management ⇒ Boolean
Returns If the user installs this app on their own, should Jamf take over managing it?.
175 176 177 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 175 def take_over_management @take_over_management end |
#total_vpp_licenses ⇒ Integer (readonly) Also known as: vpp_licenses_total Originally defined in module VPPable
#url ⇒ String
Returns The URL for downloading this app.
137 138 139 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 137 def url @url end |
#used_vpp_licenses ⇒ Integer (readonly) Also known as: vpp_licenses_used Originally defined in module VPPable
#version ⇒ String
125 126 127 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 125 def version @version end |
#vpp_admin_account_id ⇒ Integer (readonly) Also known as: vpp_account_id Originally defined in module VPPable
Instance Method Details
#add_self_service_category(new_cat, display_in: true, feature_in: false) ⇒ void Also known as: set_self_service_category, change_self_service_category Originally defined in module SelfServable
This method returns an undefined value.
Add or change one of the categories for this item in self service
#add_to_self_service ⇒ void Originally defined in module SelfServable
This method returns an undefined value.
Add this object to self service if not already there.
#category=(new_cat) ⇒ void Originally defined in module Categorizable
This method returns an undefined value.
Change the category of this object. Any of the NON_CATEGORIES values will unset the category
#category_assigned? ⇒ Boolean Also known as: categorized? Originally defined in module Categorizable
Does this object have a category assigned?
#category_id ⇒ Integer Originally defined in module Categorizable
The id of the category for this object.
#category_name ⇒ String Also known as: category Originally defined in module Categorizable
The name of the category for this object. For backward compatibility, this is aliased to just 'category'
#category_object ⇒ JSS::Category Originally defined in module Categorizable
The JSS::Category instance for this object's category
#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
#create ⇒ Object Originally defined in module SelfServable
HACK: ity hack hack… remove when jamf fixes these bugs
#evaluate_new_category(new_cat) ⇒ Array<String, Integer> Originally defined in module Categorizable
Given a category name or id, return the name and id TODO: use APIObject.exist? and/or APIObject.valid_id
#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.
#parse_scope ⇒ void Originally defined in module Scopable
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.
This method returns an undefined value.
Call this during initialization of objects that have a scope and the scope instance will be created from @init_data
#pretty_print_instance_variables ⇒ Array
Remove the various cached data from the instance_variables used to create pretty-print (pp) output.
494 495 496 497 498 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 494 def pretty_print_instance_variables vars = super vars.delete :@ipa vars end |
#remove_from_self_service ⇒ void Originally defined in module SelfServable
This method returns an undefined value.
Remove this object from self service if it's there.
#remove_self_service_category(cat) ⇒ void Originally defined in module SelfServable
This method returns an undefined value.
Remove a category from those for this item in SSvc
#save_ipa(path, overwrite = false) ⇒ void
This method returns an undefined value.
Save the application to a file.
If the path given is an existing directory, the ipa's current filename will be used, if known.
463 464 465 466 467 468 469 470 471 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 463 def save_ipa(path, overwrite = false) return nil unless @ipa[:data] path = Pathname.new path path = path + @ipa[:name] if path.directory? && @ipa[:name] raise JSS::AlreadyExistsError, "The file #{path} already exists" if path.exist? && !overwrite path.delete if path.exist? path.jss_save Base64.decode64(@ipa[:data]) end |
#self_service_execute_url ⇒ String Originally defined in module SelfServable
Returns The url to view this thing in Self Service.
#self_service_payload ⇒ Symbol Originally defined in module SelfServable
What does this object deploy to the device via self service?
#self_service_targets ⇒ Array<Symbol> Originally defined in module SelfServable
What devices types can get this thing in Self Service
#self_service_view_url ⇒ String Originally defined in module SelfServable
Returns The url to view this thing in Self Service.
#should_update ⇒ void Originally defined in module Scopable
This method returns an undefined value.
When the scope changes, it calls this to tell us that an update is needed.
#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
#site_assigned? ⇒ Boolean Originally defined in module Sitable
Does this object have a site assigned?
#site_id ⇒ Integer Originally defined in module Sitable
The id of the site for this object.
#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'
#site_object ⇒ JSS::Site Originally defined in module Sitable
The JSS::Site instance for this object's site
#unset_category ⇒ void Originally defined in module Categorizable
This method returns an undefined value.
Set the category to nothing
#unset_site ⇒ void Originally defined in module Sitable
This method returns an undefined value.
Set the site to nothing
#update ⇒ Object Originally defined in module SelfServable
HACK: ity hack hack… remove when jamf fixes these bugs
#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
#upload_ipa(path, force_ipa_upload: false) ⇒ void
This method returns an undefined value.
Upload a new app .ipa file
482 483 484 485 486 |
# File 'lib/jss/api_object/mobile_device_application.rb', line 482 def upload_ipa(path, force_ipa_upload: false) new_ipa = Pathname.new path upload(:app, new_ipa, force_ipa_upload: force_ipa_upload) refresh_ipa end |
#user_removable? ⇒ Boolean? Originally defined in module SelfServable
Can this thing be removed by the user?