Module: JSS::Matchable
- Included in:
- Computer, MobileDevice
- Defined in:
- lib/jss/api_object/matchable.rb,
lib/jss.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: JSS.api) ⇒ Array<Hash>
Perform a match, returning an Array of Hashes, one for each item matched.
Instance Method Details
#match(term, api: JSS.api) ⇒ 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 |
# File 'lib/jss/api_object/matchable.rb', line 89 def match(term, api: JSS.api ) raise JSS::InvalidDataError, "Match term may not be empty" if term.to_s.empty? rsrc = "#{self::RSRC_BASE}/#{JSS::Matchable::MATCH_RSRC}/#{CGI.escape term.to_s}" api.get_rsrc(rsrc)[self::RSRC_LIST_KEY] end |