demarches-normaliennes/app/controllers/api/v1/procedures_controller.rb

80 lines
1.7 KiB
Ruby
Raw Normal View History

2015-12-21 17:51:49 +01:00
class API::V1::ProceduresController < APIController
2016-02-18 18:02:07 +01:00
swagger_controller :procedures, "Procédures"
swagger_api :show do
summary "Récupérer la liste de ses procédures."
2016-02-22 15:22:59 +01:00
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"
2016-02-18 18:02:07 +01:00
response :ok, "Success", :Procedure
response :unauthorized
response :not_found
end
def show
2015-12-21 17:51:49 +01:00
@procedure = current_administrateur.procedures.find(params[:id]).decorate
render json: @procedure
rescue ActiveRecord::RecordNotFound => e
Rails.logger.error(e.message)
render json: {}, status: 404
end
end