Merge pull request #1650 from betagouv/better-api

Fix authentication token description
This commit is contained in:
Frederic Merizen 2018-03-16 10:15:43 +01:00 committed by GitHub
commit 7c7f28aea6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 10 deletions

View file

@ -1,6 +1,10 @@
class API::V1::DossiersController < APIController
DEFAULT_PAGE_SIZE = 100
resource_description do
description AUTHENTICATION_TOKEN_DESCRIPTION
end
api :GET, '/procedures/:procedure_id/dossiers/', 'Liste de tous les dossiers d\'une procédure'
param :procedure_id, Integer, desc: "L'identifiant de la procédure", required: true
param :page, String, desc: "Numéro de la page", required: false

View file

@ -1,4 +1,8 @@
class API::V1::ProceduresController < APIController
resource_description do
description AUTHENTICATION_TOKEN_DESCRIPTION
end
api :GET, '/procedures/:id', 'Informations concernant une procédure'
param :id, Integer, desc: "L'identifiant de la procédure", required: true
error code: 401, desc: "Non authorisé"

View file

@ -1,16 +1,14 @@
class APIController < ApplicationController
before_action :authenticate_user
before_action :default_format_json
resource_description do
description <<-EOS
AUTHENTICATION_TOKEN_DESCRIPTION = <<-EOS
L'authentification de l'API se fait via un header HTTP :
```
Authorization: Bearer &lt;Token administrateur&gt;
```
EOS
end
before_action :authenticate_user
before_action :default_format_json
def authenticate_user
if !valid_token?