Method: Insights::API::Common::Filter#initialize
- Defined in:
- lib/insights/api/common/filter.rb
#initialize(model, raw_filter, api_doc_definition, extra_filterable_attributes = {}) ⇒ Filter
Instantiates a new Filter object
Parameters:
- model
-
An AR model that acts as the base collection to be filtered
- raw_filter
-
The filter from the request query string
- api_doc_definition
-
The documented object definition from the OpenAPI doc
- extra_filterable_attributes
-
Attributes that can be used for filtering but are not documented in the OpenAPI doc. Something like ‘=> {“type” => “string”}`
Returns:
A new Filter object, call #apply to get the filtered set of results.
26 27 28 29 30 31 32 |
# File 'lib/insights/api/common/filter.rb', line 26 def initialize(model, raw_filter, api_doc_definition, extra_filterable_attributes = {}) @raw_filter = raw_filter @api_doc_definition = api_doc_definition @arel_table = model.arel_table @extra_filterable_attributes = extra_filterable_attributes @model = model end |