Title

Build Status Forks Issues

Table of contents

About The Project | Created By | Built With | Setup | Endpoints | Tests | Roadmap | Acknowledgements

About The Project

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).

Created By

Back End Team

Gaelyn Cooper GitHub LinkedIn

Joe Mecha GitHub LinkedIn

Mike Foy GitHub LinkedIn

Front End Team

Bryan Hohn GitHub LinkedIn

Caroline Eubanks GitHub LinkedIn

Peter Muellerleile GitHub LinkedIn

Built With

This project was tested with:

Continous Integration:

Deployed with:

Project Architecture

Project Architecture

Setup

  git clone git@github.com: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
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

/graphql

Endpoints use a POST method, relying on GraphQL to perform queries and mutations of data.

  1. Queries must be sent in the request body as shown below.
  2. The create trip mutation relies on a third party API - Google's Distance Matrix.

GraphQL Queries

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
    }
  }
}

GraphQL Mutations

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
  }
}

RESTful route

Text messages are sent utilizing a restful route: https://walk-safe-backend.herokuapp.com/sms_messages

  1. In the request, send the required information by form-data
  2. 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

New SMS to contact

Roadmap

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).

Making a Contribution

  1. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  2. Commit your Changes (git commit -m 'Add some AmazingFeature')
  3. Push to the Branch (git push origin feature/AmazingFeature)
  4. Open a Pull Request

Acknowledgements

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!