diff options
-rw-r--r-- | readme.md | 8 | ||||
-rw-r--r-- | truly.co/interview-callerid-data.csv (renamed from interview-callerid-data.csv) | 0 | ||||
-rwxr-xr-x | truly.co/main.hs (renamed from main.hs) | 0 | ||||
-rw-r--r-- | truly.co/readme.md | 97 | ||||
-rw-r--r-- | truly.co/seed.csv (renamed from seed.csv) | 0 | ||||
-rw-r--r-- | truly.co/test.http (renamed from test.http) | 0 |
6 files changed, 97 insertions, 8 deletions
diff --git a/readme.md b/readme.md deleted file mode 100644 index b7b9c4e..0000000 --- a/readme.md +++ /dev/null @@ -1,8 +0,0 @@ -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. diff --git a/interview-callerid-data.csv b/truly.co/interview-callerid-data.csv index 49276cc..49276cc 100644 --- a/interview-callerid-data.csv +++ b/truly.co/interview-callerid-data.csv diff --git a/main.hs b/truly.co/main.hs index 8845d3f..8845d3f 100755 --- a/main.hs +++ b/truly.co/main.hs 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. diff --git a/seed.csv b/truly.co/seed.csv index f11a0bb..f11a0bb 100644 --- a/seed.csv +++ b/truly.co/seed.csv diff --git a/test.http b/truly.co/test.http index e61e3db..e61e3db 100644 --- a/test.http +++ b/truly.co/test.http |