Sha256: 5691abac4bd321f7f7276fe4f80bdc2c1295e0407df3f68cb0335bd9e1dedef6

Contents?: true

Size: 897 Bytes

Versions: 12

Compression:

Stored size: 897 Bytes

Contents

# frozen_string_literal: true

require 'easy/jsonapi/request/query_param_collection/query_param'
require 'easy/jsonapi/utility'

module JSONAPI
  class Request
    class QueryParamCollection < JSONAPI::NameValuePairCollection
      
      # Used to create a unique Filter JSONAPI::Request::QueryParamCollection::QueryParam
      class FilterParam < QueryParam
        
        # @param filter_arr [Array<JSONAPI::Request::QueryParamCollection::FilterParam::Filter>]
        #   The array of filters included in the query string. Ex: filter[articles]=(posted_date == today)
        def initialize(filter_arr)
          super('filters', filter_arr)
        end

        # Represent each filter separated by a & value
        #   Ex: "#{filter1.to_s}&{filter2.to_s}&..."
        def to_s
          JSONAPI::Utility.to_string_collection(value, delimiter: '&')
        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.rb
easy-jsonapi-1.0.10 lib/easy/jsonapi/request/query_param_collection/filter_param.rb
easy-jsonapi-1.0.9 lib/easy/jsonapi/request/query_param_collection/filter_param.rb
easy-jsonapi-1.0.8 lib/easy/jsonapi/request/query_param_collection/filter_param.rb
easy-jsonapi-1.0.7 lib/easy/jsonapi/request/query_param_collection/filter_param.rb
easy-jsonapi-1.0.6 lib/easy/jsonapi/request/query_param_collection/filter_param.rb
easy-jsonapi-1.0.5 lib/easy/jsonapi/request/query_param_collection/filter_param.rb
easy-jsonapi-1.0.4 lib/easy/jsonapi/request/query_param_collection/filter_param.rb
easy-jsonapi-1.0.3 lib/easy/jsonapi/request/query_param_collection/filter_param.rb
easy-jsonapi-1.0.2 lib/easy/jsonapi/request/query_param_collection/filter_param.rb
easy-jsonapi-1.0.1 lib/easy/jsonapi/request/query_param_collection/filter_param.rb
easy-jsonapi-1.0.0 lib/easy/jsonapi/request/query_param_collection/filter_param.rb