zingsurfer / powderkeg

A Snow Day Weather & image API

Home Page:https://powderkeg.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Powder Keg

Module 4 | Contributors: Autumn Martin

About

Intro

Powder Keg finds the ski resort with the most ideal conditions for a great powder day! This API provides weather data (snowfall, wind, sunshine, etc.) specific to Colorado ski resorts to help skiers and snowboarders plan their trip to the mountain. It also provides awesome pics of skiers & snowboarders to get users in the zone.

PowderKeg is deployed here.

Background

PowderKeg is an API which consumes weather data from DarkSky and World Weather Online. PowderKeg is deployed here, and you are looking at its source repository here. PowderKeg is consumed by my other app, Ski Meow. Ski Meow is a JavaScript single page app that displays weather data for local Ski Resorts. PowderKeg also consumes data from Unsplash, which Ski Meow uses to feature a random image for the background.

Tech Stack

Rails 5.2.1, Ruby 2.5.1, RSpec, PostgreSQL, Faraday

Endpoints

Random image related to search words

GET /api/v1/images?query=#{search_params}

Request:

GET /api/v1/images?query=ski,snowboard
Content-Type: application/json
Accept: application/json

Response:

Weather data based on resort name

GET /api/v1/snowcast?location=#{resort.name}

Request:

GET /api/v1/snowcast?location=crested_butte
Content-Type: application/json
Accept: application/json

Response:

Register

POST /api/v1/users

Request:

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

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

Response:

status: 201
body:

{
  "api_key": "asd8987dfajskdl238j23h",
}

Log In

POST /api/v1/sessions

Request:

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

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

Response:

status: 200
body:

{
  "api_key": "uio1423dfaj234l238j45z",
}

Getting started

Production

This app has been deployed to Heroku. It may be viewed in production here: https://powderkeg.herokuapp.com/

Development

First, clone this repository via git clone git@github.com:Autumn-Martin/powderkeg.git.

Run rails g figaro to create a application.yml file to hold your API keys that will be gitignored. You will need API keys from DarkSky, World Weather Service, & Unplash.

You will also need the Rails application's secret key (Rails.application.credentials.secret_key_base). More info about this here

Install the required gems for this application using Bundler. Run bundle in the CLI.

Run rake db:setup to create the database, build tables and columns based the schema, & seed the data.

Start a server with rails s.

Now view the app locally in development by visiting http://localhost:3000/ in your browser.

Testing

The test suite is created through RSpec. To run this test suite, run rspec. Currently, this repo maintains 100% test coverage.

About

A Snow Day Weather & image API

https://powderkeg.herokuapp.com/


Languages

Language:Ruby 91.6%Language:HTML 3.7%Language:CSS 2.8%Language:JavaScript 1.8%