Class: JSONAPI::Request::QueryParamCollection::FieldsParam::Fieldset
- Inherits:
-
Object
- Object
- JSONAPI::Request::QueryParamCollection::FieldsParam::Fieldset
- Defined in:
- lib/easy/jsonapi/request/query_param_collection/fields_param/fieldset.rb
Overview
Collection of fields related to specific resource objects
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#resource_type ⇒ Object
readonly
Returns the value of attribute resource_type.
Instance Method Summary collapse
-
#initialize(resource_type, field_arr = []) ⇒ Fieldset
constructor
A new instance of Fieldset.
-
#to_s ⇒ Object
Represention of Fieldset as a string where fields are comma separated strings.
Constructor Details
#initialize(resource_type, field_arr = []) ⇒ Fieldset
Returns a new instance of Fieldset.
18 19 20 21 |
# File 'lib/easy/jsonapi/request/query_param_collection/fields_param/fieldset.rb', line 18 def initialize(resource_type, field_arr = []) @resource_type = resource_type @fields = field_arr end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
14 15 16 |
# File 'lib/easy/jsonapi/request/query_param_collection/fields_param/fieldset.rb', line 14 def fields @fields end |
#resource_type ⇒ Object (readonly)
Returns the value of attribute resource_type.
14 15 16 |
# File 'lib/easy/jsonapi/request/query_param_collection/fields_param/fieldset.rb', line 14 def resource_type @resource_type end |
Instance Method Details
#to_s ⇒ Object
Represention of Fieldset as a string where fields
are comma separated strings
25 26 27 28 |
# File 'lib/easy/jsonapi/request/query_param_collection/fields_param/fieldset.rb', line 25 def to_s pre_string = "fields[#{@resource_type}]=" JSONAPI::Utility.to_string_collection(@fields, delimiter: ',', pre_string: pre_string) end |