module Jamf::Sortable

Currently no need to mix this in anywhere.

Constants

SORT_PARAM_PREFIX

Public Class Methods

parse_url_sort_param(sort) click to toggle source

generate the sort params for the url This is callable from anywhere without mixing in

   # File lib/jamf/api/jamf_pro/mixins/sortable.rb
34 def self.parse_url_sort_param(sort)
35   return sort if sort.nil? || sort.start_with?(SORT_PARAM_PREFIX)
36 
37   case sort
38   when String
39     "&sort=#{CGI.escape sort}"
40   when Array
41     "&sort=#{CGI.escape sort.join(',')}"
42   else
43     raise ArgumentError, 'sort criteria must be a String or Array of Strings'
44   end
45 end