-
Clone the repo:
$ git clone git@github.com:foxy-eyed/parcel-tracker.git
-
In project root:
$ docker compose build
-
Create database, run migrations and seed data:
$ docker compose run app rails db:prepare $ docker compose run app rails db:seed
With seeds you will be able to use CURL examples below without any modifications.
-
Finally
$ docker compose up
Now you have app running at http://localhost:9292 and ready to process your requests.
curl -X POST 'http://localhost:9292/packages' \
-H 'X-User-ID: defb5761-02b8-45ed-b660-8092a4c8d884' \
-H "Content-type: application/json" \
-d '{"package": {"track": "HP0000034"}}'
curl -X POST 'http://localhost:9292/packages/5ee90d5a-d313-410d-a1b4-36d383b02ab6/notifications' \
-H 'X-User-ID: defb5761-02b8-45ed-b660-8092a4c8d884' \
-H "Content-type: application/json" \
-d '{"email":"anna@test.com", "phone":"+1 172-345-5678", "enabled":["phone", "email"]}'
curl -X GET 'http://localhost:9292/packages/5ee90d5a-d313-410d-a1b4-36d383b02ab6/notifications' \
-H 'X-User-ID: defb5761-02b8-45ed-b660-8092a4c8d884' \
-H "Content-type: application/json"
curl -X GET 'http://localhost:9292/packages/5ee90d5a-d313-410d-a1b4-36d383b02ab6' \
-H "Content-type: application/json"
curl -X GET 'http://localhost:9292/packages' \
-H "Content-type: application/json"
curl -X POST 'http://localhost:9292/webhook/fast_delivery/arrived/FD0001' \
-H "Content-type: application/json" \
-d '{"location":{"name": "Moscow"}, "time":"2023-04-11", "weight": {"value":100.0, "unit": "g"}}'
curl -X POST 'http://localhost:9292/webhook/fast_delivery/departed/FD0001' \
-H "Content-type: application/json" \
-d '{"location":{"name": "Samara"}, "time":"2023-04-12", "weight": {"value":100.0, "unit": "g"}}'
curl -X POST 'http://localhost:9292/webhook/fast_delivery/deliver-attempt/FD0001' \
-H "Content-type: application/json" \
-d '{"state":"failed"}'
curl -X POST 'http://localhost:9292/webhook/fast_delivery/deliver-attempt/FD0001' \
-H "Content-type: application/json" \
-d '{"state":"successful"}'
curl -X POST 'http://localhost:9292/webhook/happy_package/arrived/HP0001' \
-H "Content-type: application/json" \
-d '{"location":"Moscow", "time":"2023-04-11", "weight": "100.0g"}'
curl -X POST 'http://localhost:9292/webhook/happy_package/departed/HP0001' \
-H "Content-type: application/json" \
-d '{"location":"Samara", "time":"2023-04-12", "weight": "100g"}'
curl -X POST 'http://localhost:9292/webhook/happy_package/deliver-attempt/HP0001' \
-H "Content-type: application/json" \
-d '{"success":false}'
curl -X POST 'http://localhost:9292/webhook/happy_package/deliver-attempt/HP0001' \
-H "Content-type: application/json" \
-d '{"success":true}'