Class: RangeRequest

Inherits:
Struct show all
Defined in:
lib/dto/search/range_request.rb

Overview

Returns the minium and maximum values currently in 3taps for the given fields that match the given Common Search Criteria. The purpose of the range method is to provide developers with sensible values for range-based UI filters.

range_request = RangeRequest.new search_request = SearchRequest.new search_request.category = ‘VAUT’ search_request.annotations = => “porsche” range_request.search_request = search_request range_request.fields = [‘year’, ‘price’]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

from_array, from_hash

Instance Attribute Details

#fieldsObject

Returns the value of attribute fields

Returns:

  • (Object)

    the current value of fields



12
13
14
# File 'lib/dto/search/range_request.rb', line 12

def fields
  @fields
end

#search_requestObject

Returns the value of attribute search_request

Returns:

  • (Object)

    the current value of search_request



12
13
14
# File 'lib/dto/search/range_request.rb', line 12

def search_request
  @search_request
end

Instance Method Details

#add_field(field) ⇒ Object



14
15
16
# File 'lib/dto/search/range_request.rb', line 14

def add_field(field)
  fields << field
end

#query_paramsObject



18
19
20
21
22
# File 'lib/dto/search/range_request.rb', line 18

def query_params
  query_params = search_request.query_params
  query_params += "fields=#{CGI.escape(fields.join(','))}"
  query_params
end