update swagger api docs

This commit is contained in:
Xavier J 2016-02-22 15:22:59 +01:00
parent 8cce06168c
commit 321bdd38b5
4 changed files with 174 additions and 21 deletions

View file

@ -3,8 +3,33 @@ class API::V1::DossiersController < APIController
swagger_api :index do
summary "Récupérer la liste de ses dossiers."
param :path, :procedure_id, :integer, "Procédure ID"
param :query, :token, :integer, "Admin TOKEN"
notes <<-EOS
<pre>
<code>
{
"dossiers": [
{
"id": 1,
"nom_projet": "Dossier un",
"updated_at": "2016-02-18T12:49:41.105Z"
},
{
"id": 2,
"nom_projet": "Dossier de test",
"updated_at": "2016-02-08T18:36:49.394Z"
}
],
"pagination": {
"page": 1,
"resultats_par_page": 12,
"nombre_de_page": 1
}
}
</code>
</pre>
EOS
param :path, :procedure_id, :integer, :required, "Procédure ID"
param :query, :token, :integer, :required, "Admin TOKEN"
response :ok, "Success", :Dossier
response :unauthorized
response :not_found
@ -12,12 +37,58 @@ class API::V1::DossiersController < APIController
swagger_api :show do
summary "Récupérer le détails d'un dossier."
param :path, :procedure_id, :integer, "Procédure ID"
param :path, :id, :integer, "Dossier ID"
param :query, :token, :integer, "Admin TOKEN"
notes <<-EOS
<pre>
<code>
{
"dossier": {
"id": 2,
"nom_projet": "Projet de test",
"description": "Description de test",
"created_at": "2016-02-08T18:33:23.779Z",
"updated_at": "2016-02-08T18:36:49.394Z",
"archived": false,
"entreprise": {
"siren": "418166096",
"capital_social": 459356,
"numero_tva_intracommunautaire": "FR16418166096",
"forme_juridique": "SA à directoire (s.a.i.)",
"forme_juridique_code": "5699",
"nom_commercial": "OCTO-TECHNOLOGY",
"raison_sociale": "OCTO-TECHNOLOGY",
"siret_siege_social": "41816609600051",
"code_effectif_entreprise": "31",
"date_creation": "1998-03-31T22:00:00.000Z",
"nom": null,
"prenom": null
},
"etablissement": {
"siret": "41816609600051",
"siege_social": true,
"naf": "6202A",
"libelle_naf": "Conseil en systèmes et logiciels informatiques",
"adresse": "OCTO-TECHNOLOGY\\r\\n50 AV DES CHAMPS ELYSEES\\r\\n75008 PARIS 8\\r\\n",
"numero_voie": "50",
"type_voie": "AV",
"nom_voie": "DES CHAMPS ELYSEES",
"complement_adresse": null,
"code_postal": "75008",
"localite": "PARIS 8",
"code_insee_localite": "75108"
}
}
}
</code>
</pre>
EOS
param :path, :procedure_id, :integer, :required, "Procédure ID"
param :path, :id, :integer, :required, "Dossier ID"
param :query, :token, :integer, :required, "Admin TOKEN"
param_list :query, :format, :string, :optional, "Format de retour", [:json, :csv]
response :ok, "Success", :Dossier
response :unauthorized
response :not_found
response :not_acceptable
end
def index
@ -35,6 +106,9 @@ class API::V1::DossiersController < APIController
format.json { render json: dossier, status: 200 }
format.csv { render csv: dossier, status: 200 }
end
rescue ActionController::UnknownFormat
render json: {}, status: 406
rescue ActiveRecord::RecordNotFound => e
render json: {}, status: 404
end

View file

@ -4,8 +4,65 @@ class API::V1::ProceduresController < APIController
swagger_api :show do
summary "Récupérer la liste de ses procédures."
param :path, :id, :integer, "Procédure ID"
param :query, :token, :integer, "Admin TOKEN"
notes <<-EOS
<pre>
<code>
{
"procedure": {
"label": "zklenkgnjzk",
"link": "",
"id": 2,
"description": "nzgjenjkgzenkn",
"organisation": "",
"direction": "",
"archived": false,
"geographic_information": {
"use_api_carto": true,
"quartiers_prioritaires": false,
"cadastre": false
},
"types_de_champ": [
{
"id": 1,
"libelle": "fzeknfezkz",
"type_champ": "text",
"order_place": 0,
"description": "zgezgze"
},
{
"id": 2,
"libelle": "gzzgeez",
"type_champ": "text",
"order_place": 1,
"description": "zgezeg"
},
{
"id": 3,
"libelle": "zgezgzeg",
"type_champ": "text",
"order_place": 2,
"description": "gezgzeg"
}
],
"types_de_piece_justificative": [
{
"id": 1,
"libelle": "gzeezgzg",
"description": "gzeegz"
},
{
"id": 2,
"libelle": "gzgzeg",
"description": "gzeegz"
}
]
}
}
</code>
</pre>
EOS
param :path, :id, :integer, :required, "Procédure ID"
param :query, :token, :integer, :required, "Admin TOKEN"
response :ok, "Success", :Procedure
response :unauthorized
response :not_found

View file

@ -9,20 +9,21 @@
"operations": [
{
"summary": "Récupérer la liste de ses dossiers.",
"notes": "<pre>\n<code>\n{\n \"dossiers\": [\n {\n \"id\": 1,\n \"nom_projet\": \"Dossier un\",\n \"updated_at\": \"2016-02-18T12:49:41.105Z\"\n },\n {\n \"id\": 2,\n \"nom_projet\": \"Dossier de test\",\n \"updated_at\": \"2016-02-08T18:36:49.394Z\"\n }\n ],\n \"pagination\": {\n \"page\": 1,\n \"resultats_par_page\": 12,\n \"nombre_de_page\": 1\n }\n}\n</code>\n</pre>\n",
"parameters": [
{
"paramType": "path",
"name": "procedure_id",
"type": "integer",
"description": null,
"required": false
"description": "Procédure ID",
"required": true
},
{
"paramType": "query",
"name": "token",
"type": "integer",
"description": null,
"required": false
"description": "Admin TOKEN",
"required": true
}
],
"responseMessages": [
@ -52,27 +53,42 @@
"operations": [
{
"summary": "Récupérer le détails d'un dossier.",
"notes": "<pre>\n<code>\n{\n \"dossier\": {\n \"id\": 2,\n \"nom_projet\": \"Projet de test\",\n \"description\": \"Description de test\",\n \"created_at\": \"2016-02-08T18:33:23.779Z\",\n \"updated_at\": \"2016-02-08T18:36:49.394Z\",\n \"archived\": false,\n \"entreprise\": {\n \"siren\": \"418166096\",\n \"capital_social\": 459356,\n \"numero_tva_intracommunautaire\": \"FR16418166096\",\n \"forme_juridique\": \"SA à directoire (s.a.i.)\",\n \"forme_juridique_code\": \"5699\",\n \"nom_commercial\": \"OCTO-TECHNOLOGY\",\n \"raison_sociale\": \"OCTO-TECHNOLOGY\",\n \"siret_siege_social\": \"41816609600051\",\n \"code_effectif_entreprise\": \"31\",\n \"date_creation\": \"1998-03-31T22:00:00.000Z\",\n \"nom\": null,\n \"prenom\": null\n },\n \"etablissement\": {\n \"siret\": \"41816609600051\",\n \"siege_social\": true,\n \"naf\": \"6202A\",\n \"libelle_naf\": \"Conseil en systèmes et logiciels informatiques\",\n \"adresse\": \"OCTO-TECHNOLOGY\\r\\n50 AV DES CHAMPS ELYSEES\\r\\n75008 PARIS 8\\r\\n\",\n \"numero_voie\": \"50\",\n \"type_voie\": \"AV\",\n \"nom_voie\": \"DES CHAMPS ELYSEES\",\n \"complement_adresse\": null,\n \"code_postal\": \"75008\",\n \"localite\": \"PARIS 8\",\n \"code_insee_localite\": \"75108\"\n }\n }\n}\n</code>\n</pre>\n",
"parameters": [
{
"paramType": "path",
"name": "procedure_id",
"type": "integer",
"description": null,
"required": false
"description": "Procédure ID",
"required": true
},
{
"paramType": "path",
"name": "id",
"type": "integer",
"description": null,
"required": false
"description": "Dossier ID",
"required": true
},
{
"paramType": "query",
"name": "token",
"type": "integer",
"description": null,
"required": false
"description": "Admin TOKEN",
"required": true
},
{
"paramType": "query",
"name": "format",
"type": "string",
"description": "Format de retour",
"required": false,
"allowableValues": {
"valueType": "LIST",
"values": [
"json",
"csv"
]
}
}
],
"responseMessages": [
@ -90,6 +106,11 @@
"code": 404,
"responseModel": null,
"message": "Not Found"
},
{
"code": 406,
"responseModel": null,
"message": "Not Acceptable"
}
],
"nickname": "API::V1::Dossiers#show",

View file

@ -9,20 +9,21 @@
"operations": [
{
"summary": "Récupérer la liste de ses procédures.",
"notes": "<pre>\n <code>\n{\n \"procedure\": {\n \"label\": \"zklenkgnjzk\",\n \"link\": \"\",\n \"id\": 2,\n \"description\": \"nzgjenjkgzenkn\",\n \"organisation\": \"\",\n \"direction\": \"\",\n \"archived\": false,\n \"geographic_information\": {\n \"use_api_carto\": true,\n \"quartiers_prioritaires\": false,\n \"cadastre\": false\n },\n \"types_de_champ\": [\n {\n \"id\": 1,\n \"libelle\": \"fzeknfezkz\",\n \"type_champ\": \"text\",\n \"order_place\": 0,\n \"description\": \"zgezgze\"\n },\n {\n \"id\": 2,\n \"libelle\": \"gzzgeez\",\n \"type_champ\": \"text\",\n \"order_place\": 1,\n \"description\": \"zgezeg\"\n },\n {\n \"id\": 3,\n \"libelle\": \"zgezgzeg\",\n \"type_champ\": \"text\",\n \"order_place\": 2,\n \"description\": \"gezgzeg\"\n }\n ],\n \"types_de_piece_justificative\": [\n {\n \"id\": 1,\n \"libelle\": \"gzeezgzg\",\n \"description\": \"gzeegz\"\n },\n {\n \"id\": 2,\n \"libelle\": \"gzgzeg\",\n \"description\": \"gzeegz\"\n }\n ]\n }\n}\n</code>\n</pre>\n",
"parameters": [
{
"paramType": "path",
"name": "id",
"type": "integer",
"description": null,
"required": false
"description": "Procédure ID",
"required": true
},
{
"paramType": "query",
"name": "token",
"type": "integer",
"description": null,
"required": false
"description": "Admin TOKEN",
"required": true
}
],
"responseMessages": [