lib/contentful/management/support.rb in contentful-management-1.4.0 vs lib/contentful/management/support.rb in contentful-management-1.5.0

- old
+ new

@@ -15,9 +15,20 @@ oldval = oldval.to_hash if oldval.respond_to?(:to_hash) newval = newval.to_hash if newval.respond_to?(:to_hash) oldval.class.to_s == 'Hash' && newval.class.to_s == 'Hash' ? deep_hash_merge(oldval, newval) : newval end end + + def normalize_select!(parameters) + return parameters unless parameters.key?(:select) + + parameters[:select] = parameters[:select].split(',').map(&:strip) if parameters[:select].is_a? String + parameters[:select] = parameters[:select].reject { |p| p.start_with?('sys.') } + parameters[:select] << 'sys' unless parameters[:select].include?('sys') + parameters[:select] = parameters[:select].join(',') + + parameters + end end end end end