diff --git a/Gemfile b/Gemfile index 209f56b82..35c8dd8d8 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index 638edc9d9..7b1d102bf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -812,7 +809,6 @@ DEPENDENCIES active_model_serializers administrate after_party - apipie-rails axlsx (~> 3.0.0.pre) bcrypt bootstrap-sass (~> 3.3.5) @@ -858,7 +854,6 @@ DEPENDENCIES lograge logstash-event mailjet - maruku mina! omniauth-github openid_connect @@ -906,4 +901,4 @@ DEPENDENCIES zxcvbn-ruby BUNDLED WITH - 1.16.5 + 1.16.6 diff --git a/app/controllers/api/v1/dossiers_controller.rb b/app/controllers/api/v1/dossiers_controller.rb index 0957f1515..ef77d5d23 100644 --- a/app/controllers/api/v1/dossiers_controller.rb +++ b/app/controllers/api/v1/dossiers_controller.rb @@ -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) @@ -22,12 +11,6 @@ class API::V1::DossiersController < APIController 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]) diff --git a/app/controllers/api/v1/procedures_controller.rb b/app/controllers/api/v1/procedures_controller.rb index cf5ecf980..4bca4d565 100644 --- a/app/controllers/api/v1/procedures_controller.rb +++ b/app/controllers/api/v1/procedures_controller.rb @@ -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 diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 2b0ca70a9..0259809b3 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -1,12 +1,4 @@ class APIController < ApplicationController - AUTHENTICATION_TOKEN_DESCRIPTION = <<-EOS - L'authentification de l'API se fait via un header HTTP : - - ``` - Authorization: Bearer <Token administrateur> - ``` - EOS - before_action :default_format_json protected diff --git a/app/views/root/_footer.html.haml b/app/views/root/_footer.html.haml index ef2b14c33..174db199b 100644 --- a/app/views/root/_footer.html.haml +++ b/app/views/root/_footer.html.haml @@ -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 diff --git a/config/initializers/apipie.rb b/config/initializers/apipie.rb deleted file mode 100644 index 394b7a5d4..000000000 --- a/config/initializers/apipie.rb +++ /dev/null @@ -1,19 +0,0 @@ -Apipie.configure do |config| - config.app_name = "API demarches-simplifiees.fr" - config.api_base_url = "/api/v1" - config.doc_base_url = "/docs" - config.api_controllers_matcher = Rails.root.join("app", "controllers"," api", "v1", "**", "*.rb") - config.markup = Apipie::Markup::Markdown.new - config.default_version = '1.0' - config.validate = false - config.namespaced_resources = true - config.show_all_examples = true - - config.languages = ['fr'] - config.default_locale = 'fr' - - config.app_info = <<~EOS - Description - - EOS -end diff --git a/config/initializers/urls.rb b/config/initializers/urls.rb index 156397c6b..e2b5e1e80 100644 --- a/config/initializers/urls.rb +++ b/config/initializers/urls.rb @@ -13,4 +13,5 @@ DOC_URL = "https://doc.demarches-simplifiees.fr" 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" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 435865431..d2c6d7ea2 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -33,8 +33,6 @@ fr: previous: Précédent first: Premier truncate: '…' - apipie: - api_documentation: "Documentation de l'API demarches-simplifiees.fr" mail: administration: diff --git a/config/routes.rb b/config/routes.rb index 689d63479..8bb7fb13b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -379,8 +379,6 @@ Rails.application.routes.draw do get 'renew-api-token' => redirect('/profil') end - apipie - # # Legacy routes # diff --git a/doc/apipie_examples.json b/doc/apipie_examples.json deleted file mode 100644 index d3183ee70..000000000 --- a/doc/apipie_examples.json +++ /dev/null @@ -1,295 +0,0 @@ -{ - "dossiers#index": [ - { - "verb": "GET", - "path": "/api/v1/procedures/2/dossiers", - "versions": [ - "1.0" - ], - "query": "token=92cf04673cb66ab57a0c45e085b5140398ab4b6c", - "request_data": null, - "response_data": { - "dossiers": [ - { - "id": 2, - "nom_projet": "Demande de subvention dans le cadre d'accompagnement d'enfant à l'étranger", - "updated_at": "2008-09-01T08:05:00.000Z", - "initiated_at": "2008-09-02T08:05:00.000Z" - } - ], - "pagination": { - "page": 1, - "resultats_par_page": 12, - "nombre_de_page": 1 - } - }, - "code": "200", - "show_in_doc": 1, - "recorded": true - } - ], - "dossiers#show": [ - { - "verb": "GET", - "path": "/api/v1/procedures/1/dossiers/1", - "versions": [ - "1.0" - ], - "query": "token=7cba5df87cf134d07c3c467eb21b4f2a2b2605be", - "request_data": null, - "response_data": { - "dossier": { - "id": 1, - "nom_projet": "Demande de subvention dans le cadre d'accompagnement d'enfant à l'étranger", - "description": "Ma super description", - "created_at": "2008-09-01T08:05:00.000Z", - "updated_at": "2008-09-01T08:05:00.000Z", - "archived": false, - "state": "initiated", - "simplified_state": "En construction", - "initiated_at": "2017-04-11T12:00:12.000Z", - "received_at": null, - "processed_at": null, - "motivation": null, - "instructeurs": [ - "gestionnaire@apientreprise.fr" - ], - "invites": [ - "nom@domaine.fr" - ], - "individual": { - "nom": "Monmari", - "prenom": "René" - }, - "entreprise": { - "siren": "440117620", - "capital_social": 537100000, - "numero_tva_intracommunautaire": "FR27440117620", - "forme_juridique": "SA à conseil d'administration (s.a.i.)", - "forme_juridique_code": "5599", - "nom_commercial": "GRTGAZ", - "raison_sociale": "GRTGAZ", - "siret_siege_social": "44011762001530", - "code_effectif_entreprise": "51", - "date_creation": "2016-01-28T10:16:29.000Z", - "nom": null, - "prenom": null - }, - "etablissement": { - "siret": "44011762001530", - "siege_social": true, - "naf": "4950Z", - "libelle_naf": "Transports par conduites", - "adresse": "GRTGAZ\r IMMEUBLE BORA\r 6 RUE RAOUL NORDLING\r 92270 BOIS COLOMBES\r", - "numero_voie": "6", - "type_voie": "RUE", - "nom_voie": "RAOUL NORDLING", - "complement_adresse": "IMMEUBLE BORA", - "code_postal": "92270", - "localite": "BOIS COLOMBES", - "code_insee_localite": "92009" - }, - "cerfa": null, - "champs": [ - { - "value": null, - "type_de_champ": { - "id": 1, - "libelle": "Description", - "type": "textarea", - "order_place": 1, - "description": "description de votre projet" - } - }, - { - "value": { - "type": "MultiPolygon", - "coordinates": [ - [ - [ - [ - 2.3050735, - 48.8401501 - ], - [ - 2.3052329, - 48.8402106 - ], - [ - 2.3053759, - 48.8400422 - ], - [ - 2.3050735, - 48.8401501 - ] - ] - ] - ] - }, - "type_de_champ": { - "id": -1, - "libelle": "cadastre", - "type_champ": "cadastre", - "order_place": -1, - "descripton": "" - } - }, - { - "value": { - "type": "MultiPolygon", - "coordinates": [ - [ - [ - [ - 2.3050735, - 48.8401501 - ], - [ - 2.3052329, - 48.8402106 - ], - [ - 2.3053759, - 48.8400422 - ], - [ - 2.3050735, - 48.8401501 - ] - ] - ] - ] - }, - "type_de_champ": { - "id": -1, - "libelle": "quartier prioritaire", - "type_champ": "quartier_prioritaire", - "order_place": -1, - "descripton": "" - } - }, - { - "value": { - "type": "MultiPolygon", - "coordinates": [ - [ - [ - [ - 2.3049509525299072, - 48.84028511554904 - ], - [ - 2.305165529251098, - 48.84014035882062 - ], - [ - 2.3049670457839966, - 48.84005562298059 - ], - [ - 2.3049509525299072, - 48.84028511554904 - ] - ] - ] - ] - }, - "type_de_champ": { - "id": -1, - "libelle": "user_geometry", - "type_champ": "user_geometry", - "order_place": -1, - "descripton": "" - } - } - ], - "champs_private": [ - { - "value": null, - "type_de_champ": { - "id": 1, - "libelle": "Description privée", - "type_champ": "text", - "order_place": 0, - "description": "description privée" - } - } - ], - "pieces_justificatives": [ - { - "url": null, - "type_de_piece_justificative": { - "id": 1, - "libelle": "RIB", - "description": "Releve identité bancaire" - } - }, - { - "url": null, - "type_de_piece_justificative": { - "id": 2, - "libelle": "Attestation MSA", - "description": "recuperation automatique" - } - } - ] - } - }, - "code": "200", - "show_in_doc": 1, - "recorded": true - } - ], - "procedures#show": [ - { - "verb": "GET", - "path": "/api/v1/procedures/3", - "versions": [ - "1.0" - ], - "query": "token=cc00dc59ddc89f64c6310bb4e25c55eeb63ee89c", - "request_data": null, - "response_data": { - "procedure": { - "label": "Demande de subvention", - "link": "http://localhost", - "id": 3, - "description": "Demande de subvention à l'intention des associations", - "organisation": "Orga DINSIC", - "direction": "direction DINSIC", - "archived_at": null, - "geographic_information": { - "use_api_carto": true, - "quartiers_prioritaires": true, - "cadastre": true - }, - "types_de_champ": [ - { - "id": 3, - "libelle": "Description", - "type": "textarea", - "order_place": 1, - "description": "description de votre projet" - } - ], - "types_de_piece_justificative": [ - { - "id": 5, - "libelle": "RIB", - "description": "Releve identité bancaire" - }, - { - "id": 6, - "libelle": "Attestation MSA", - "description": "recuperation automatique" - } - ] - } - }, - "code": "200", - "show_in_doc": 1, - "recorded": true - } - ] -} diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ba3da562a..09cb95014 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -111,7 +111,6 @@ RSpec.configure do |config| config.infer_base_class_for_anonymous_controllers = false config.run_all_when_everything_filtered = true - config.filter_run :show_in_doc => true if ENV['APIPIE_RECORD'] config.filter_run :focus => true config.order = 'random'