Git Product home page Git Product logo

dangerous_days's Introduction

Dangerous Days

Date: October 20, 2018. Module 3 Project.

Set up

  1. Clone down this repo.
  2. Run the following in the command line: bundle and rake db:{create,migrate,seed}

Testing

Run tests with bundle exec rspec


Module 3 Assessment

In this project you will:

  • Demonstrate mastery of all parts of the Rails stack
  • Demonstrate mastery of Ruby throughout the process
  • Write tests for the added features

Areas of Knowledge

Areas to be tested is explained in the Areas of Knowledge section of the Assessment doc.

Expectations

Criteria is explained in the Expectations section of the Assessment doc.

Preparation

Clone down and run through the README for Asteroids

Sign up for an API key through NASA

Challenges

Work through the following challenges. The first section is easier so it should not take half the time if you plan on finishing both.

Feature 1: Most Dangerous Day

Background:

Feature: A guest user visits the root page and enters a start date and end date. The resulting page will display the most dangerous day in that range based on which day has the most is_potentially_dangerous_asteroid set to true. Given the scenario below, it should be January 1, 2018 with 3 potentially dangerous asteroids.

As a guest user
When I visit "/"
And I enter "2018-01-01" into the start date
And I enter "2018-01-07" into the end date
And I click "Determine Most Dangerous Day"

Then I should be on "/most_dangerous_day"
And I should see a heading for "Most Dangerous Day"
And I should see "January 1, 2018 - January 7, 2018"
And I should see a heading for the most dangerous day in that range "January 1, 2018"
And I should see 3 asteroids in that list

And I should see "Name: (2014 KT76)"
And I should see "NEO Reference ID: 3672906"

And I should see "Name: (2001 LD)"
And I should see "NEO Reference ID: 3078262"

And I should see "Name: (2017 YR1)"
And I should see "NEO Reference ID: 3794979"

Page should look something like this:

feature mockup

Feature 2: API - Retrieving a user's favorites

Background: This story assumes the base data from running rake db:seed. Registered user has an api_key of abc123.

As a registered user
When I send a 'GET' request to '/api/v1/user/favorites?api_key=abc123'
Then I should receive a JSON response as follows:
[
  {
    "id":1,
    "neo_reference_id": "2153306",
    "user_id": 1,
    "asteroid": {
      "name": "153306 (2001 JL1)",
      "is_potentially_hazardous_asteroid": false,
    }
  }
]

Feature 3: API - Favoriting an Asteroid

Background: This story assumes the base data from running rake db:seed This SHOULD NOT save the asteroid data into the database. Asteroid data should be returned from the NASA API. You should save the neo_reference_id in the favorites table.

When I send a POST request to "/api/v1/user/favorites" with an 'api_key' of 'abc123' and a 'neo_reference_id' of '2021277'
Then I should receive a response with a status code of 200
And the body should be JSON as follows:
{
  "id":2,
  "neo_reference_id": "2021277",
  "user_id": 1,
  "asteroid": {
    "name": "21277 (1996 TO5)",
    "is_potentially_hazardous_asteroid": false,
  }
}

Evaluation Criteria

The criteria is located in the Assessment file.

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.