sketch-city / harvey-api

Harvey Needs API
http://harveyneeds.org
GNU General Public License v3.0
23 stars 39 forks source link

The Harvey Needs API

Example Clients:

Developer Links

API

Overall

Speeding up results

You can use the If-Modified-Since header to check if there are any new results since that timestamp. If there are no new results, you'll receive a 304 NOT MODIFIED.

GET /api/v1/shelters HTTP/1.1
Host: api.harveyneeds.org
If-Modified-Since: Mon, 11 Sep 2017 21:23:03 -0000

The format for the date timestamp is rfc2822, though you can use any HTTP approved format.

Documentation

Getting Started (Dev)

Prequisites

User Administration

In rails console you'll want to create an admin user:

User.create! email: "youremail@example.com", password: "yourpassword", admin: true

Fork Repository and clone to local machine

Fork Repository
Clone Fork to local box

Setting up your .env file

Note: this is optional; currently only needed to fetch new Amazon products from the Amazon Product Advertising API

You'll need to set the following ENV variables in a .env file

  1. Make a working copy of .env by runng this command at the terminal: cp .env.sample .env
  2. Get Amazon AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from Amazon's IAM. You'll need to create a PolicyName. You can name it "ProductAdvertisingAPI" with the following policy:
    {
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "ProductAdvertisingAPI:*",
            "Resource": "*"
        }
    ]
    }

Creating a local database

About the data import job

DO NOT RUN THIS JOB IN PRODUCTION. Since this job pulls data from the production API, running it in production can only be counter-productive, and would likely be destructive.

Development Process

Tests and Testing

Code should have tests, and any pull requests should be made only after you've made sure passes the test suite

Git and Github use

We force pull-requests from feature branches to master. Once something lands in master, it goes live instantly

Keeping your fork in sync

Branching

Within your own forked repo create branches for each logical unit for work you do. One benefit of doing this is you'll be able to periodically sync your forked repo with upstream repo into the master branch without conflicting with work you may be doing.

Pull Requests

When you believe your code is ready to be merged into the upstream repository (sketch-city/harvey-api) by creating a pull request. Do this by

More Information and Further Reading

Documentation Standards

Inline Comment Style

(Coming Soon)

Markdown

Documentation such as READMEs (e.g., this document) are written in markdown per the [Github standard] (https://guides.github.com/features/mastering-markdown/)

Design Choices

Thanks To:

Source Code Collaborators can be viewed: https://api.harveyneeds.org/contributors.html

But the API wouldn't mean anything without our volunteers:

Appendix

Developer Resources

Errors you may get and what they mean

LICENSE

Software Code

This system's software code is licensed under the GPLv3.

Full license availabe in LICENSE

Data and Content

<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" />
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.