-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d6eea9
commit 1798fca
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
01-lecture/quemepongo/src/main/java/quemepongo/services/accuweather/AccuWeatherAPI.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package quemepongo.services.accuweather; | ||
|
||
import java.util.*; | ||
|
||
/** | ||
* API de AccuWeather para obtener datos climáticos. | ||
* | ||
* @author Gastón Prieto | ||
* @since 05.26.2020 | ||
*/ | ||
public final class AccuWeatherAPI { | ||
|
||
private final Object epochDateTime = 1556856000; | ||
private final Object weatherIcon = 33; | ||
private final Object value = 57; | ||
private final Object unitType = 18; | ||
|
||
/** | ||
* Obtiene datos climáticos de una ciudad. | ||
* | ||
* @param ciudad la ciudad de la cual obtener datos climáticos | ||
* @return entrega una lista con el clima de las próximas 12 horas en un diccionario. | ||
*/ | ||
public List<Map<String, Object>> getWeather(String ciudad) { | ||
return Arrays.asList(new HashMap<String, Object>() { | ||
{ | ||
put("DateTime", "2019-05-03T01:00:00-03:00"); | ||
put("EpochDateTime", epochDateTime); | ||
put("WeatherIcon", weatherIcon); | ||
put("IconPhrase", "Clear"); | ||
put("IsDaylight", false); | ||
put("PrecipitationProbability", 0); | ||
put("MobileLink", "http://m.accuweather.com/en/ar/villa-vil/7984/"); | ||
put("Link", "http://www.accuweather.com/en/ar/villa-vil/7984"); | ||
put("Temperature", new HashMap<String, Object>() { | ||
{ | ||
put("Value", value); | ||
put("Unit", "F"); | ||
put("UnitType", unitType); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
} |