knestler / nearest-fuel-station

Backend Module 3 Diagnostic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nearest Fuel Station

Versions

Ruby 2.7.4

Rails 5.2.6

Set Up

  • Clone this repo
  • bundle install
  • bundle exec figaro install
  • `rails db:{create,migrate}``
  • rails s

Api Info

We will be using:

  1. The NREL API:
  1. The MapQuest Directions API:

User Story

We will be searching for the nearest electric charging station to a location selected from a drop down.

As a visitor
When I visit "/"
And I select "Griffin Coffee" form the start location drop down (Note: Use the existing search form)
And I click "Find Nearest Station"
Then I should be on page "/search"
Then I should see the closest electric fuel station to me.

For that station I should see
- Name
- Address
- Fuel Type
- Access Times

I should also see:
- the distance of the nearest station (should be 0.1 miles)
- the travel time from Griffin Coffee to that fuel station (should be 1 min)
- The direction instructions to get to that fuel station
  "Turn left onto Lawrence St Destination will be on the left"

Further Practice

Do the same challenge above, but instead of creating a view, render json

  • Create a Rails API application
  • Create the endpoint `GET /api/v1/nearest_fuel?location=denver,co
  • The expected response should look like:
    {
      "data": {
        "id": "null",
        "type": "fuel_stations",
        "attributes": {
          "destination": "Griffin Coffee",
          "Name": "7Eleven" ,
          "Address": "111 7eleven drive Denver CO 80223",
          "Fuel_type": "electric",
          "Access_times": "access times here",
          "Travel_info": {
                   "Distance": "1 mile",
                    "Travel_time": "1 minute",
                    "Directions": "Turn left onto Lawrence St Destination will be on the left"
         }
       }
    }
    }
    
    Note: this example has some made up data, but that's the format you can try to get your response to look like.

About

Backend Module 3 Diagnostic


Languages

Language:Ruby 78.8%Language:HTML 16.3%Language:JavaScript 3.0%Language:CSS 1.9%