Skip to content

Instantly share code, notes, and snippets.

@soxjke
Last active April 9, 2020 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soxjke/2f5e3b1d1b0ca560dbe18df6144195f4 to your computer and use it in GitHub Desktop.
Save soxjke/2f5e3b1d1b0ca560dbe18df6144195f4 to your computer and use it in GitHub Desktop.
Test task

Test assignment description

Hi!

You're proposed to create simple grocery shopping cart application with two screens:

  • Shop catalog screen
  • Shopping cart screen

Application communicates with API server located at http://13.48.127.170:3000/ and performs few operations (described below in API section). Prelimiary application designs can be found here:

  • PNG screens:
Shopping Cart
one two

Application will enable user to interact with following user stories:

  • "As a user I want to browse through list of products"
  • "As a user I want to add product to cart by clicking on it"
  • "As a user I want to see my cart"
  • "As a user I want to modify quantity of items in my cart"

API

Get products list

GET http://13.48.127.170:3000/products

Params:

limit(query): Int

offset(query): Int

Example request:

curl -X GET 'http://13.48.127.170:3000/products?limit=10&offset=10'

Example response:

[{"id":218799993587214750,"name":"FLOUR0047","imageURL":"https://tons-test-grocery-images.s3.eu-central-1.amazonaws.com/FLOUR/FLOUR0047.png","pricePerUnit":7.12},{"id":278313333619827200,"name":"SUGAR0010","imageURL":"https://tons-test-grocery-images.s3.eu-central-1.amazonaws.com/SUGAR/SUGAR0010.png","pricePerUnit":8.47},{"id":379016280437608060,"name":"SUGAR0091","imageURL":"https://tons-test-grocery-images.s3.eu-central-1.amazonaws.com/SUGAR/SUGAR0091.png","pricePerUnit":19.74},{"id":387068229937812500,"name":"SUGAR0017","imageURL":"https://tons-test-grocery-images.s3.eu-central-1.amazonaws.com/SUGAR/SUGAR0017.png","pricePerUnit":2.93},{"id":416030267332217700,"name":"FLOUR0048","imageURL":"https://tons-test-grocery-images.s3.eu-central-1.amazonaws.com/FLOUR/FLOUR0048.png","pricePerUnit":14.99},{"id":416281690644061950,"name":"SUGAR0114","imageURL":"https://tons-test-grocery-images.s3.eu-central-1.amazonaws.com/SUGAR/SUGAR0114.png","pricePerUnit":3.52},{"id":572385525504231000,"name":"FLOUR0011","imageURL":"https://tons-test-grocery-images.s3.eu-central-1.amazonaws.com/FLOUR/FLOUR0011.png","pricePerUnit":1.85},{"id":637839146771222300,"name":"FLOUR0108","imageURL":"https://tons-test-grocery-images.s3.eu-central-1.amazonaws.com/FLOUR/FLOUR0108.png","pricePerUnit":10.61},{"id":642756541451076200,"name":"FLOUR0093","imageURL":"https://tons-test-grocery-images.s3.eu-central-1.amazonaws.com/FLOUR/FLOUR0093.png","pricePerUnit":12.44},{"id":726194184824496100,"name":"SUGAR0009","imageURL":"https://tons-test-grocery-images.s3.eu-central-1.amazonaws.com/SUGAR/SUGAR0009.png","pricePerUnit":16.03}]

Get cart

GET http://13.48.127.170:3000/cart

Params:

id(query): string

Example request:

curl -X GET 'http://13.48.127.170:3000/cart?id=hello'

Example response:

{"id":"hello","products":[{"quantity":2,"product":{"id":726194184824496100,"name":"SUGAR0009","imageURL":"https://tons-test-grocery-images.s3.eu-central-1.amazonaws.com/SUGAR/SUGAR0009.png","pricePerUnit":16.03}}]}

Update cart

POST http://13.48.127.170:3000/cart

Example request:

curl -X POST http://13.48.127.170:3000/cart -d'{"id":"hello", "products":[{"quantity":2, "product":{"id":726194184824496100}}]}' -H'Content-Type: application/json'

Example response:

{"id":"hello","products":[{"quantity":2,"product":{"id":726194184824496100,"name":"SUGAR0009","imageURL":"https://tons-test-grocery-images.s3.eu-central-1.amazonaws.com/SUGAR/SUGAR0009.png","pricePerUnit":16.03}}]}

It is recommended that you generate UUID and use it for get/update cart

Hints and constraints on quality

  1. You may choose any reasonable libs for this assignment. We're not limiting your choice here, just will give you suggestion to use solutions you're confident with.
  2. If needed, you may choose any dependency management (CocoaPods, SwiftPM, Carthage). Just make sure to include working README.md on how to build and run an app. It might be good idea to do clean checkout of the repo and try to build an app from scratch before submission.
  3. You are free to choose any UI creation approach (storyboard, xib, code). We're not limiting your choice here, however, keeping in mind the simplicity of design, creation of UI in code will be a plus.
  4. You are encouraged to make any reasonable UX improvements on top of what's given in this assignment. We'd love to learn your ideas here.
  5. You are free to choose any architecture pattern of your preference (MVx, Flux, Redux, VIPER etc.) During architecture assessment we would focus on:
  • Appropriateness of selected architecture (Remember, this is a simple app. 6 levels of mapping of 5 levels of nothing won't bring you additional bonus points)
  • Implementation cleaniness (How good you own the pattern you're employing in the app and how clean it's usage is)
  1. If you struggle with something for too long, please remember: "better done than perfect". We'd love to see your submissions and discuss results.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment