Coder Social home page Coder Social logo

nearest-fuel-station-7's Introduction

Nearest Fuel Station

Versions

Ruby 3.2.2

Rails 7.0.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.

nearest-fuel-station-7's People

Contributors

mikedao avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.