forked from huginn/huginn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update weather agent to support both Dark Sky and OpenWeather
- Updates the README clarifying support of OpenWeather, Dark Sky, and Wunderground. - Merges pull request huginn#2848's support for OpenWeather in, without removing support for Dark Sky as the original pull request did. (Thanks Ryan Waldron for this!) Choosing which weather provider to use is done via the `service` option which was previously used in the WeatherAgent to support Wunderground and Dark Sky simultaneously, until Wunderground ended support for their API, at which time it was removed. Since the WeatherAgent didn't require a `service` option for a while, this diff takes the approach of defaulting to "forecastio" if no `service` option is provided in order to avoid breaking configurations prior to this change. However, the default `service` value for a new configuration will be "openweather." Additionally, "forecastio" can be explicitly specified, again to ensure compatibility with even older configurations. A note on testing - I am not a Ruby developer, so I am not quite sure how best to add tests around the branching behavior that occurs in the `model` method. Even worse, since I do not have a Dark Sky API key, I cannot manually test it. I did manually test OpenWeather. It would also be ideal to have tests which verify that the translation of data occurs without error using fixtures from each provider. Tests of this behavior did not already exist in `weather_agent_spec.rb`, however OpenWeather is tested indirectly by `agent_spec.rb` among other specs. You can find these tests easily by searching for the OpenWeather data fixture's file name ("openweather.json"). If someone were interested in creating tests of this nature in `weather_agent_spec.rb`, you can also find a fixture file for Dark Sky at `/spec/data_fixtures/weather.json` in any commit prior to the commits from huginn#2848 (starting with a61924f.)
- Loading branch information
1 parent
d0a405c
commit cca884c
Showing
10 changed files
with
236 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.