Module: Jamf::Matchable
- Included in:
- Computer, MobileDevice
- Defined in:
- lib/jamf/api/classic/api_objects/matchable.rb
Overview
Simple match-based searches in the JSS.
The API offers a simple match-based search for some objects, analagous to the search field at the top of the Computers, MobileDevices, and Users sections of the JSS WebApp.
When a class extends itself with this module, it will acquire the .match Class Method which performs a match and returns an Array of matching items.
This module should be mixed in with #extend, not #include
Constant Summary collapse
- MATCHABLE =
Constants
true
- MATCH_RSRC =
"match"
Instance Method Summary collapse
-
#match(term, api: nil, cnx: Jamf.cnx) ⇒ Array<Hash>
Perform a match, returning an Array of Hashes, one for each item matched.
Instance Method Details
#match(term, api: nil, cnx: Jamf.cnx) ⇒ Array<Hash>
Perform a match, returning an Array of Hashes, one for each item matched
At the moment, it appears the search is an “exact match” search regardless of the prefs of the user connected to the API.
89 90 91 92 93 94 95 96 |
# File 'lib/jamf/api/classic/api_objects/matchable.rb', line 89 def match(term, api: nil, cnx: Jamf.cnx) cnx = api if api raise Jamf::InvalidDataError, "Match term may not be empty" if term.to_s.empty? rsrc = "#{self::RSRC_BASE}/#{Jamf::Matchable::MATCH_RSRC}/#{CGI.escape term.to_s}" cnx.c_get(rsrc)[self::RSRC_LIST_KEY] end |