Class: Api::V1::InfoController
- Inherits:
-
BaseController
- Object
- BaseController
- Api::V1::InfoController
- Defined in:
- app/controllers/api/v1/info_controller.rb
Instance Method Summary collapse
- #roles ⇒ Object
-
#token ⇒ Object
api :GET, '/api/v1/info/token', "Given auth credentials, in HTTP_BASIC form, it returns the AUTH_TOKEN, email and id of the user which performed the authentication." api!.
-
#version ⇒ Object
api :GET, '/api/v1/info/version', "Just prints the APPVERSION." api!.
Instance Method Details
#roles ⇒ Object
26 27 28 |
# File 'app/controllers/api/v1/info_controller.rb', line 26 def roles render json: ROLES.to_json, status: 200 end |
#token ⇒ Object
api :GET, '/api/v1/info/token', "Given auth credentials, in HTTP_BASIC form, it returns the AUTH_TOKEN, email and id of the user which performed the authentication." api!
15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/api/v1/info_controller.rb', line 15 def token render json: { token: @current_user.authentication_token, email: @current_user.email, roles: @current_user.roles, admin: @current_user.admin, third_party: @current_user.third_party, id: @current_user.id }.to_json, status: 200 end |
#version ⇒ Object
api :GET, '/api/v1/info/version', "Just prints the APPVERSION." api!
6 7 8 9 10 |
# File 'app/controllers/api/v1/info_controller.rb', line 6 def version render json: { version: (APPVERSION rescue "No version specified for this app, please add an APPVERSION constant to an initializer to start versioning the application.") }.to_json, status: 200 end |