Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve api #140

Merged
merged 3 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,5 @@ group :test do
end

gem "good_job", "~> 3.99"

gem "rack-cors"
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ GEM
raabro (1.4.0)
racc (1.8.1)
rack (3.1.7)
rack-cors (2.0.2)
rack (>= 2.0.0)
rack-oauth2 (2.2.1)
activesupport
attr_required
Expand Down Expand Up @@ -552,6 +554,7 @@ DEPENDENCIES
pg (~> 1.5)
prawn
puma (>= 5.0)
rack-cors
rails (~> 7.2.1)
rails-i18n (~> 7.0.0)
rqrcode (~> 2.0)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# README

Pour l'API, consulter le [swagger](/docs/swagger.yaml)

## Install project

### Database setup
Expand Down
6 changes: 6 additions & 0 deletions config/initializers/cors.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins "*"
resource "/api/*", headers: :any, methods: [:get, :post, :put, :patch, :delete, :options, :head]
end
end
50 changes: 50 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
openapi: 3.0.3
info:
title: Swagger quotient-familial.numerique.gouv.fr - OpenAPI 3.0
description: |-
# Le service

Les cantines, transports ou aides spécifiques proposés par les collectivités sont souvent tarifés ou alloués selon la situation familiale et les ressources des particuliers.

Le service [quotient-familial.numerique.gouv.fr](https://quotient-familial.numerique.gouv.fr) vous permet de transmettre de façon sécurisée vos données d’identité permettant à votre collectivité de récupérer instantanément votre quotient familial CAF ou MSA auprès de l’administration détenant cette information.

# L'API
Cette API sert à savoir quelles sont les communes disponibles sur [quotient-familial.numerique.gouv.fr](https://quotient-familial.numerique.gouv.fr).

Aucune clef d'API requise.

version: 1.0.0
servers:
- url: https://quotient-familial.numerique.gouv.fr/api
paths:
/collectivites:
get:
tags:
- collectivités
summary: Liste des collectivités
description: Liste des collectivités disponibles sur quotient-familial.gouv.fr
operationId: getCollectivities
responses:
'200':
description: Successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Collectivity'
components:
schemas:
Collectivity:
type: object
properties:
siret:
type: string
example: "1021290146600012"
name:
type: string
example: "COMMUNE DE MELGVEN"
code_cog:
type: string
example: "29146"