Module Grape::Entity::DSL::ClassMethods
In: lib/grape_entity/entity.rb

Methods

Public Instance methods

Call this to make exposures to the entity for this Class. Can be called with symbols for the attributes to expose, a block that yields the full Entity DSL (See Grape::Entity), or both.

@example Symbols only.

  class User
    include Grape::Entity::DSL

    entity :name, :email
  end

@example Mixed.

  class User
    include Grape::Entity::DSL

    entity :name, :email do
      expose :latest_status, using: Status::Entity, if: :include_status
      expose :new_attribute, if: { version: 'v2' }
    end
  end

Returns the automatically-created entity class for this Class.

[Validate]