Module: Jamf::Filterable
- Included in:
- InventoryPreloadRecord, JpBuilding
- Defined in:
- lib/jamf/api/jamf_pro/mixins/filterable.rb
Overview
process filter strings for resources with filter request parameters
This should be extended into CollectionResources whose LIST_PATH is filterable
Classes doing so must define the FILTER_KEYS constant, an Array of Symbols of keys from OAPI_PROPERTIES which can be used in filters.
Constant Summary collapse
- FILTER_PARAM_PREFIX =
'&filter='.freeze
Class Method Summary collapse
- .extended(extender) ⇒ Object
-
.parse_url_filter_param(filter) ⇒ Object
generate the RSQL filter to put into the url This is callable from anywhere without mixing in.
Instance Method Summary collapse
Class Method Details
.extended(extender) ⇒ Object
36 37 38 |
# File 'lib/jamf/api/jamf_pro/mixins/filterable.rb', line 36 def self.extended(extender) Jamf.load_msg "--> #{extender} is extending Jamf::Filterable" end |
.parse_url_filter_param(filter) ⇒ Object
generate the RSQL filter to put into the url This is callable from anywhere without mixing in.
44 45 46 47 48 |
# File 'lib/jamf/api/jamf_pro/mixins/filterable.rb', line 44 def self.parse_url_filter_param(filter) return filter if filter.nil? || filter.start_with?(FILTER_PARAM_PREFIX) "#{FILTER_PARAM_PREFIX}#{CGI.escape filter}" end |
Instance Method Details
#filter_keys ⇒ Object
50 51 52 |
# File 'lib/jamf/api/jamf_pro/mixins/filterable.rb', line 50 def filter_keys defined?(self::FILTER_KEYS) ? self::FILTER_KEYS : [] end |