Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 58fc63421d
Fetching contributors…

Cannot retrieve contributors at this time

92 lines (65 sloc) 2.619 kb



$ git clone
$ cd chiat_day_innovation_matcher
$ bundle install


There are two configuration files this app depends upon.

The settings.yml file points at the MySQL database so provide an appropriate host and credentials. Copy it from the given example:

$ cp settings.example.yml settings.yml

The unicorn-conf.rb file is required if you want to run the app behind the Unicorn webserver.

$ cp unicorn-conf.example.rb unicorn-conf.example.rb

Here you can define where the app will log, leave its pids, and how it listens. You can also define the number of worker processes you want to run.


You can run the app locally on port 4567 by just running it with Ruby:

$ ruby innovation_matcher.rb
== Sinatra/1.3.3 has taken the stage on 4567 for development with backup from Thin
>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on, CTRL+C to stop

You can also run it with Unicorn

$ unicorn -c unicorn-conf.rb

which is what you should do in production, after you've tweaked the unicorn-conf.rb file.

Make sure that the user you're running this unicorn with can write to the directories you point at in the unicorn-conf.rb file. If you're using the example unicorn-conf.rb file then you might want to run a command like

$ chmod -R www-data:www-data log tmp


Create a match

Returns an array of innovations matching given parameters dob and hometown. Also returns a match_id that can be used to retrieve this match later.


$ curl -s -X POST http://localhost:4567/matches -d '{"dob": "1983-05-23", "hometown": "New York, NY"}'
  "match_id": "6b73f010-d469-012f-ad21-002219342852",
  "innovations": [

“id”: “280”, “type”: “Automotive”, “name”: “internal combustion engine”, “photo”: “”, “innovator_name”: “NICOLAUS OTTO”, “innovation_date”: “8/14/1877”


Retrieve a match

Returns an array of innovations from a previously returned match_id.


$ curl -s -X GET http://localhost:4567/matches/6b73f010-d469-012f-ad21-002219342852
  "match_id": "6b73f010-d469-012f-ad21-002219342852",
  "innovations": [

“id”: “280”, “type”: “Automotive”, “name”: “internal combustion engine”, “photo”: “”, “innovator_name”: “NICOLAUS OTTO”, “innovation_date”: “8/14/1877”,

Jump to Line
Something went wrong with that request. Please try again.