Coder Social home page Coder Social logo

elyhess / sweater_weather Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 361 KB

Sweater weather is a rails microservice that aggregates several external APIs to return weather forecast data and estimated travel time for road trippers.

License: MIT License

Ruby 99.69% HTML 0.31%

sweater_weather's People

Contributors

elyhess avatar

Watchers

 avatar

sweater_weather's Issues

User Login

Request:

POST /api/v1/sessions
Content-Type: application/json
Accept: application/json

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

Response:

status: 200
body:

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

Background Image for the city

GET /api/v1/backgrounds?location=denver,co
Content-Type: application/json
Accept: application/json
status: 200
body:

{
  "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",
          "logo": "https://pixabay.com/static/img/logo_square.png"
        }
      }
    }
  }
}

User Registration

Request

POST /api/v1/users
Content-Type: application/json
Accept: application/json

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

Response:

status: 201
body:

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

Retrieve Weather For a City

GET /api/v1/forecast?location=denver,co
Content-Type: application/json
Accept: application/json

location params fetch geo information from MapQuest Geocoding API

return forecast data from OpenWeather API

Road Trip Endpoint

Request:

POST /api/v1/road_trip
Content-Type: application/json
Accept: application/json

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

Setup

  • Create API Rails app
  • Add gems
  • Migrations

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.