Class: JSONAPI::Request::QueryParamCollection::FilterParam::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb

Overview

Represents an individual Filtering scheme for the filter query param(s) used.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource_type, filter) ⇒ Filter

Returns a new instance of Filter.

Parameters:

  • resource_type (String)

    The type to filter

  • filter (String)

    The filter algorithm



16
17
18
19
# File 'lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb', line 16

def initialize(resource_type, filter)
  @resource_type = resource_type
  @filter = filter
end

Instance Attribute Details

#filterObject (readonly)

Returns the value of attribute filter.



12
13
14
# File 'lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb', line 12

def filter
  @filter
end

#resource_typeObject (readonly)

Returns the value of attribute resource_type.



12
13
14
# File 'lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb', line 12

def resource_type
  @resource_type
end

Instance Method Details

#to_sObject

Represent filter as an individual filter query param



27
28
29
# File 'lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb', line 27

def to_s
  "filter[#{@resource_type}]=#{@filter}"
end

#valueString

Returns The value of the filter.

Returns:

  • (String)

    The value of the filter



22
23
24
# File 'lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb', line 22

def value
  @filter
end