Your mission:
- Consume a webservice endpoint (http://54.152.221.29/images.json) that returns a JSON of photos. There are 10 photos.
- Generate three different formats for each photo. The dimensions are: small (320x240), medium (384x288) and large (640x480).
- Write a webservice endpoint that lists (in JSON format) all the ten photos with their respective formats, providing their URLs.
Choose the programming language you want... let us know about why is that your choice.
Besides the solution itself, write an automated test for your code (using a known framework or just another function/method).
You should use a non-relational database (MongoDB is preferred). Your code should be delivered in your Github account. We are interested in your solution considering:
- Correctness;
- Readability;
- Automated tests;
- Execution time.
I used Ruby because I'm more familiar and because it's the language I like to work with. The choice was also based on ease of integration with:
- Mongo
- Queue system
- Asynchronous tasks
- ruby (2.3 or higher)
- rails (5.0.0.1 or higher)
- mongodb (3.4.4 or higher)
- sidekiq
- redis (3.2.8 or higher)
- ImageMagick (link)
Clone this repository
git clone https://github.com/w-osilva/hell_triangle_challenge.git
Run bundler to get dependencies
bundle install
Make sure mongo and redis are running
mongod --fork --logpath ./log/mongod.log
redis-server --daemonize yes
rake db:create
rake db:migrate
Make sure sidekiq are running
sidekiq -C config/sidekiq.yml -d
To import Photos from Webservice
rake photo:import
Run puma server
rails s -p 3000 -b 0.0.0.0 -d
Photo list can be viewed in http://localhost:3000/photos.json