module Jamf::VPPable
A mix-in module to handleVPP-related data in API objects that can be assigned via VPP.
NOTE: For now we are only working with device-based VPP assignments, which are done via the scope of the VPPable
object (macapp, mobdevapp, ebook)
User-based APP assignments will require the creation of a VPPAssignment class, and a VPPAssignmentScope class, since those scopes are very limited compared to ordinary scope.
To use this module, merely ‘include VPPable` when defining your subclass of Jamf::APIObject
classes doing so MUST call {#add_vpp_xml(xmldoc)} in their {#rest_xml} method
Constants
- VPPABLE
Mixed-in
Constants
Attributes
@return [Boolean]
@return [Integer]
@return [Integer]
@return [Integer]
@return [Integer]
@return [Integer]
@return [Hash]
@return [Boolean]
@return [Integer]
@return [Integer]
@return [Integer]
Public Class Methods
Mixed-in Class Methods
This is a common technique to get class methods mixed in when you ‘include’ a module full of instance methods
# File lib/jamf/api/classic/api_objects/vppable.rb 56 def self.included(klass) 57 klass.extend(ClassMethods) 58 end
Public Instance Methods
Set whether or not the VPP licenses should be assigned by device as well as (or.. instead of?) by user
@param new_val The new value
@return [void]
# File lib/jamf/api/classic/api_objects/vppable.rb 223 def assign_vpp_device_based_licenses=(new_val) 224 return if new_val == @assign_vpp_device_based_licenses 225 226 @assign_vpp_device_based_licenses = Jamf::Validate.boolean new_val 227 @need_to_update = true 228 end
@return [String] The name of the vpp admin acct for this object
# File lib/jamf/api/classic/api_objects/vppable.rb 233 def vpp_admin_account_name 234 return unless @vpp_admin_account_id.is_a? Integer 235 236 Jamf::VPPAccount.map_all_ids_to(:name)[@vpp_admin_account_id] 237 end
Private Instance Methods
Insert an appropriate vpp element into the XML for sending changes to the JSS
@param xdoc The XML document to work with
@return [void]
# File lib/jamf/api/classic/api_objects/vppable.rb 265 def add_vpp_xml(xdoc) 266 doc_root = xdoc.root 267 vpp = doc_root.add_element 'vpp' 268 vpp.add_element('assign_vpp_device_based_licenses').text = @assign_vpp_device_based_licenses.to_s 269 end
Parse the vpp data from the incoming API data
@return [void]
# File lib/jamf/api/classic/api_objects/vppable.rb 248 def parse_vpp 249 @vpp_codes = @init_data[:vpp_codes] 250 vpp_data = @init_data[:vpp] 251 @vpp_admin_account_id = vpp_data[:vpp_admin_account_id] 252 @assign_vpp_device_based_licenses = vpp_data[:assign_vpp_device_based_licenses] 253 @total_vpp_licenses = vpp_data[:total_vpp_licenses] 254 @remaining_vpp_licenses = vpp_data[:remaining_vpp_licenses] 255 @used_vpp_licenses = vpp_data[:used_vpp_licenses] 256 end