Code Monkey home page Code Monkey logo

jumper_weather's Introduction

Jumper Weather

The backend for a roadtrip planning application

-----------------------------------------------------

Overview

Sweather Weather is a backend application that exposes several external API's to support an application for planning roadtrips based on weather conditions.

Learning Goals Achieved:
  • 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

Framework

Languages

Tools

Gems


Development Principles

Contributors

๐Ÿ‘ค Jes Jones

-----------------------------------------------------

Local Setup

  1. Fork and Clone the repo
  2. Install gem packages: bundle install
  3. Set up the database: rails db:{drop,create,migrate,seed}
  4. Get API keys from MapQuest, OpenWeather, and Unsplash
  5. Enter API keys into your application.yml file
map_key: <enter your key here>
weather_key: <enter your key here>
background_key: <enter your key here>

-----------------------------------------------------

Endpoints

Retrieve weather for a city:

Request

GET /api/v1/forecast?location=denver,co

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",
          "conditions": "cloudy with a chance of meatballs",
          etc
        },
        {...} etc
      ]
    }
  }
}

Retrieve background image for a city:

Request

GET /api/v1/backgrounds?location=denver,co

Response

{
  "data": {
    "type": "image",
    "id": null,
    "attributes": {
      "image": {
        "location": "denver,co",
        "image_url": "https://pixabay.com/get/54e6d4444f50a814f1dc8460962930761c38d6ed534c704c7c2878dd954dc451_640.jpg",
        "credit": {
          "source": "pixabay.com",
          "author": "quinntheislander"
        }
      }
    }
  }
}

Register a user:

Request

POST /api/v1/users

Request body:

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

Response

{
  "data": {
    "type": "users",
    "id": "1",
    "attributes": {
      "email": "[email protected]",
      "api_key": "jgn983hy48thw9begh98h4539h4"
    }
  }
}

Login a user:

Request

POST /api/v1/sessions

Request body:

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

Response

{
  "data": {
    "type": "users",
    "id": "1",
    "attributes": {
      "email": "[email protected]",
      "api_key": "jgn983hy48thw9begh98h4539h4"
    }
  }
}

Roadtrip:

Request

POST /api/v1/road_trip

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

Acknowlegements

  • MapQuest API
  • OpenWeather API
  • Unsplash API - please refer to this documentation for crediting image use

jumper_weather's People

Contributors

jejones21 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.