module Jamf::Matchable

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

Constants

MATCHABLE

Constants

MATCH_RSRC

Public Instance Methods

match(term, api: nil, cnx: Jamf.cnx) click to toggle source

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.

@param term the term to match.

@return [Array<Hash>] the item smatched.

   # File lib/jamf/api/classic/api_objects/matchable.rb
89 def match(term, api: nil, cnx: Jamf.cnx)
90   cnx = api if api
91 
92   raise Jamf::InvalidDataError, "Match term may not be empty" if term.to_s.empty?
93 
94   rsrc = "#{self::RSRC_BASE}/#{Jamf::Matchable::MATCH_RSRC}/#{CGI.escape term.to_s}"
95   cnx.c_get(rsrc)[self::RSRC_LIST_KEY]
96 end