Skip to content

hschmid516/sweater-weather

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sweater Weather

Table of Contents
  1. About The Project
  2. Getting Started
  3. Roadmap
  4. Contributing
  5. Contact

About The Project

This was a solo project completed during the final week of module 3 of 4 at Turing School of Software & Design. The goal of this project was to create a successful web application to plan road trips. This app allows users to see the current weather for any given location, as well as the forecasted weather at the destination during the estimated time of arrival.

This project was completed with a focus on service-oriented architecture. It was designed to aggregate data from multiple endpoints of three different external APIs, and expose a token-authenticated API that satisfied the requirements given from the front-end team.

(back to top)

Built With

Framework

Languages

Tools

Gems


Development Principles

(back to top)

Getting Started

Installation

  1. Clone the repo
    git clone git@github.com/hschmid516/sweater-weather.git
  2. Run bundle
    bundle install
  3. Run migrations
    rails db:{create,migrate}
  4. Install Figaro
    bundle exec figaro:install
  5. Get API keys for the following APIs
  6. Add API keys to application.yml

(back to top)

Roadmap

GET /api/v1/forecast?location={location}

Get weather data for a given location

Response

{
   "data": {
        "id": null,
        "type": "forecast",
        "attributes": {
            "current_weather": {
                "datetime": "2021-11-16T20:29:34.000-07:00",
                "sunrise": "2021-11-16T05:26:08.000-07:00",
                "sunset": "2021-11-16T15:30:52.000-07:00",
                "temperature": 60.19,
                "feels_like": 60.1,
                "humidity": 89,
                "uvi": 0,
                "visibility": 10000,
                "conditions": "broken clouds",
                "icon": "04n"
            },
            "daily_weather": [
                {
                    "date": "2021-11-16",
                    "sunrise": "2021-11-16T05:26:08.000-07:00",
                    "sunset": "2021-11-16T15:30:52.000-07:00",
                    "max_temp": 64.22,
                    "min_temp": 38.52,
                    "conditions": "broken clouds",
                    "icon": "04d"
               },
                ...
            ],
            "hourly_weather": [
                {
                    "time": "20:00:00",
                    "temperature": 60.19,
                    "conditions": "broken clouds",
                    "icon": "04n"
                },
                ...
            ]
        }
     }
}

GET /api/v1/backgrounds?location={location}

Get image for a given city

Response

{
  "data": {
      "id": null,
      "type": "image",
      "attributes": {
          "image": {
              "location": "Denver Colorado",
              "image_url": "https://images.unsplash.com/photo-1634507307799-ace9b49840b7?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwyNzU0ODR8MHwxfHNlYXJjaHwxfHxkZW52ZXIlMkNjb3xlbnwwfHx8fDE2MzcxMDkzNjQ&ixlib=rb-1.2.1&q=80&w=1080",
              "credit": {
                  "source": "https://unsplash.com/",
                  "user": "dillydallying",
                  "user_url": "https://unsplash.com/@dillydallying",
                  "name": "Dillon Wanner"
              }
          }
      }
  }
}

POST /api/v1/users

Register a user

  • Content-Type: application/json
  • Accept: application/json

Request Body

{
   "email": "whatever@example.com",
   "password": "password",
   "password_confirmation": "password"
}

Response

{
   "data": {
   "type": "users",
   "id": "1",
   "attributes": {
     "email": "whatever@example.com",
     "api_key": "jgn983hy48thw9begh98h4539h4"
    }
  }
}

POST /api/v1/sessions

User login

  • Content-Type: application/json
  • Accept: application/json

Request Body

{
  "email": "whatever@example.com",
  "password": "password"
}

Response

{
  "data": {
    "type": "users",
    "id": "1",
    "attributes": {
      "email": "whatever@example.com",
      "api_key": "jgn983hy48thw9begh98h4539h4"
    }
  }
}

POST /api/v1/road_trip

Create a road trip

  • Content-Type: application/json
  • Accept: application/json

Request Body

{
  "origin": "Denver,CO",
  "destination": "Pueblo,CO",
  "api_key": "53ZqhpECyRoKUheAX6v6hXCc"
}

Response

{
  "data": {
    "id": null,
    "type": "roadtrip",
    "attributes": {
      "start_city": "Denver, CO",
      "end_city": "Estes Park, CO",
      "travel_time": "2 hours, 13 minutes"
      "weather_at_eta": {
        "temperature": 59.4,
        "conditions": "partly cloudy with a chance of meatballs"
      }
    }
  }
}

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Contact

(back to top)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published