About The Project | Created By | Built With | Setup | Endpoints | Tests | Roadmap | Acknowledgements
Welcome to Walk Safe! Created to empower individuals to walk alone, Walk Safe brings a user's community along from the trip. Utilizing Geolocation and SMS messaging APIs, we keep a user's community informed of their trip status from start to finish. Should an unforeseen trip interruption arise, Walk Safe will immediately alert the user's contact. We've got your back.
This repository contains our backend Rails app. This app makes calls to Google's Distance Matrix API and exposes API endpoints to our frontend React API. This project is deployed on Heroku (https://walk-safe-backend.herokuapp.com/ , endpoints only).
Caroline Eubanks GitHub LinkedIn
Peter Muellerleile GitHub LinkedIn
- Ruby (version 2.5.3p105)
- Ruby on Rails (version 5.2.6)
- PostgreSQL (version 13)
This project was tested with:
- RSpec version 3.10
- Postman Explore and test the API endpoints
- [pry] https://github.com/pry/pry
- [VCR] https://github.com/vcr/vcr
Continous Integration:
Deployed with:
- Clone the walk-safe-backend repository from your terminal
git clone [email protected]:Walk-Safe/walk-safe-backend.git`
- Change directories to the cloned directory
cd walk-safe-backend
- Install gems
bundle install
- Set up the database
rails db:{create,migrate,seed}
- Obtain an API key from Google Distance Matrix API. You will also need credentials from Twilio if you wish to use the SMS messaging portion of the application.
- We use the Figaro gem to securely store secret keys.
- Run
bundle exec figaro install
from your terminal. - This will create a
config/application.yml
file and also adds it to your.gitignore
file so it won't get pushed to Github. - Now add your keys to
config/application.yml
as shown below - Note that your Twilio keys must be in string format
- Run
google_api_key: <your Google Maps API key>
account_sid: '<your Twilio SID>'
auth_token: '<your Twilio auth token>'
twilio_number: '<your Twilio phone number>'
- Now you can start your server
rails s
- Visit http://localhost:3000/graphiql or use Postman to post queries and mutations as show below in the Endpoints section.
- The test suit can be run with
bundle exec rspec
Endpoints use a POST
method, relying on GraphQL to perform queries and mutations of data.
- Queries must be sent in the request body as shown below.
- The create trip mutation relies on a third party API - Google's Distance Matrix.
Find all users
{
allUsers {
firstName
lastName
username
contacts {
firstName
lastName
phoneNumber
}
}
}
Find one user (requires user id)
{
oneUser(id: 1) {
firstName
lastName
username
contacts {
firstName
lastName
phoneNumber
}
}
}
Create new user (requires: first_name, last_name, username)
mutation {
createUser(input: { firstName: "Claire", lastName: "Littleton", username: "lemonade" }) {
user {
id,
firstName,
lastName,
username
}
errors
}
}
Create new contact (requires: first_name, last_name, phone_number, user_id)
mutation {
createContact(input: {
firstName: "Charlie",
lastName: "Pace",
phoneNumber: "+12625558333"
userId: 10
}) {
contact {
id
firstName
lastName
phoneNumber
}
errors
}
}
Create new trip (requires: start_point, end_point, travel_mode, user_id) Note: possible travel modes are walking, bicycling, or driving
mutation {
createTrip(input: {startPoint: "Boulder CO", endPoint: "Longmont CO", travelMode: "bicycling", userId: 10}) {
trip {
startPoint
endPoint
travelMode
eta
etaString
userId
}
errors
}
}
Text messages are sent utilizing a restful route: https://walk-safe-backend.herokuapp.com/sms_messages
- In the request, send the required information by form-data
- The required fields are mobile_number (beginning with country code (US is '1') followed by the rest of the number -- without punctuation) and message
New SMS to contact
The team utilized a github project board to organize project issues and coordinate workflow across six members, two teams and two repositories. See the open issues for a list of proposed features (and known issues).
See the open issues for a list of proposed features (and known issues).
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Thank you to Google and Twilio for their free tiers allowing us to use their APIs in this project. We'd also like to thank @dionew1 and @Kalikoze of Turing School of Software and Design for their guidance and support during the development process!