private string GetCityJsonUrl(City city)
 {
     var apiKey = "8a497054d4f3f9e8";
     string jsonUrl = string.Format("http://api.wunderground.com/api/{2}/forecast/q/{0}/{1}.json", city.CountryCode,
                                    city.Name, apiKey);
     return jsonUrl;
 }
Exemplo n.º 2
0
 public static CityForecast GetCityForecast(City city, WUGResponse response)
 {
     return new CityForecast
         {
             City = city,
             Forecast = response.forecast,
             Now = response.forecast.txt_forecast.forecastday.FirstOrDefault()
         };
 }
 public Task<string> GetJsonAsync(City city)
 {
     var jsonUrl = GetCityJsonUrl(city);
     return webTools.DownloadString(jsonUrl);
 }
 private static CityForecast GetCityForecast(City currentCity)
 {
     var forecast = JsonConvert.DeserializeObject<WUGResponse>(new MockWeatherUndergroundSource().GetJson());
     return Transformers.GetCityForecast(currentCity, forecast);
 }
 private static async Task<CityForecast> GetCityForecast(CityWeatherForecastSource cityWeatherForecastSource, City city)
 {
     var forecastJson = await cityWeatherForecastSource.GetJsonAsync(city);
     var response = JsonConvert.DeserializeObject<WUGResponse>(forecastJson);
     return Transformers.GetCityForecast(city, response);
 }