Welcome to the backend repo for the Pet MatchMaker website! This repo holds the code responsible for running the database and exposing the API endpoints described in our OpenAPI Documentation. Check out our deployed frontend and it's repo!
- Ruby
- Rails
- Postgres (PostgreSQL)
- RSpec
- factory_bot
- simplecov
- Faraday
- WebMock
- VCR
- Ruby
3.2.2 - bundler gem:
gem install bundler - Postgres
- Clone the repo to your machine:
git clone https://github.com/Pet-MatchMaker-2412/pet_matchmaker_be.git - Open the directory:
cd pet_matchmaker_be - Install required gems:
bundler install - Setup the database:
bundle exec rails db:{create,migrate,seed}
You will need to get a set of credentials from the Petfinder API to use in your local instance. Once you have your API key and secret, follow these steps to allow your local instance to use them:
- Delete the current credentials file located at
config/credentials.yml.enc:rm config/credentials.yml.enc - Open a new credentials file (if you don't use vscode, replace
codewith your preferred editor):EDITOR="code --wait" rails credentials:edit - Add a new top level entry for
petfinderwith two child objects underkeyandsecret. Your file should look like this:
secret_key_base: <RAILS_SECRET_KEY>
petfinder:
key: <PETFINDER_API_KEY>
secret: <PETFINDER_API_SECRET>- Save and close this file
Note: If you plan on working with other developers, you will need to securely share the contents of your config/master.key with them. WARNING: Anybody who has access to your master.key will then have access to your Petfinder API key and secret
- To run the entire suite:
bundle exec rake - To run only the model tests:
bundle exec rspec spec/models - To run only the request tests:
bundle exec rspec spec/requests
To view the available endpoints for this API, please visit our OpenAPI Documentation. There you will find our endpoint definitions, required formatting for requests, example requests and responses (including JSON schemas), and the ability to try out requests on our deployed instance!