def parse_filter(filter)
      filter.is_a?(Hash) ? URI.encode(filter.to_json) : filter
    end
def parse_filter(filter)
      filter.is_a?(Hash) ? URI.encode(filter.to_json) : filter
    end
Parses a filter object for use in a query string.
 @param filter [String,Hash] The filter object to parse.
 @return [String] Query-friendly filter object. Or the `filter`
   parameter as-is if it failed to parse.