nas a3e14141c0 add create and remove task | 2 anni fa | |
---|---|---|
app | 3 anni fa | |
bin | 3 anni fa | |
config | 3 anni fa | |
db | 3 anni fa | |
lib | 3 anni fa | |
log | 3 anni fa | |
public | 3 anni fa | |
storage | 3 anni fa | |
test | 2 anni fa | |
tmp | 3 anni fa | |
vendor | 3 anni fa | |
.gitattributes | 2 anni fa | |
.gitignore | 2 anni fa | |
.ruby-version | 2 anni fa | |
Gemfile | 2 anni fa | |
Gemfile.lock | 2 anni fa | |
README.md | 2 anni fa | |
Rakefile | 3 anni fa | |
config.ru | 3 anni fa | |
erd.pdf | 3 anni fa |
Ruby 3.0.1 // Rails 6.1.3.1
Voir cet article pour installer Ruby avec Rbenv, un gestionnaire de version pour Ruby.
Installer rails : gem install rails -v 6.1.3.1
PostgreSQL 11 minimum et la gem associée (pg
).
bundle install
rails db:migrate
(et rails db:seed
pour peupler la db avec des données factices, si nécessaire)rails server
pour lancer un serveur local de développement sur le port 3000La commande rails routes
fournie l’ensemble des endpoints et requêtes HTTP disponibles. L’ensemble des requêtes se font sur la base : localhost:3000/api/v1.
Les scripts de test sont situés dans le répertoire test
, y compris les test distants (test/remote
).
POST /api/v1/users(.:format) api/v1/users#create {:format=>:json}
curl --header "Content-Type: application/json" -d "{\"user\" : { \"username\" : \"test\", \"password\" : \"lepwd\", \"email\" : \"iel@cli.su\" }}" -XPOST https://chronobriq-api.URL/api/v1/users
POST /api/v1/tokens(.:format) api/v1/tokens#create {:format=>:json}
curl --header "Content-Type: application/json" -d "{\"user\":{\"email\":\"iel@cli.su\", \"password\":\"lepwd\"}}" -XPOST https://chronobriq-api.URL/api/v1/tokens
Un obtient une réponse du type :
{"token":"Kgt2p1ITAjfbLK4xtS8YPi44gIMWrwtagOGwK0ROEOUgrn6Jj34sqprnX2d7t7RI","email":"jules@cli.coop","username":"test"}
Grâce au to.ken obtenu précédemment, nous pouvons récupérer des informations en le fournissant dans l’entête
curl --header "Content-Type: application/json" -H "Authorization : Kgt2p1ITAjfbLK4xtS8YPi44gIMWrwtagOGwK0ROEOUgrn6Jj34sqprnX2d7t7RI" -XGET https://chronobriq-api.canaille.netlib.re/api/v1/users
curl --header "Content-Type: application/json" -H "Authorization: Kgt2p1ITAjfbLK4xtS8YPi44gIMWrwtagOGwK0ROEOUgrn6Jj34sqprnX2d7t7RI" -XGET https://chronobriq-api.canaille.netlib.re/api/v1/teams
Patch et delete permettent de modifier ou supprimer une donnée qui a été crée depuis cette utilisatrice, après avoir spécifié l’id du jeu de données dans l’URL
Prefix | Verb | URI Pattern | Controller#Action |
---|---|---|---|
api_v1_users | GET | /api/v1/users(.:format) | api/v1/users#index {:format=>:json} |
POST | /api/v1/users(.:format) | api/v1/users#create {:format=>:json} | |
api_v1_user | GET | /api/v1/users/:id(.:format) | api/v1/users#show {:format=>:json} |
PATCH | /api/v1/users/:id(.:format) | api/v1/users#update {:format=>:json} | |
PUT | /api/v1/users/:id(.:format) | api/v1/users#update {:format=>:json} | |
DELETE | /api/v1/users/:id(.:format) | api/v1/users#destroy {:format=>:json} | |
api_v1_tokens | POST | /api/v1/tokens(.:format) | api/v1/tokens#create {:format=>:json} |
api_v1_teams | GET | /api/v1/teams(.:format) | api/v1/teams#index {:format=>:json} |
POST | /api/v1/teams(.:format) | api/v1/teams#create {:format=>:json} | |
api_v1_team | GET | /api/v1/teams/:id(.:format) | api/v1/teams#show {:format=>:json} |
PATCH | /api/v1/teams/:id(.:format) | api/v1/teams#update {:format=>:json} | |
PUT | /api/v1/teams/:id(.:format) | api/v1/teams#update {:format=>:json} | |
DELETE | /api/v1/teams/:id(.:format) | api/v1/teams#destroy {:format=>:json} | |
api_v1_memberships | GET | /api/v1/memberships(.:format) | api/v1/memberships#index {:format=>:json} |
POST | /api/v1/memberships(.:format) | api/v1/memberships#create {:format=>:json} | |
api_v1_membership | GET | /api/v1/memberships/:id(.:format) | api/v1/memberships#show {:format=>:json} |
PATCH | /api/v1/memberships/:id(.:format) | api/v1/memberships#update {:format=>:json} | |
PUT | /api/v1/memberships/:id(.:format) | api/v1/memberships#update {:format=>:json} | |
DELETE | /api/v1/memberships/:id(.:format) | api/v1/memberships#destroy {:format=>:json} | |
api_v1_activity_tasks | GET | /api/v1/activities/:activity_id/tasks(.:format) | api/v1/tasks#index {:format=>:json} |
POST | /api/v1/activities/:activity_id/tasks(.:format) | api/v1/tasks#create {:format=>:json} | |
api_v1_activity_task | GET | /api/v1/activities/:activity_id/tasks/:id(.:format) | api/v1/tasks#show {:format=>:json} |
PATCH | /api/v1/activities/:activity_id/tasks/:id(.:format) | api/v1/tasks#update {:format=>:json} | |
PUT | /api/v1/activities/:activity_id/tasks/:id(.:format) | api/v1/tasks#update {:format=>:json} | |
DELETE | /api/v1/activities/:activity_id/tasks/:id(.:format) | api/v1/tasks#destroy {:format=>:json} | |
api_v1_activities | GET | /api/v1/activities(.:format) | api/v1/activities#index {:format=>:json} |
POST | /api/v1/activities(.:format) | api/v1/activities#create {:format=>:json} | |
api_v1_activity | GET | /api/v1/activities/:id(.:format) | api/v1/activities#show {:format=>:json} |
PATCH | /api/v1/activities/:id(.:format) | api/v1/activities#update {:format=>:json} | |
PUT | /api/v1/activities/:id(.:format) | api/v1/activities#update {:format=>:json} | |
DELETE | /api/v1/activities/:id(.:format) | api/v1/activities#destroy {:format=>:json} | |
api_v1_tasks | GET | /api/v1/tasks(.:format) | api/v1/tasks#index {:format=>:json} |
POST | /api/v1/tasks(.:format) | api/v1/tasks#create {:format=>:json} | |
api_v1_task | GET | /api/v1/tasks/:id(.:format) | api/v1/tasks#show {:format=>:json} |
PATCH | /api/v1/tasks/:id(.:format) | api/v1/tasks#update {:format=>:json} | |
PUT | /api/v1/tasks/:id(.:format) | api/v1/tasks#update {:format=>:json} | |
DELETE | /api/v1/tasks/:id(.:format) | api/v1/tasks#destroy {:format=>:json} |