Class: Jamf::SingletonResource Abstract
- Inherits:
-
Resource
- Object
- JSONObject
- Resource
- Jamf::SingletonResource
- Extended by:
- Abstract
- Defined in:
- lib/jamf/api/abstract_classes/singleton_resource.rb
Overview
This class is abstract.
A Singleton Resource in the API.
See Resource for details and required constants
Direct Known Subclasses
AppStoreCountryCodes, Authorization, ClientCheckInSettings, Locales, ReEnrollmentSettings, TimeZones
Class Method Summary collapse
-
.fetch(reload = false, cnx: Jamf.cnx) ⇒ Jamf::SingletonResource
Return a SingletonResource from the API, from the cache if already cached or retrieving from the API and caching it if neededl.
-
.flushcache(cnx: Jamf.cnx) ⇒ Object
fetch.
-
.new(*args, &block) ⇒ Object
extended
from Abstract
when any extended class or subclass of an extended class is instntiated check that it isn’t in the abstract list.
Instance Method Summary collapse
-
#exist? ⇒ Boolean
singltons always exist.
-
#rsrc_path ⇒ Object
only have one path.
Constructor Details
This class inherits a constructor from Jamf::JSONObject
Class Method Details
.fetch(reload = false, cnx: Jamf.cnx) ⇒ Jamf::SingletonResource
Return a SingletonResource from the API, from the cache if already cached or retrieving from the API and caching it if neededl
58 59 60 61 62 63 64 65 |
# File 'lib/jamf/api/abstract_classes/singleton_resource.rb', line 58 def self.fetch(reload = false, cnx: Jamf.cnx) cnx.singleton_cache[self] = nil if reload cached = cnx.singleton_cache[self] return cached if cached data = cnx.get rsrc_path cnx.singleton_cache[self] = new data, cnx: cnx end |
.flushcache(cnx: Jamf.cnx) ⇒ Object
fetch
67 68 69 70 |
# File 'lib/jamf/api/abstract_classes/singleton_resource.rb', line 67 def self.flushcache(cnx: Jamf.cnx) validate_not_abstract cnx.singleton_cache[self] = nil end |
Instance Method Details
#exist? ⇒ Boolean
singltons always exist
81 82 83 |
# File 'lib/jamf/api/abstract_classes/singleton_resource.rb', line 81 def exist? true end |
#rsrc_path ⇒ Object
only have one path
76 77 78 |
# File 'lib/jamf/api/abstract_classes/singleton_resource.rb', line 76 def rsrc_path self.class.rsrc_path end |