Sha256: febb19a91798222117c735edd7b006461d21825da0bfd7d1904597b73e8ce4ab
Contents?: true
Size: 925 Bytes
Versions: 6
Compression:
Stored size: 925 Bytes
Contents
module {{namespace_module}} module Accounts module Show class Normalizer include Shogun::Normalizer include Accounts METADATA = %w|id fields| LIST_DELIMITER = /\s*,\s*/ DEFAULT_FIELDS = %w|updated_at destroyed_at href created_at name email username signature id| AUTOMATIC_FIELDS = %w|id href| def initialize(raw:) @id = raw["id"] @fields = raw["fields"] end def id @id end def fields case when @fields.is_a?(String) && @fields.match(LIST_DELIMITER) @fields.split(LIST_DELIMITER) + AUTOMATIC_FIELDS when @fields.is_a?(Array) @fields + AUTOMATIC_FIELDS when @fields.is_a?(String) [@fields.strip] + AUTOMATIC_FIELDS else DEFAULT_FIELDS end.uniq end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems