Skip to content

Commit

Permalink
Remove last vestiges of google sheet. Add conduct and reorg readme a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
jwo committed Sep 4, 2017
1 parent ed6084e commit 7063f97
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 86 deletions.
3 changes: 0 additions & 3 deletions .env.sample
@@ -1,6 +1,3 @@
GOOGLE_ACCOUNT_TYPE="service_account"
GOOGLE_CLIENT_EMAIL=""
GOOGLE_PRIVATE_KEY=""
AWS_ACCESS_KEY_ID="AKIAJ5PESCDQX7KIMQ5Q"
AWS_SECRET_ACCESS_KEY=""
AWS_ASSOCIATE_TAG=oneclickrelie-20
29 changes: 29 additions & 0 deletions CODE_OF_CONDUCT.md
@@ -0,0 +1,29 @@
Harvey Needs API Code of Conduct
=============

Like the technical community as a whole, the Harvey Needs API team and community is made up of a mixture of professionals and volunteers from all over the world, working on every aspect of the mission - including mentorship, teaching, and connecting people.

Diversity is one of our huge strengths, but it can also lead to communication issues and unhappiness. To that end, we have a few ground rules that we ask people to adhere to. This code applies equally to founders, mentors and those seeking help and guidance.

This isn’t an exhaustive list of things that you can’t do. Rather, take it in the spirit in which it’s intended - a guide to make it easier to enrich all of us and the technical communities in which we participate.

This code of conduct applies to all spaces managed by the Harvey Needs API project. This includes IRC, the mailing lists, the issue tracker, and any other forums created by the project team which the community uses for communication. In addition, violations of this code outside these spaces may affect a person's ability to participate within them.

If you believe someone is violating the code of conduct, we ask that you report it by emailing jesse@comal.io. For more details please see our Reporting Guidelines

* Be friendly and patient.
* Be welcoming. We strive to be a community that welcomes and supports people of all backgrounds and identities. This includes, but is not limited to members of any race, ethnicity, culture, national origin, colour, immigration status, social and economic class, educational level, sex, sexual orientation, gender identity and expression, age, size, family status, political belief, religion, and mental and physical ability.
* Be considerate. Your work will be used by other people, and you in turn will depend on the work of others. Any decision you take will affect users and colleagues, and you should take those consequences into account when making decisions. Remember that we're a world-wide community, so you might not be communicating in someone else's primary language.
* Be respectful. Not all of us will agree all the time, but disagreement is no excuse for poor behavior and poor manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. It’s important to remember that a community where people feel uncomfortable or threatened is not a productive one. Members of the Harvey Needs API community should be respectful when dealing with other members as well as with people outside the Harvey Needs API community.
* Be careful in the words that you choose. We are a community of professionals, and we conduct ourselves professionally. Be kind to others. Do not insult or put down other participants. Harassment and other exclusionary behavior aren't acceptable. This includes, but is not limited to:
* Violent threats or language directed against another person.
* Discriminatory jokes and language.
* Posting sexually explicit or violent material.
* Posting (or threatening to post) other people's personally identifying information ("doxing").
* Personal insults, especially those using racist or sexist terms.
* Unwelcome sexual attention.
* Advocating for, or encouraging, any of the above behavior.
* Repeated harassment of others. In general, if someone asks you to stop, then stop.
* When we disagree, try to understand why. Disagreements, both social and technical, happen all the time and Harvey Needs API is no exception. It is important that we resolve disagreements and differing views constructively. Remember that we’re different. The strength of Harvey Needs API comes from its varied community, people from a wide range of backgrounds. Different people have different perspectives on issues. Being unable to understand why someone holds a viewpoint doesn’t mean that they’re wrong. Don’t forget that it is human to err and blaming each other doesn’t get us anywhere. Instead, focus on helping to resolve issues and learning from mistakes.

Original text courtesy of the [Django Code of Conduct](https://www.djangoproject.com/conduct/)
72 changes: 32 additions & 40 deletions README.md
@@ -1,13 +1,24 @@
The Harvey Needs API
====================

* Imports data from a public google data spreadsheet
* Right now that's https://docs.google.com/spreadsheets/d/14GHRHQ_7cqVrj0B7HCTVE5EbfpNFMbSI9Gi8azQyn-k/edit#gid=0
* Each import does a full import of the needs and shelter sheets
* We serve JSON data here, open and fresh
* viasocket notifies our api when changes have been made to the source data in Google sheets. The api then does a full refresh of the data from the Google sheet.will post to us when an update is posted to the google spreadsheet
* An ad-hoc import can be triggered with `rails google:import`
* You can load Amazon Products by seeding your database: `rails db:seed` (or doing a full import `rails amazon:import`)
* We help client applications help those affeceted by Hurricane Harvey

Example Clients:

* https://sketch-city.github.io/harvey-needs/
* https://www.texasrescuemap.com/muckmap
* https://www.texasrescuemap.com
* SMS Shelter Finder at http://harveyneeds.org/
* http://oneclickrelief.com/

Developer Links
-----

* [CONTRIBUTORS](https://api.harveyneeds.org/contributors.html)
* [LICENSE](#license)
* [CODE OF CONDUCT](CODE_OF_CONDUCT.md)


API
----
Expand Down Expand Up @@ -232,24 +243,14 @@ User.create! email: "youremail@example.com", password: "yourpassword", admin: tr
* In the directory on your local box in which you plan to work run: `git clone git@github.com:<YOUR OWN GITHUB REPOSITORY>/harvey-api.git`

#### 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. Edit the VARS
* Atom users: `atom .env`
* vim users: `vim .env`
* emacs users: `emacs .env`
3. Get a server credential from google for
https://console.developers.google.com/apis/api/drive.googleapis.com/overview
* Screenshot: ![Screenshot](/public/images/readme/screenshot_create-service-account-key.png)

4. Get the private key and email from the json file google gets you
5. While still in the Google develop consoler enable the Google Sheets API. Once enabled it should look like this:
![Screenshot](/public/images/readme/screenshot_enable_google_sheets_api.png)
6. Back in the .env file now, replace the email value and private key values with the values in the JSON
* Take care to copy the full private key which will span multiple lines.
7. 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:

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",
Expand Down Expand Up @@ -293,6 +294,7 @@ You'll need to set the following ENV variables in a .env file
![Screenshot](/public/images/readme/screenshot_rails_server_run_test.png)

#### About the data import job
* You can load Amazon Products by seeding your database: `rails db:seed` (or doing a full import `rails amazon:import`)
The `ActiveJob`s and associated Rake task `rails api:import`, which imports data for shelters and needs from the production API into the application database, is intended for use in development and test environments only.

**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.
Expand Down Expand Up @@ -334,15 +336,19 @@ Documentation such as READMEs (e.g., this document) are written in markdown per
Design Choices
-------------

* one benefit of building our own api is so that we can get rid of using google-sheets eventually.
* Hosted on Heroku and Amazon RDS
* Hosted on Heroku with PostGres
* Uses ActiveJob (currently with sucker_punch)
* MiniTest with Rails system tests

Thanks To:
---------

* Entire Sketch-City organization
* Coding for America
* More More More names here
Source Code Collaborators can be viewed: https://api.harveyneeds.org/contributors.html

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

* [Entire Sketch-City organization](http://sketchcity.org/)
* [Code for America](https://www.codeforamerica.org/)


Appendix
Expand All @@ -351,21 +357,7 @@ Appendix
* [Mastering Markdown](https://guides.github.com/features/mastering-markdown)



### Errors you may get and what they mean
* Could not load default credentials
Looks like:
```rails aborted!
Could not load the default credentials
```
You either have not set up a key OR did not configure it correctly in your .env file

* "accessNotConfigured: Google Sheets API"
Looks like:
```rails aborted!
Google::Apis::ClientError: accessNotConfigured: Google Sheets API has not been used in project harvey-api before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/sheets.googleapis.com/overview?project=harvey-api then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
```
You set up a key properly in the Google console but you did not enable Google sheets.

* "PG::ConnectionBad"
Looks like:
Expand Down
2 changes: 0 additions & 2 deletions app/assets/javascripts/api/hooks.js

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/stylesheets/api/hooks.scss

This file was deleted.

13 changes: 0 additions & 13 deletions app/controllers/api/v1/hooks_controller.rb

This file was deleted.

2 changes: 0 additions & 2 deletions app/helpers/api/hooks_helper.rb

This file was deleted.

4 changes: 1 addition & 3 deletions config/routes.rb
Expand Up @@ -21,9 +21,7 @@
root to: "shelters#index"
namespace :api, defaults: { format: :json } do
namespace :v1 do

post "/google-sheet-update" => "hooks#sheet_update"


get "/needs" => 'needs#index'
get "/shelters" => 'shelters#index'
get "/products" => 'amazon_products#index'
Expand Down
9 changes: 6 additions & 3 deletions lib/tasks/import.rake
@@ -1,15 +1,18 @@
namespace :api do
desc "Schedule import of records for needs and shelters"
task :import => :environment do
ImportSheltersJob.perform_now
ImportNeedsJob.perform_now
if Rails.env.development?
ImportSheltersJob.perform_now
ImportNeedsJob.perform_now
else
puts "Not running api:import because it's not development mode. Mode: #{Rails.env}"
end
end
end

namespace :amazon do
desc "Schedule import of Amazon Products"
task :import => :environment do
ScheduleAmazonFetchJob.perform_now
sleep 300
end
end
17 changes: 0 additions & 17 deletions test/controllers/api/v1/hooks_controller_test.rb

This file was deleted.

0 comments on commit 7063f97

Please sign in to comment.