Module: Surveygizmo::Client::Filter

Included in:
Surveygizmo::Client
Defined in:
lib/surveygizmo/client/filter.rb

Overview

Defines methods related to filtering search results

Instance Method Summary collapse

Instance Method Details

#formatted_filters(*filters) ⇒ Object

Format filters for the request querystring TODO: Not yet recursive

Parameters:

  • filters (Hash)

    Filter(s) used to refine search



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/surveygizmo/client/filter.rb', line 10

def formatted_filters(*filters)
  filters.flatten!
  if filters.nil? || filters.empty? || filters.first.nil?
    {}
  else
    {}.tap do |params|
      filters.each_with_index do |filter, index|
        filter.each { |key, value| params["filter[#{key}][#{index}]"] = value }
      end
    end
  end
end