Sha256: a5b27ad19c2d42abdc53ac925a59b21be9c2c27e3f692980ee21af6a68807d4c

Contents?: true

Size: 1.01 KB

Versions: 9

Compression:

Stored size: 1.01 KB

Contents

require 'authorization'

module People
  class UserSerializer < ActiveModel::Serializer
    embed :ids, include: true

    attributes :id
    attributes :username
    attributes :email
    attributes :created_at
    attributes :updated_at
    has_many :tokens

    def include_id?
      return ::Authorization::People::User.include_id?(current_user,object,@options)
    end

    def include_email?
      return ::Authorization::People::User.include_email?(current_user,object,@options)
    end

    def include_username?
      return ::Authorization::People::User.include_username?(current_user,object,@options)
    end

    def include_created_at?
      return ::Authorization::People::User.include_created_at?(current_user,object,@options)
    end

    def include_updated_at?
      return ::Authorization::People::User.include_updated_at?(current_user,object,@options)
    end

    def include_associations!
      include! :tokens if ::Authorization::People::User.include_tokens?(current_user,object,@options)
    end

  end
end

Version data entries

9 entries across 7 versions & 1 rubygems

Version Path
json_voorhees-0.2.3 test/test_app/engines/people/app/serializers/people/user_serializer.rb
json_voorhees-0.2.2 test/test_app/engines/people/app/serializers/people/user_serializer.rb
json_voorhees-0.2.1 test/test_app/engines/people/app/serializers/people/user_serializer.rb
json_voorhees-0.2.0 lib/generators/json_voorhees/setup_app/templates/user/user_serializer.rb
json_voorhees-0.2.0 test/test_app/engines/people/app/serializers/people/user_serializer.rb
json_voorhees-0.1.0 test/test_app/engines/people/app/serializers/people/user_serializer.rb
json_voorhees-0.1.0 lib/generators/json_voorhees/setup_app/templates/user/user_serializer.rb
json_voorhees-0.0.2 lib/generators/json_voorhees/setup_app/templates/user/user_serializer.rb
json_voorhees-0.0.1 lib/generators/json_voorhees/setup_app/templates/user/user_serializer.rb