Class: Fiddler::Formatters::SearchRequestFormatter

Inherits:
BaseFormatter
  • Object
show all
Defined in:
lib/fiddler/formatters/search_request_formatter.rb

Class Method Summary collapse

Methods inherited from BaseFormatter

format_string

Class Method Details

.format(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fiddler/formatters/search_request_formatter.rb', line 5

def format(options={})
   result = Hash.new
   
   unless options.empty?
      query = Array.new

      add_array_or_single(options, query, :queue)
      add_array_or_single(options, query, :status)
      add_text_search_fields(options,query)
      add_date_search_fields(options,query)

      query << options[:conditions].to_s.chomp if options[:conditions]

      result = { "query" => query.join(" AND "), :format => "l"}
   end
   result
end