Class: Api::V1::InfoController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/api/v1/info_controller.rb

Instance Method Summary collapse

Instance Method Details

#available_rolesObject

api :GET, '/api/v1/info/available_roles', "Given auth credentials, in HTTP_BASIC form, it returns the roles list



24
25
26
# File 'app/controllers/api/v1/info_controller.rb', line 24

def available_roles
  render json: ROLES.to_json, status: 200
end

#tokenObject

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
# File 'app/controllers/api/v1/info_controller.rb', line 15

def token
  render json: {
    token: @current_user.authentication_token,
    email: @current_user.email
  }.to_json, status: 200
end

#versionObject

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