Création d'une route d'API, permettant dans un premier temps de sauvegarder un Utilisateur en base; et, dans un second, d'envoyer ses données sur le service Hubspot (pour lequel il faut préalablement créer un compte), tout en lui rattachant une Note (contenu libre).
-
L'action de contacter le service Hubspot ne doit pas bloquer l'exécution de la requête.
-
Tous les differents cas d'usage doivent etre prévus et testés.
-
Dans "Hubspot > Sales > Contacts", on doit pouvoir voir cet utilisateur ainsi que la note attachée.
-
Hubspot understanding
- Get Hubspot API KEY
- Find create method
-
Storm API
- Very small authentification
- No authentification for
/status
- Create user (with sidekiq worker on Hubspot creation)
- List Hubspot Users
-
Documentation
- Describe every unclear part
- Describe top class
- Describe every method throwing errors
-
Download Postman
-
Join with email sent (
[email protected]
&[email protected]
) -
Log into Postman. It should look like the following screenshot.
Name Value DEFAULT_URL localhost:3001 HTTP_VERY_SMALL_AUTH RSIZQYMQKODIOQTZBHRI CONTENT_TYPE application/vnd.api+json -
Start server with
rails s -p 3001
-
Start Sidekiq with
bundle exec sidekiq
-
Run requests from Postman
There are 3 requests:
-
GET /api/status
To be sure everything is ok (no authentification required)
-
POST /api/users
To create a user
-
GET /api/users/list_hubspot_users
To check if hubspot API has been populated correctly
Files tested:
spec/services/user_creation_service_spec.rb
spec/workers/hubspot_creation_worker_spec.rb
spec/controllers/api/users_controller_test.rb
Run tests with:
bin/rspec spec/controllers/api/* spec/services/* spec/workers/*
- The
Note
is always the same, hardcoded withSome text
. list_hubspot_users
does not return the note attached. If necessary, screenshot of the account online might be given.