module Jamf::JPAPIResource::ClassMethods

Class Methods

Public Class Methods

extended(extender) click to toggle source
   # File lib/jamf/api/jamf_pro/mixins/jpapi_resource.rb
59 def self.extended(extender)
60   Jamf.load_msg "--> #{extender} is extending Jamf::JPAPIResource::ClassMethods"
61 end

Public Instance Methods

new(**data) click to toggle source

Disallow direct use of ruby’s .new class method for creating instances. Require use of .fetch or .create, or ‘all’

Calls superclass method
   # File lib/jamf/api/jamf_pro/mixins/jpapi_resource.rb
72 def new(**data)
73   calling_method = caller_locations(1..1).first.label
74   unless NEW_CALLERS.include? calling_method
75     raise Jamf::UnsupportedError, 'Use .fetch, .create, or .all(instantiate:true) to instantiate Jamf::JPAPIResource objects'
76   end
77 
78   super(**data)
79 end
which_api() click to toggle source

Indicate that this class comes from the Jamf Pro API. The same method exists in APIObject to indicate coming from Classic

   # File lib/jamf/api/jamf_pro/mixins/jpapi_resource.rb
65 def which_api
66   :jamf_pro
67 end