Class: JSONAPI::Request::QueryParamCollection::FieldsParam

Inherits:
QueryParam show all
Defined in:
lib/easy/jsonapi/request/query_param_collection/fields_param.rb,
lib/easy/jsonapi/request/query_param_collection/fields_param/fieldset.rb

Overview

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

Defined Under Namespace

Classes: Fieldset

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(fieldset_arr) ⇒ FieldsParam

Returns a new instance of FieldsParam.

Parameters:



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

def initialize(fieldset_arr)
  super('fields', fieldset_arr)
end

Dynamic Method Handling

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

Instance Method Details

#fieldsetsArray<JSONAPI::Request::QueryParamCollection::FieldsParam::Fieldset>

Alias to parent #value method



19
20
21
# File 'lib/easy/jsonapi/request/query_param_collection/fields_param.rb', line 19

def fieldsets
  value
end

#to_sObject

Returns The the query string representation of the included fieldsets ex: “#JSONAPI::Request::QueryParamCollection::FieldsParam.fieldset1fieldset1.to_s&JSONAPI::Request::QueryParamCollection::FieldsParam.fieldset2fieldset2.to_s&…”.

Returns:

  • The the query string representation of the included fieldsets ex: “#JSONAPI::Request::QueryParamCollection::FieldsParam.fieldset1fieldset1.to_s&JSONAPI::Request::QueryParamCollection::FieldsParam.fieldset2fieldset2.to_s&…”



25
26
27
# File 'lib/easy/jsonapi/request/query_param_collection/fields_param.rb', line 25

def to_s
  JSONAPI::Utility.to_string_collection(value, delimiter: '&')
end