public IEnumerable <WeatherInfo> PastWeather(double lat, double log, DateTime from, DateTime to) { string latStr = lat.ToString("0.000", CultureInfo.InvariantCulture); string logStr = log.ToString("0.000", CultureInfo.InvariantCulture); string fromStr = from.ToString("dd-MM-yyyy"); string toStr = to.ToString("dd-MM-yyyy"); String url = String.Format(PATH_WEATHER, latStr, logStr, fromStr, toStr, WEATHER_KEY); string body = req.GetBody(url); pastWeather .CtorArg("date", 0) .CtorArg("tempC", 2) .PropArg("PrecipMM", 11) .PropArg("Desc", 10); IEnumerable <WeatherInfo> items = pastWeather .Load(body) .RemoveWith("#") .Remove(1) .RemoveEvenIndexes() .Parse(); return(items); }
public IEnumerable <LocationInfo> Search(string query) { string search = string.Format(SEARCH, query); string body = req.GetBody(search); locations .CtorArg("country", 1) .CtorArg("region", 2) .CtorArg("latitude", 3) .CtorArg("longitude", 4); IEnumerable <LocationInfo> items = locations .Load(body) .RemoveWith("#") .RemoveEmpties() .Parse(); return(items); }
public IEnumerable <MonthlyAverage> PastMonthlyAverage(string var, string start, string end, string countryCode) { string url = GetMonthlyAvgUrl(var, start, end, countryCode); string body = req.GetBody(url); monthlyAvg .CtorArg("gcm", 0) .CtorArg("measure", 1) .CtorArg("monthly", 4, 15) .PropArg("Beginning", 2) .PropArg("End", 3); IEnumerable <MonthlyAverage> items = monthlyAvg .Load(body) .Remove(1) .RemoveEmpties() .Parse(); return(items); }