- Check out the code base
- Install postgres on OSX if its not already there.
- Create the postgres user if it doesn't exist: /usr/local/Cellar/postgresql/9.6.3/bin/createuser -s postgres
- Create the database: bundle exec rake db:create
- Migrate the database to the table structure: bundle exec rake db:migrate
- Import the state data with: bundle exec rake know_who:import_states --trace
- Export a month directory like this: export KNOW_WHO_MONTH=~/fuzzygroup/consulting/new-leaders-api/spec/fixtures/leaders/2012-12 (adjust to your own directory structure -or- the month you want to load)
- Load the leader data with: bundle exec rake know_who:import_month --trace
Serving up current congressional leaders for all 50 States on both the US and State level.
== Examples
=== Both Senators from Texas
/v1/states/tx/leaders/us_senate
[
{"id":337,"slug":"us-sen-john-cornyn","name":"John Cornyn","title":"US Senator","photo_src":"http://publicservantsprayer.org/photos/FL/S//Cornyn_John_211675.jpg","prefix_name":"US Sen. John Cornyn","resource_path":"/v1/leaders/us-sen-john-cornyn","state_code":"tx","born_on":null,"district":"S02","residence":"San Antonio, TX","spouse":"Sandra Hansen","family":"2 children"},
{"id":522,"slug":"us-sen-kay-hutchison","name":"Kay Hutchison","title":"US Senator","photo_src":"http://publicservantsprayer.org/photos/FL/S//Hutchison_Kay_165278.jpg","prefix_name":"US Sen. Kay Hutchison","resource_path":"/v1/leaders/us-sen-kay-hutchison","state_code":"tx","born_on":null,"district":"S01","residence":"Dallas, TX","spouse":"Ray Hutchinson","family":"4 children"}
]
=== All leaders in Texas:
/v1/states/tx/leaders
=== Other chambers:
/v1/states/tx/leaders/us_house
/v1/states/tx/leaders/state_senate
/v1/states/tx/leaders/state_house
=== Individuals can be found via their slug:
/v1/leaders/us-rep-ron-paul
{"id":264,"slug":"us-rep-ron-paul","name":"Ron Paul","title":"US Representative","photo_src":"http://publicservantsprayer.org/photos/FL/H/Paul_Ron_159084.jpg","prefix_name":"US Rep. Ron Paul","resource_path":"/v1/leaders/us-rep-ron-paul","state_code":"tx","born_on":null,"district":"14","residence":"Lake Jackson, TX","spouse":"Carol Wells","family":"5 children; 18 grandchildren"}