Based off of Code for America's CutePetsDenver made by Team Denver.
Example twitter feed: http://www.twitter.com/ericapets
Edit a the local .env file by adding the appropriate config values. How to get Twitter/PetHarbor/Petfinder config variables is stated below.
rake tweet_pet
- Create a twitter account with the user name you'd like to have stream your pet tweets
- Accept the confirmation email that Twitter sends you.
- Add and validate your phone number for your new Twitter account at https://twitter.com/settings/devices Note: If your phone is already linked to another Twitter acct, then use a Google Voice number.
- Create a new twitter app.
- On the API key tab for the Twitter app, modify permissions so the app can Read and Write. Note: It's important to change permissions to Read/Write before generating the access token. The access token is keyed for the specific access level and will not be updated when changing permissions.
- Create an access token. On the API Key tab in Twitter for the app, click Create my access token
- Take note of the values for environment set up below.
- Create a Heroku account
- Download and install the [Heroku Toolbelt](from: https://toolbelt.heroku.com).
- Create heroku project:
heroku create [app name]
- Push code:
git push heroku master
- Add Twitter environment variables
heroku config:set api_key="your_consumer_key_goes_here"
heroku config:set api_secret="your_consumer_secret_key_goes_here"
heroku config:set access_token="your_access_token_goes_here"
heroku config:set access_token_secret="your_access_token_secret_goes_here"
- Configure pet datasource–you have two options (below). Search on Petfinder for your shelter and use that if you find it, otherwise look on PetHarbor.
- Petfinder
- Register for an account at petfinder.com and then get your API key. To find the shelter id, find a shelter's page on petfinder.com. The id is the last two letters followed by three numbers in the shelter page url. i.e. For this shelter page, http://www.petfinder.com/shelters/CA154.html, the shelter id is CA154.
- Add Petfinder environment variables.
heroku config:set petfinder_key="your_api_key_goes_here"
heroku config:set petfinder_shelter_id="shelter_id_goes_here"
heroku config:set pet_datasource="petfinder"
- PetHarbor
- Find the petharbor shelter id. The shelter id can be found near the end of the url, before the pet id, when clicking on the short link for a pet through petharbor.com. i.e. the shelter id in http://www.petharbor.com/pet.asp?uaid=BRKL.A034281 is BRKL.
- Figure out which pet types your shelter has. Do a search on petharbor.com narrowed down by your shelter. If your shelter has cats, include 'cat' in pet types. If your shelter has dogs or other animals, include 'dog' or 'others' in your pet types as well. When setting the petharbor_pet_types heroku config variable, pet types must be separated with spaces.
- Add Petharbor environment variables
heroku config:set petharbor_shelter_id="shelter_id_goes_here"
heroku config:set petharbor_pet_types="cat dog others"
heroku config:set pet_datasource="petharbor"
- Petfinder
- Schedule tweets
- Add the Heroku Scheduler add on:
heroku addons:add scheduler
- Schedule tweets:
heroku addons:open scheduler
- In the task field:
rake tweet_pet
.
- Add the Heroku Scheduler add on:
- Add your new deployment to the official list
- open where.geojson and add your listing