Skip to content

Commit

Permalink
Merge pull request #2783 from betagouv/api-doc
Browse files Browse the repository at this point in the history
Change the link to the API documentation
  • Loading branch information
gregoirenovel authored Oct 9, 2018
2 parents c703e1a + f3caa8e commit cbb59f1
Show file tree
Hide file tree
Showing 12 changed files with 3 additions and 364 deletions.
4 changes: 0 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ gem 'bootstrap-wysihtml5-rails', '~> 0.3.3.8'
gem 'spreadsheet_architect'
gem 'axlsx', '~> 3.0.0.pre' # https://github.com/randym/axlsx/issues/501#issuecomment-373640365

gem 'apipie-rails'
# For Markdown support in apipie
gem 'maruku'

gem 'openstack'

gem 'browser'
Expand Down
7 changes: 1 addition & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ GEM
selectize-rails (~> 0.6)
aes_key_wrap (1.0.1)
after_party (1.10.0)
apipie-rails (0.5.10)
rails (>= 4.1)
arel (9.0.0)
ast (2.4.0)
attr_required (1.0.1)
Expand Down Expand Up @@ -483,7 +481,6 @@ GEM
rest-client
marcel (0.3.2)
mimemagic (~> 0.3.2)
maruku (0.7.3)
method_source (0.9.0)
mime-types (3.1)
mime-types-data (~> 3.2015)
Expand Down Expand Up @@ -812,7 +809,6 @@ DEPENDENCIES
active_model_serializers
administrate
after_party
apipie-rails
axlsx (~> 3.0.0.pre)
bcrypt
bootstrap-sass (~> 3.3.5)
Expand Down Expand Up @@ -858,7 +854,6 @@ DEPENDENCIES
lograge
logstash-event
mailjet
maruku
mina!
omniauth-github
openid_connect
Expand Down Expand Up @@ -906,4 +901,4 @@ DEPENDENCIES
zxcvbn-ruby

BUNDLED WITH
1.16.5
1.16.6
17 changes: 0 additions & 17 deletions app/controllers/api/v1/dossiers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,6 @@ 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 démarche'
param :procedure_id, Integer, desc: "L'identifiant de la démarche", required: true
param :page, String, desc: "Numéro de la page", required: false
param :resultats_par_page, String, desc: "Nombre de résultats par page (#{DEFAULT_PAGE_SIZE} par défaut, maximum 1 000)", required: false
error code: 401, desc: "Non authorisé"
error code: 404, desc: "Démarche inconnue"

def index
dossiers = @procedure.dossiers.state_not_brouillon.page(params[:page]).per(per_page)

Expand All @@ -22,12 +11,6 @@ def index
render json: {}, status: 404
end

api :GET, '/procedures/:procedure_id/dossiers/:id', 'Informations du dossier d\'une démarche'
param :procedure_id, Integer, desc: "L'identifiant de la démarche", required: true
param :dossier_id, Integer, desc: "L'identifiant du dossier", required: true
error code: 401, desc: "Non authorisé"
error code: 404, desc: "Démarche ou dossier inconnu"

def show
dossier = @procedure.dossiers.find(params[:id])

Expand Down
9 changes: 0 additions & 9 deletions app/controllers/api/v1/procedures_controller.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
class API::V1::ProceduresController < APIController
before_action :fetch_procedure_and_check_token

resource_description do
description AUTHENTICATION_TOKEN_DESCRIPTION
end

api :GET, '/procedures/:id', 'Informations concernant une démarche'
param :id, Integer, desc: "L'identifiant de la démarche", required: true
error code: 401, desc: "Non authorisé"
error code: 404, desc: "Démarche inconnue"

def show
render json: { procedure: ProcedureSerializer.new(@procedure.decorate).as_json }
end
Expand Down
8 changes: 0 additions & 8 deletions app/controllers/api_controller.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
class APIController < ApplicationController
AUTHENTICATION_TOKEN_DESCRIPTION = <<-EOS
L'authentification de l'API se fait via un header HTTP :
```
Authorization: Bearer &lt;Token administrateur&gt;
```
EOS

before_action :default_format_json

protected
Expand Down
2 changes: 1 addition & 1 deletion app/views/root/_footer.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
%li.footer-link
= link_to "Documentation", DOC_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
%li.footer-link
= link_to "Documentation de l'API", "/docs", :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
= link_to "Documentation de l'API", API_DOC_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
%li.footer-link
= link_to "FAQ", FAQ_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
%li.footer-link
Expand Down
19 changes: 0 additions & 19 deletions config/initializers/apipie.rb

This file was deleted.

1 change: 1 addition & 0 deletions config/initializers/urls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
LISTE_DES_DEMARCHES_URL = [DOC_URL, "listes-des-demarches"].join("/")
CGU_URL = [DOC_URL, "cgu"].join("/")
MENTIONS_LEGALES_URL = [CGU_URL, "4-mentions-legales"].join("#")
API_DOC_URL = [DOC_URL, "pour-aller-plus-loin", "api"].join("/")
FAQ_URL = "https://faq.demarches-simplifiees.fr"
2 changes: 0 additions & 2 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ fr:
previous: Précédent
first: Premier
truncate: '&hellip;'
apipie:
api_documentation: "Documentation de l'API demarches-simplifiees.fr"

mail:
administration:
Expand Down
2 changes: 0 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,6 @@
get 'renew-api-token' => redirect('/profil')
end

apipie

#
# Legacy routes
#
Expand Down
Loading

0 comments on commit cbb59f1

Please sign in to comment.