ajtran303 / whether_sweater

A weather data API with geolocation and image search services.
0 stars 0 forks source link

Weather For a City #1

Open ajtran303 opened 3 years ago

ajtran303 commented 3 years ago

Given this request

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

Retrieve weather data for a city that includes:

current weather:
- description of conditions
- current temperature
- high temperature for today
- low temperature for today
- feels like
- humidity
- visibility
- uv index
- sunrise time
- sunset time

hourly forecast:
- current hour and next 7 hours (8 total)
- high temperature for that hour

daily forecast:
- the next five days
- weather condition
- precipitation, in mm
- high temperature for that day
- low temperature for that day

location data:
- city
- state
- country
- time and date (formatted from epoch time)

Requirements:

Endpoint needs to use the city and state from the GET request and send it to MapQuest’s Geocoding API to retrieve the latitude and longitude for the city. Use of the MapQuest’s Geocoding API is a hard requirement.

Retrieve forecast data from the OpenWeather One Call API using the latitude and longitude from MapQuest.

Testing should look for more than just the presence of attribute fields in the response. Testing should also determine which fields should NOT be present. (don’t send unnecessary data)

ajtran303 commented 3 years ago

Going to need to install the figaro gem to configure Environment Variables for the API keys.

Additionally, Webmock / VCR for testing external API calls.

ajtran303 commented 3 years ago

I started by making a PORO for handling date / time conversions. It looks like I need one for handling temperature conversions as well.

ajtran303 commented 3 years ago

I have added a temperature poro.

ajtran303 commented 3 years ago

It appears that the endpoint needs to say how much precipitation there is. The precipitation data will not be there unless there is actual precipitation in the forecast.

These are the key values to look out for from the OpenWeatherMap OneCall API:

pop - probability of precipitation - if it's too low then there will be none
rain - volume in mm
snow - volume in mm

from eyeballing, a pop value as high as .25 does not forecast any mm of precipitation

but at at .8

      "pop": 0.8,
      "rain": 2.48,

so there could be some kind of threshold or absence of precipitation

ajtran303 commented 3 years ago

i can find out more by looking up data for where it is raining or snowing right now

ajtran303 commented 3 years ago

In Minneapolis, pop .24 brings rain.3`

ajtran303 commented 3 years ago

This feature is working and needs some sad path / exception handling