Sha256: a2b4e0a7df95e226922ac0eb56dbaead89b2f6c11938b68f7effb19237eb4764
Contents?: true
Size: 1.01 KB
Versions: 12
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true require 'easy/jsonapi/name_value_pair_collection' require 'easy/jsonapi/request/query_param_collection/fields_param' require 'easy/jsonapi/utility' module JSONAPI class Request class QueryParamCollection < NameValuePairCollection class FieldsParam < QueryParam # Collection of fields related to specific resource objects class Fieldset attr_reader :resource_type, :fields # @param field_arr [Array<JSONAPI::Field>] # A fieldset is a collection of Resource Fields def initialize(resource_type, field_arr = []) @resource_type = resource_type @fields = field_arr end # Represention of Fieldset as a string where fields # are comma separated strings def to_s pre_string = "fields[#{@resource_type}]=" JSONAPI::Utility.to_string_collection(@fields, delimiter: ',', pre_string: pre_string) end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems