Class: Jamf::SingletonResource Abstract
- Inherits:
-
Resource
- Object
- JSONObject
- Resource
- Jamf::SingletonResource
- Extended by:
- BaseClass
- Defined in:
- lib/jamf/api/base_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
Class Method Summary collapse
-
.allocate(*args, &block) ⇒ Object
extended
from BaseClass
Can't allocate if base class.
- .base_class? ⇒ Boolean extended from BaseClass
-
.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 BaseClass
Can't instantiate if base_class.
-
.stop_if_base_class(action = DEFAULT_ACTION) ⇒ Object
extended
from BaseClass
raise an exception if this class is a base class.
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
.allocate(*args, &block) ⇒ Object Originally defined in module BaseClass
Can't allocate if base class
.base_class? ⇒ Boolean Originally defined in module BaseClass
.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 66 |
# File 'lib/jamf/api/base_classes/singleton_resource.rb', line 58 def self.fetch(reload = false, cnx: Jamf.cnx) stop_if_base_class 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 |
Instance Method Details
#exist? ⇒ Boolean
singltons always exist
82 83 84 |
# File 'lib/jamf/api/base_classes/singleton_resource.rb', line 82 def exist? true end |
#rsrc_path ⇒ Object
only have one path
77 78 79 |
# File 'lib/jamf/api/base_classes/singleton_resource.rb', line 77 def rsrc_path self.class.rsrc_path end |