The Dark Sky API has been completely shut down for some time now so we are migrating to Tomorrow.io to bring back weather data for users.
Approach
I first wrote a small wrapper for the API in Ruby and created a gem for that. This PR removes the old Dark Sky gem and adds my new gem and refactors the weather retriever service to use the new API. By and large the data is mostly backwards compatible with a few exceptions noted below. Notably, it was not necessary to change the Geolocation API since that is still in use. There were some previous reports of getting the wrong weather data for a given location, so it's possible we may still want to replace the Geolocation API (possibly with the browser geolocation API if that continues to be a problem.
Exceptions to backwards compatibility
This API uses a totally different icon system. I attempted to translate their icon codes into our current icons, however in some cases the best approximation is not very good (i.e. for "thunderstorms" the only option I could pick from is "cloudy"). It would likely improve the user experience to pull in their icon system (assets found here), while keeping the old icons around for backwards compatibility with existing data.
Precipitation intensity is calculated slightly differently here. In DarkSky, they just gave one precipitation intensity value whereas Tomorrow gives one for rain, one for sleet, and one for snow. My best guess was to sum these up to make a total precipitation value.
Tomorrow does not provide a text based summary like Dark Sky did. I made a best approximation of recreating that by combining information from the weather code, as well as the temperature to touch on the core weather attributes for that day in a concise summary. Though I'm open to other suggestions here.
Tests
Tests to follow, I need to familiarize myself with the VCR package being used here as well as generate the requisite API data for that. Just want to put up an initial draft PR to get some feedback on this so far.
Other resources
A migration guide from a different API, but it translates DarkSky values
Expand for API translations that I came up with
Dark Sky (Forecast API wrapper)
Tomorrow.io
Notes
Humidity
humidityAvg
Icon
weatherCode
Translating Tomorrow weather codes into the most applicable existing icon
Resolves https://github.com/rubyforgood/Flaredown/issues/535
Context
The Dark Sky API has been completely shut down for some time now so we are migrating to Tomorrow.io to bring back weather data for users.
Approach
I first wrote a small wrapper for the API in Ruby and created a gem for that. This PR removes the old Dark Sky gem and adds my new gem and refactors the weather retriever service to use the new API. By and large the data is mostly backwards compatible with a few exceptions noted below. Notably, it was not necessary to change the Geolocation API since that is still in use. There were some previous reports of getting the wrong weather data for a given location, so it's possible we may still want to replace the Geolocation API (possibly with the browser geolocation API if that continues to be a problem.
Exceptions to backwards compatibility
Tests
Tests to follow, I need to familiarize myself with the VCR package being used here as well as generate the requisite API data for that. Just want to put up an initial draft PR to get some feedback on this so far.
Other resources
Expand for API translations that I came up with