2020-03-13 15:44:24 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module API
|
|
|
|
module Entities
|
|
|
|
class PersonalAccessToken < Grape::Entity
|
2023-01-13 00:05:48 +05:30
|
|
|
expose :id, documentation: { type: 'integer', example: 2 }
|
|
|
|
expose :name, documentation: { type: 'string', example: 'John Doe' }
|
|
|
|
expose :revoked, documentation: { type: 'boolean' }
|
|
|
|
expose :created_at, documentation: { type: 'dateTime' }
|
|
|
|
expose :scopes, documentation: { type: 'array', example: ['api'] }
|
|
|
|
expose :user_id, documentation: { type: 'integer', example: 3 }
|
|
|
|
expose :last_used_at, documentation: { type: 'dateTime', example: '2020-08-31T15:53:00.073Z' }
|
|
|
|
expose :active?, as: :active, documentation: { type: 'boolean' }
|
|
|
|
expose :expires_at, documentation:
|
|
|
|
{ type: 'dateTime', example: '2020-08-31T15:53:00.073Z' } do |personal_access_token|
|
2020-03-13 15:44:24 +05:30
|
|
|
personal_access_token.expires_at ? personal_access_token.expires_at.strftime("%Y-%m-%d") : nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|