Skip to content

hannahkwarren/sweater_weather

Repository files navigation

README: Sweater Weather

languages PRs rspec simplecov All Contributors

Background and Description

"Sweater Weather" is a solo project undertaken during Module 3 of Turing School of Software and Design's Backend Engineering program.

Learning Goals

  • Expose an API that aggregates data from multiple external APIs
  • Expose an API that requires an authentication token
  • Expose an API for CRUD functionality
  • Determine completion criteria based on the needs of other developers
  • Research, select, and consume an API based on your needs as a developer

Requirements and Setup (for Mac):

Ruby and Rails

  • Ruby Version 2.7.2
  • Rails Version 5.2.6

Gems Utilized

  • RSpec
  • Pry
  • SimpleCov
  • Capybara
  • Shoulda-Matchers
  • Factory_Bot_Rails
  • Faker
  • jsonapi-serialize
  • Figaro
  • Webmock
  • VCR
  • jquery-rails
  • rspec_junit_formatter
  • Orderly
  • Lockbox
  • Blind Index

Setup

  1. Clone this repository: On your local machine open a terminal session and clone the repositiory. Once cloned, you'll have a new local copy in the directory you ran the clone command in.

  2. Change to the project directory:
    In terminal, use $cd to navigate to the Frontend Application project directory.

$ cd frontend_application
  1. Install required Gems utilizing Bundler:
    In terminal, use Bundler to install any missing Gems. If Bundler is not installed, first run the following command.
$ gem install bundler

If Bundler is already installed or after it has been installed, run:

$ bundle install

There should be be verbose text diplayed of the installation process. If there are any errors, verify that bundler, Rails, and your ruby environment are correctly setup.

  1. Database Migration
    Before using the web application you will need to setup your databases locally by running the following command
$ rails db: {:drop, :create, :migrate, :seed}
  1. Set up environment variables
$ bundle exec figaro install

This will create a hidden file called application.yml. You will need to sign up for three API keys to run this project:

  1. Add all three keys to your application.yml to set up a local variable for your endpoints if you choose to deploy outside of localhost.
mapquest_api_key: <insert_your_key_here>
weather_api_key: <insert_your_key_here>
unsplash_api_key: <insert_your_key_here>
  1. You will also need to install Lockbox and add a master key to your credentials.yml.enc per the documentation. When you've configured lockbox, don't forget to do a bundle install!

  2. Startup and Access
    Finally, in order to use the web app you will have to start the server locally and access the app through a web browser.

  • Start server
$ rails s
  1. Go to town! Use Postman, curl, or another tool of your choice to make a request to http://localhost:3000/api/v1

Supported Endpoints

GET /forecast?location=NewYork,NY provides a current forecast, daily forecast for the next 5 days, and hourly forecast for the next 8 hours at a given location.

GET /background?location=NewYork,NY provides a single image, via the Unsplash API, tagged or titled with the provided location.

POST /users adds a user to the database given a valid and unique email, and matching password and password confirmation. Params must be provided in the body of the request in JSON format. Here's an example hash:

{
    "user": {
        "email": "[email protected]",
        "password": "mypassword",
        "password_confirmation": "mypassword"
    }
}

POST /sessions logs in a user given email and password, provided as JSON in the request body.

{
    "email": "[email protected]",
    "password": "mypassword"
}

POST /road_trip compiles travel time and weather forecast at projected arrival time for a roadtrip (nonstop) between origin and destination. Requires a valid api_key. Your params must again be JSON in the request body:

{
  "origin": "New York, NY",
  "destination": "Burlington, VT",
  "api_key": "your_key_goes_here"
}

Contributors (emoji key):


Hannah(she/her)

💻 👀

This project follows the all-contributors specification.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages