Sha256: 1eca4bf28822e3c0f7ba58f473518a86490c1923bc70d7b5fd2c83b0d4320a95

Contents?: true

Size: 930 Bytes

Versions: 12

Compression:

Stored size: 930 Bytes

Contents

# frozen_string_literal: true

require 'easy/jsonapi/request/query_param_collection/filter_param'

module JSONAPI
  class Request
    class QueryParamCollection < NameValuePairCollection
      class FilterParam < QueryParam
        # Represents an individual Filtering scheme for the filter query param(s) used.
        class Filter

          attr_reader :resource_type, :filter

          # @param resource_type [String] The type to filter
          # @param filter [String] The filter algorithm
          def initialize(resource_type, filter)
            @resource_type = resource_type
            @filter = filter
          end

          # @return [String] The value of the filter
          def value
            @filter
          end

          # Represent filter as an individual filter query param
          def to_s
            "filter[#{@resource_type}]=#{@filter}"
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
easy-jsonapi-1.0.11 lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb
easy-jsonapi-1.0.10 lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb
easy-jsonapi-1.0.9 lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb
easy-jsonapi-1.0.8 lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb
easy-jsonapi-1.0.7 lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb
easy-jsonapi-1.0.6 lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb
easy-jsonapi-1.0.5 lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb
easy-jsonapi-1.0.4 lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb
easy-jsonapi-1.0.3 lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb
easy-jsonapi-1.0.2 lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb
easy-jsonapi-1.0.1 lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb
easy-jsonapi-1.0.0 lib/easy/jsonapi/request/query_param_collection/filter_param/filter.rb