Giter Site home page Giter Site logo

sweater_weather's Introduction

README

What does this app do?

  • Glad you asked! Sweater Weather is an API backend client that has multiple endpoints to satisfy your need to look up weather at a certain location, find a road trip end point weather conditions and trip duration, as well as finding munchies along the way.

Ruby version

This app was implemented utilizing ruby V2.5.3.

System dependencies

  • System dependencies are:

    • 'rails 6.1.1'
    • 'figaro'
    • 'faraday'
    • 'fast_jsonapi'
    • 'bcrypt', '~> 3.1.7'
  • Testing dependencies are:

    • 'rspec'
    • 'capybara'
    • 'simplecov'
    • 'shoulda-matchers'
    • 'webmock'
    • 'vcr'

Configuration/Installation

  • To install this app:
    1. Clone repository
    2. run 'bundle install' in CLI
    3. run 'rails db:{create,migrate}' in CLI
    4. run 'figaro install' in CLI
    • navigate to config/application.yml and implement your API keys, you will need:
      1. WEATHER_API_KEY (provided from OpenWeather)
      2. LOCATION_API_KEY (provided from MapQuest API)
      3. IMAGE_API_KEY (provided from Bing services)
      4. BUISNESS_API_KEY (provided from Yelp - key includes 'Bearer' tag)
    1. run 'bundle exec rspec' in CLI and you should expect 55 passing tests

Database schema

  • simple one table schema design: Screen Shot 2021-01-19 at 2 40 58 PM

Endpoints

get api/v1/forecast

  • acceptable parameters are 'location' (string - i.e. Denver,CO) and units (string - 'imperial' or 'metric') * this end point allows the requestor to find weather information for a specified location, sample output of this endpoint:
{
  "data": {
      "id": null,
      "type": "forecast",
      "attributes": {
          "temp": 3.61,
          "day_feels_like": 0.0,
          "description": "broken clouds",
          "date": "2021-01-19 14:43:10 -0700",
          "clouds": 72,
          "sunset": "2021-01-19 17:04:03 -0700",
          "sunrise": "2021-01-19 07:17:07 -0700",
          "humidity": 27,
          "uvi": 0.59,
          "visability": 10000,
          "icon": "04d",
          "hourly_weather": [
              {
                  "time": "14:00:00",
                  "temp": 3.61,
                  "wind_speed": 2.32,
                  "wind_direction": "SSE",
                  "description": "broken clouds",
                  "icon": "04d"
              }, ...
          ],
          "daily_weather": [
              {
                  "date": "2021-01-19",
                  "max_temp": 3.61,
                  "min_temp": -2.1,
                  "description": "overcast clouds",
                  "sunset": "2021-01-19 17:04:03 -0700",
                  "sunrise": "2021-01-19 07:17:07 -0700",
                  "icon": "04d"
              }, ...
           ]
        }
    }
}

get api/v1/backgrounds

  • acceptable parameters are 'location' (string - i.e. Denver,CO) * this end point allows the requestor to find a picture for a specified location, sample output of this endpoint:
{
    "data": {
        "id": null,
        "type": "background",
        "attributes": {
            "bing_logo": "https://static.wikia.nocookie.net/logopedia/images/e/ee/Bing_2016.svg/revision/latest/scale-to-width-down/1000?cb=20160115161107",
            "microsoft_privacy_agreement": "https://go.microsoft.com/fwlink/?LinkId=521839",
            "image": "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e8/Denver_skyline.jpg/1200px-Denver_skyline.jpg",
            "width": 1200,
            "height": 794,
            "host_page": "https://en.wikipedia.org/wiki/Denver",
            "host_page_display": "https://en.wikipedia.org/wiki/Denver",
            "date_published": "2020-05-09T05:48:00.0000000Z"
        }
    }
}

post api/v1/users

  • parameters must be sent as a json payload, acceptable parameters are email, password, password_confirmation (all strings)
    • this end point allows the requestor generate a new user in the internal data base and build and associated api_key, sample response below:

Screen Shot 2021-01-19 at 3 33 18 PM

post api/v1/sessions

  • parameters must be sent as a json payload, acceptable parameters are email, password (all strings)
    • this end point allows the requestor verify a user by their email and password - returns email and api_keys, sample response below:

Screen Shot 2021-01-19 at 3 39 37 PM

post api/v1/road_trip

  • parameters must be sent as a json payload, acceptable parameters are 'origin' and 'destination' (string - i.e. Denver,CO), api_key (string provided from user data) and units (string - 'imperial' or 'metric')
    • this endpoint allows the requestor to build a roadtrip that will return trip details, sample response below:

Screen Shot 2021-01-19 at 3 45 15 PM

get api/v1/munchies

  • acceptable parameters are 'origin' and 'destination' (string - i.e. Denver,CO), food (string - type of restaurant i.e. chinese) and units (string - 'imperial' or 'metric')
    • this endpoint allows the requestor to fetch trip details similar to roadtrip but will include a restaurant of your food choice at the destination, sample response below:

Screen Shot 2021-01-19 at 3 49 45 PM

Services/APIs

This application utilizes the following APIs

  • OpenWeather
  • Yelp
  • MapQuest
  • Bing

sweater_weather's People

Contributors

cpfergus1 avatar

Watchers

 avatar

sweater_weather's Issues

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.