Sha256: 46ff76135b82b75cc01e5c1d919e429eda9a8fb9ca4e0299718adca21b58837a

Contents?: true

Size: 1.05 KB

Versions: 12

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

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

module JSONAPI
  class Request
    class QueryParamCollection < JSONAPI::NameValuePairCollection
      # Used to create a unique Fieldset JSONAPI::Request::QueryParamCollection::QueryParam
      class FieldsParam < QueryParam
        
        # @param fieldset_arr [Array<JSONAPI::Request::QueryParamCollection::FieldsParam::Fieldset>]
        #   The array of fieldsets found in the query string. Ex: fields[resource]=res_field1,res_field2
        def initialize(fieldset_arr)
          super('fields', fieldset_arr)
        end

        # Alias to parent #value method
        # @return [Array<JSONAPI::Request::QueryParamCollection::FieldsParam::Fieldset>]
        def fieldsets
          value
        end

        # @return The the query string representation of the included fieldsets
        #   ex: "#{fieldset1.to_s}&{fieldset2.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/fields_param.rb
easy-jsonapi-1.0.10 lib/easy/jsonapi/request/query_param_collection/fields_param.rb
easy-jsonapi-1.0.9 lib/easy/jsonapi/request/query_param_collection/fields_param.rb
easy-jsonapi-1.0.8 lib/easy/jsonapi/request/query_param_collection/fields_param.rb
easy-jsonapi-1.0.7 lib/easy/jsonapi/request/query_param_collection/fields_param.rb
easy-jsonapi-1.0.6 lib/easy/jsonapi/request/query_param_collection/fields_param.rb
easy-jsonapi-1.0.5 lib/easy/jsonapi/request/query_param_collection/fields_param.rb
easy-jsonapi-1.0.4 lib/easy/jsonapi/request/query_param_collection/fields_param.rb
easy-jsonapi-1.0.3 lib/easy/jsonapi/request/query_param_collection/fields_param.rb
easy-jsonapi-1.0.2 lib/easy/jsonapi/request/query_param_collection/fields_param.rb
easy-jsonapi-1.0.1 lib/easy/jsonapi/request/query_param_collection/fields_param.rb
easy-jsonapi-1.0.0 lib/easy/jsonapi/request/query_param_collection/fields_param.rb