Skip to content

coderajith/fieldthebern-api

 
 

Repository files navigation

Field the Bern - API

Rails API for crowdsourced voter canvassing.

Development

Prerequisites

  • git
  • ruby 2.2.3 (rvm recommended)
  • postgres (brew install postgres on OSX)

Setup

  1. Clone the repository (git clone [email protected]:Bernie-2016/fieldthebern-api.git)
  2. Install gem dependencies: bundle install
  3. Create and migrate the database: rake db:setup
  4. Copy .env.sample to .env. Create test apps with the relevant services to get credentials.
  5. Run gem install foreman to install the foreman gem, used for running Procfile-based apps.
  6. Run foreman start to start the server.

Testing

http://api.lvh.me:5000/ping

You must set ENV['MIN_INTERVAL_BETWEEN_VISITS_HOURS'] to at least 1 for specs to pass.

API Error Format

{
  "errors": [
    {
      "id": "DASHERIZED_CAPITALIZED_ERROR_NAME",
      "title": "User friendly error name",
      "detail": "Value of Error.message",
      "status": "HTTP_CODE_IN_INTEGER_FORMAT"
    }
  ]
}

This format is consistent with the JSON API specification for errors. The root object should be called "errors". It should be an array, even if it's just a single error, which is our case.

JSON API spec for errors

Contributing

  1. Fork it ( https://github.com/Bernie-2016/fieldthebern-api/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

Apache 2.0

About

Rails API for crowdsourced voter canvassing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 98.5%
  • HTML 1.5%