- Started at 14:39
- Finished tasks without styling at 15:55
- Started styling at 15:55
- Finish 17:06
- Small tweaks till 17:35
This is a little application, written in Ruby, using the Sinatra framework. It allows users to see the whereabouts of the International Space Station, using the OpenNotify APIs.
The aim of the exercise is for you to demonstrate how you would talk through your code and design decisions to peers, and will be used as a prompt for further discussions. We won't ask you to write any code during the interview itself, but we might ask specific questions about the code that you show us and how you might approach work on additional features or changes.
It is important to attempt the all the tasks, even if you don't finish them.
During the interview, you should be prepared to walk us through the code on your machine via screen share.
If you get stuck, please do get in touch and we'll do our best to help.
- You should spend no more than 3 hours on this challenge, and attempt all three tasks.
- Please send back your code by the end of Sunday 4th June, either as a link to a Github/Gitlab repo, or as a zip file containing your code.
We understand that you will have other commitments and time constraints, please let us know as soon as possible if you will be unable to complete this challenge by 4th June, so we are able to make allowances.
The challenge only needs to be runnable in a local environment; it doesn't need to be hosted anywhere.
If you need help with the challenge, for whatever reason, please do drop us an email and we will do our best to assist.
Please do not spend any more than 3 hours completeing these tasks.
- Build a page to show the current astronauts that are in space, using the
OpenNotify#astros
method.
- Use the existing
position
page as a guide to when adding this new page.
- Add some style the application using HTML and CSS prioritising clear information presentation.
- Location data should be shown on the
position
page. - Astronauts and their space ships could be shown in a table, or a list.
- Add a stylesheet and some simple CSS to make the layout really clear.
- Add new a new endpoint to return the ISS position data as JSON, instead of an HTML page.
http://localhost:4567/iss_position.json
should return JSON in the following format:
{
"iss_position": { "longitude": "-3.4941", "latitude": "-37.5113" },
"timestamp": 1684502291,
"message": "success"
}
Firstly you'll want to download and unzip the code into a directory or folder of your choice.
Next if you've not already got Ruby, you'll need to install it. There are a number of different ways to do it depending on your operating system. The challenge needs at least Ruby v3 to run.
Once you've installed ruby, you can install the dependencies for this project in a terminal. You should open a terminal in the directory or folder where your code has been checked out.
bundle config path vendor/bundle
bundle install
Then to start it:
bundle exec ruby app.rb
and you should be able to see it at http://localhost:4567. NB When you make changes to your code, you'll need to stop the app, using ctrl+c
and then restart it using the same command above.
app.rb
- Our Sinatra applicationopen_notify.rb
- OpenNotify libraryGemfile
- list of Ruby libraries (gems) that our app depends on.Gemfile.lock
- automatically generated "lockfile" for our dependencies.public/
- directory where "static" assets, e.g. images, CSS files can be kept.data/
- directory with static data from OpenNotify to allow development without internet access.views/
- directory containg the views (templates) for use by Sinatra. These are all usingerb
.
- Installing ruby on
- Getting started with Sinatra
- Various useful Ruby classes and modules:
- Array
- Hash
- String
- Comparable (handy if you're sorting things, e.g Hashes and Arrays)
- Enumerable (full of useful methods that both Hash and Array can use)
- ERB Templating (what we use in our views to execute Ruby)