Class: JSONAPI::Request::QueryParamCollection::SortParam

Inherits:
QueryParam show all
Defined in:
lib/easy/jsonapi/request/query_param_collection/sort_param.rb

Overview

Used to create a unique Sort JSONAPI::Request::QueryParamCollection::QueryParam

Instance Attribute Summary

Attributes inherited from Item

#item

Instance Method Summary collapse

Methods inherited from QueryParam

#name=, #value=

Methods inherited from NameValuePair

#name, #name=, #to_h, #value, #value=

Methods inherited from Item

#to_h

Constructor Details

#initialize(res_field_arr) ⇒ SortParam

Returns a new instance of SortParam.

Parameters:

  • res_field_arr (Array<JSONAPI::Field] The resource fields to sort the primary resources by.)

    es_field_arr [Array<JSONAPI::Field] The resource fields to sort the primary resources by.



13
14
15
# File 'lib/easy/jsonapi/request/query_param_collection/sort_param.rb', line 13

def initialize(res_field_arr)
  super('sorts', res_field_arr)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class JSONAPI::Item

Instance Method Details

#to_sObject

Represent sort as query string



18
19
20
# File 'lib/easy/jsonapi/request/query_param_collection/sort_param.rb', line 18

def to_s
  "sort=#{JSONAPI::Utility.to_string_collection(value, delimiter: ',')}"
end