Giter VIP home page Giter VIP logo

sweater_weather's Introduction

Sweater Weather AKA Whether Sweater?

Build Status

Sweater weather is a service oriented API meant to be the back end for a road trip planning app. Endpoints are available to get weather data and pictures for a location, register and login users, and fetch weather data for the time of arrival at trip destinations.


Getting Started:

To get started with the API, first clone this repo to your local machine, then run $ bundle install, $ figaro install and $ bundle exec rake db:{create,migrate}. To make use of the API, you will first need to obtain API keys for the MapQuest API, Unsplash API, and OpenWeather API, then add them to your application.yml file. Finally, run $ rails s to start your local server and start making calls to the available endpoints!


Endpoints

If you are running sweater weather with $ rails s, the root url will be localhost:3000.

The following headers should be included on all API calls:

Content-Type: application/json
Accept: application/json
Forecasts
GET /api/v1/forecast?location=<LOCATION>

Response:

{
  "data": {
    "id": null,
    "type": "forecast",
    "attributes": {
      "current_weather": {
        "datetime": "2020-09-30 13:27:03 -0600",
        "temperature": 79.4,
        etc
      },
      "daily_weather": [
        {
          "date": "2020-10-01",
          "sunrise": "2020-10-01 06:10:43 -0600",
          etc
        },
        {...} etc
      ],
      "hourly_weather": [
        {
          "time": "14:00:00",
          "wind_speed": "4 mph",
          "wind_direction": "from NW",
          etc
        },
        {...} etc
      ]
    }
  }
}
Location Backgrounds
GET /api/v1/backgrounds?location=<LOCATION>

Response:

{
  "data": {
    "type": "image",
    "id": null,
    "attributes": {
      "image": {
        "location": "...",
        "image_url": "..."
        "alt_description": "..."
        "credit": {...}
      }
    }
  }
}
User Registration
POST /api/v1/users
Body:
{
  "email": "[email protected]",
  "password": "password",
  "password_confirmation": "password"
}

Response:

{
  "data": {
    "type": "users",
    "id": "1",
    "attributes": {
      "email": "[email protected]",
      "api_key": "jgn983hy48thw9begh98h4539h4"
    }
  }
}
User Login
POST /api/v1/sessions
Body:
{
  "email": "[email protected]",
  "password": "password"
}

Response:

{
  "data": {
    "type": "users",
    "id": "1",
    "attributes": {
      "email": "[email protected]",
      "api_key": "jgn983hy48thw9begh98h4539h4"
    }
  }
}
Road Trip
POST /api/v1/road_trip
Body:
{
  "origin": "Denver,CO",
  "destination": "Pueblo,CO",
  "api_key": "jgn983hy48thw9begh98h4539h4"
}

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"
      }
    }
  }
}

If you would like to try sending requests to the deployed API, Sweater Weather is deployed at https://curtis-sweater-weather.herokuapp.com/.


Built with

  • Rails 5.2.4.3
  • Ruby 2.5.3
  • PostgreSQL 13
  • MapQuest API
  • Unsplash API
  • OpenWeather API

Authors

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.