def all_pages(type, query = {})
    query = force_case(query).reject {|k, v| v.nil? }
    query["startindex"], info, rk = 1, [], jkey(:resources)
    while true
      qinfo = query(type, query)
      raise BadResponse unless qinfo[rk]
      return info if qinfo[rk].empty?
      info.concat(qinfo[rk])
      total = qinfo[jkey :totalresults]
      return info unless total && total > info.length
      unless qinfo[jkey :startindex] && qinfo[jkey :itemsperpage]
        raise BadResponse, "incomplete #{type} pagination data from #{@target}"
      end
      query["startindex"] = info.length + 1
    end
  end
def all_pages(type, query = {})
    query = force_case(query).reject {|k, v| v.nil? }
    query["startindex"], info, rk = 1, [], jkey(:resources)
    while true
      qinfo = query(type, query)
      raise BadResponse unless qinfo[rk]
      return info if qinfo[rk].empty?
      info.concat(qinfo[rk])
      total = qinfo[jkey :totalresults]
      return info unless total && total > info.length
      unless qinfo[jkey :startindex] && qinfo[jkey :itemsperpage]
        raise BadResponse, "incomplete #{type} pagination data from #{@target}"
      end
      query["startindex"] = info.length + 1
    end
  end
Collects all pages of entries from a query
 @param type (see #query)
 @param [Hash] query may contain the following keys:
   * +attributes+: a comma or space separated list of attribute names to be
     returned for each object that matches the filter. If no attribute
     list is given, all attributes are returned.
   * +filter+: a filter to select which objects are returned. See
     {http://www.simplecloud.info/specs/draft-scim-api-01.html#query-resources}
 @return [Array] results