public WeatherForecast GetForecast(IWeatherQuery query) { var response = _client.GetAsync(_settings.BaseUrl + query.GetQueryString() + _settings.ApiKey).Result; if (response.IsSuccessStatusCode) { return(_mapper.Map <WeatherForecast>(JsonConvert.DeserializeObject <OpenWeatherResponse>(response.Content.ReadAsStringAsync().Result))); } else { return(null); } }
// -------- Constructor -------- /// <summary> /// Constructor. /// </summary> /// <param name="weatherQuery">The means to query the weather.</param> public WeatherReporter(IWeatherQuery weatherQuery) { this.weatherQuery = weatherQuery; this.reportCache = new Dictionary <string, WeatherReport>(); }