diff options
author | Ben Sima <ben@bsima.me> | 2018-02-23 15:46:48 -0800 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2018-02-23 15:46:48 -0800 |
commit | 965f84249fe1e9dc72f8b38c21ab6a4f3c08f494 (patch) | |
tree | 1c4026e62a1ba528257752315f25129cb971f8a1 /truly.co/readme.md | |
parent | 60e62ee05f75d0b76a4d5668b3b21b9f33fd4cf9 (diff) |
Re-organize
Diffstat (limited to 'truly.co/readme.md')
-rw-r--r-- | truly.co/readme.md | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/truly.co/readme.md b/truly.co/readme.md new file mode 100644 index 0000000..a7b5f0f --- /dev/null +++ b/truly.co/readme.md @@ -0,0 +1,97 @@ +[Truly.co](https://truly.co/) is an enterprise VOIP company. They were hiring +for a Clojure developer. Even though I'm an expert in Clojure, I opted to use +Haskell because I really wanted to play with the +[acid-state](https://github.com/acid-state/acid-state) library, and this seemed +like a great opportunity to do so. + +## The [exercise](https://docs.google.com/document/d/1ZWcTzQdQ9zSZ8Tv4XDyCrju40_FuSJ7W6qu4-pUU-ZA/pub) is a Caller Id Service: + +The goal of this exercise is for you to implement a standalone service that will +respond to requests seeking caller id information. + +### Api Requirements/Notes + +- Api should return json +- Phone numbers should be in E.164 format. +- Appropriate http codes should be returned on error. + +### API Endpoints + +#### GET /query + +Fetches caller id information. + +Params: + + number - the number we want caller id information for. + +Example query: + + GET http://localhost/query?number=%2B15556789090 + +Response: + + {results: [{ “name”: “Bob Barker”, “number”: “+15556789090”, “context”: “personal”}]} + +#### `POST /number` + +Adds caller id data to the service. + +Body: + + name - contact name + number - the number in E.164 format + context - the context for the phone number. + +Note: A phone number may be present multiple times, but can only appear once per +context. In other words you can think of a <number,context> pair as unique. + +#### Seed Data + +Normally a service like this would call other services in turn, but to keep +things simple we are going to provide seed data for the service as a csv +file. Your service will need to read in that initial data and use it to serve +requests. + +Line format: + + <phone number>,<context>,<caller id> + +Example: + + 5556780909,work,John Doe + +The seed data can be downloaded via [this +link](https://www.dropbox.com/s/0hmkx242o42g924/interview-callerid-data.csv.gz). + +### Service Requirements + +- We prefer if your service is standalone, this means that it shouldn’t require + additional server software (tomcat/apache/etc) to run. If it does require such + software you will need to provide setup instructions. +- The port on which the service listens should be configurable without editing + code. +- Your code should include a README file with instructions on how to run your + service. Shell scripts are also appreciated but not required. +- You may NOT use an external datastore. + +### Misc/Other Notes + +- Once again to keep things simple data submitted to your service does not need + to be persisted. +- While our main goal is to look at your code, we will run your code and test + it. +- There is no timeline, please take as long as you want. However if you take + especially long we may check in. +- If you have any questions please ask. + +## How to run this code + +1. Have [stack](http://haskellstack.org/) installed +2. Optional: have [nix](https://nixos.org/nix/) installed. If you *don't* use nix, delete line 3 of `main.hs`. +3. Run `./main.hs` and the server will startup + +To bootstrap the db, do `curl -XPOST "localhost:3000/bootstrap"`. This takes +like 3 seconds or so. + +See `test.http` for some other examples. |