Giter Club home page Giter Club logo

sweater_weather's Introduction

Sweater Weather

weather

This is the final Mod 3 project as part of Turing School of Software and Design's Back-End Engineering program. This is a Rails API built to accompany a hypothetical Front-End application consuming the Back-End's endpoints for gathering weather forecast data (current, 8-hour, and 5-day) for a location, a background image of the city, registering users, creating sessions, and creating road trips. The road trip functionality goes further to grab travel time between two entered locations and the weather forecast for that estimated time of arrival.

As always, Test-Driven Development was a major concept practiced in the making of this project.

Table of Contents

Introduction

Learning Goals

  • Expose API using Test-Driven Development
  • Expose API requiring authentication token
  • Consume multiple APIs and expose those results through endpoints
  • Format JSON using a serializer gem (I used jsonapi-serializer)

Functional Overview

This scratch Rails API consumes the MapQuest Geocoding API, the OpenWeather One Call API and the Bing Search API. Utilizing various endpoints from these APIs and manipulating the data through services, facades and poros, my application's backend routes could be called to return JSON-serialized data based on what the 'front end user' would input. Search endpoints include current, hourly and daily forecasts for a location and location photos utilizing the Bing Search API. Frontend users can also register an email and password to receive a randomly-generated API key (all saved in User table) as well as create a Session by providing this API key. Road trips can also be created by providing the API key, an origin location and a destination location. This provides the frontend with the entered locations, drive time, and the forecast of the destination location at the estimated arrival time.

Database Structure

Setup

Prerequisites

These setup instructions are for Mac OS.

This project requires the use of Ruby 2.5.3 and Rails 5.2.4.3. I also use PostgreSQL as my database.

Local Setup

To setup locally, follow these instructions:

  • Fork & Clone Repo
    • Fork this repo to your own GitHub account.
    • Create a new directory locally or cd into whichever directory you wish to clone down to.
    • Enter git clone [email protected]:<<YOUR GITHUB USERNAME>>/sweater_weather.git
  • Install Gems
    • Run bundle install to install all gems in the Gemfile
    • Run figaro install to create the hidden application.yml file
  • Set Up Local Database and Migrations
    • Run rails db:{drop,create,migrate}
  • Add API Keys as ENV Variables
    • Sign up for API keys for all three APIs: Bing (requires Azure signup), OpenWeather, and MapQuest
    • Enter these keys in the application.yml file created above as follows:
    MAPQUEST_KEY: <YOUR KEY>
    OPENWEATHER_KEY: <YOUR KEY>
    BING_KEY: <YOUR KEY>
    

Running the tests

  • cd into the folder you cloned this repo into and run rails server.
  • Run bundle exec rspec, and you should see all passing tests.

Playing with Endpoints

In an API tool such as Postman, you can experiment with hitting information using the endpoints in this project. To do so:

  • cd into whichever folder houses this cloned project.
  • Run rails server from the command line.
  • Enter http://localhost:3000 as the domain, followed by whichever endpoint you are trying to hit. See this page for more information.

sweater_weather's People

Contributors

stearnzy avatar

Watchers

 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.