NickLindeberg / sweater_weather

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sweater Weather Project Spec

  1. Weather for a City The functionality for this page should be split into multiple user stories.

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

There is room for personal preference for this response body. Use the mock ups to see what data is required on the front end to decide what you would like to include in your response. If you’d like more of a challenge, you might consider using Fast JSON API and consider trying to stick to the JSON 1.0 spec.

Requirements:

Needs to pull out the city and state from the GET request and send it to Google’s Geocoding API to retrieve the lat and long for the city (this can be it’s own story) Retrieve forecast data from the Darksky API using the lat and long Root Page

  1. Account Creation POST /api/v1/users Content-Type: application/json Accept: application/json

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

status: 201 body:

{ "api_key": "jgn983hy48thw9begh98h4539h4", } Sign Up Mockup

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

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

status: 200 body:

{ "api_key": "jgn983hy48thw9begh98h4539h4", } Login Mockup

  1. Favoriting Locations POST /api/v1/favorites Content-Type: application/json Accept: application/json

body:

{ "location": "Denver, CO", # If you decide to store cities in your database you can send an id if you prefer "api_key": "jgn983hy48thw9begh98h4539h4" } Requirements:

API key must be sent If no API key or an incorrect key is provided return 401 (Unauthorized) 5. Listing Favorite Locations GET /api/v1/favorites Content-Type: application/json Accept: application/json

body:

{ "api_key": "jgn983hy48thw9begh98h4539h4" } Requirements:

API key must be sent If no API key or an incorrect key is provided return 401 (Unauthorized) Response:

status: 200 body: [ { "location": "Denver, CO", "current_weather": { # This can vary but try to keep it consistent with the # structure of the response from the /forecast endpoint }, "location": "Golden, CO", "current_weather": { {...} } } ] 6. Removing Favorite Locations DELETE /api/v1/favorites Content-Type: application/json Accept: application/json

body:

{ "location": "Denver, CO", # If you decide to store cities in your database you can send an id if you prefer "api_key": "jgn983hy48thw9begh98h4539h4" } Requirements:

API key must be sent If no API key or an incorrect key is provided return 401 (Unauthorized) Response:

status: 200 body: [ { "location": "Denver, CO", "current_weather": { # This can vary but try to keep it consistent with the # structure of the response from the /forecast endpoint }, "location": "Golden, CO", "current_weather": { {...} } } ]

About


Languages

Language:Ruby 99.5%Language:HTML 0.5%