public async Task <double> GetCurrentTempAsync(int zipCode) { string response = string.Empty; try { response = await httpClient.GetStringAsync($"current.json?key={apiKey}&q={zipCode}"); } catch (HttpRequestException) { // for ApixuClientTests_GetTemp_GivenAZipCode_NotFound_ThrowsException discussion // TODO check the body of the exception throw new NotFoundException($"{zipCode} didn't work"); } var weather = ApiuxWeatherCurrentResponse.FromJson(response); return(weather.Current.TempF); }
public static string ToJson(this ApiuxWeatherCurrentResponse self) => JsonConvert.SerializeObject(self);