Skip to content

Instantly share code, notes, and snippets.

@AlexKorovyansky
Last active August 29, 2015 14:06
Show Gist options
  • Save AlexKorovyansky/b46588f3c7d1819b637f to your computer and use it in GitHub Desktop.
Save AlexKorovyansky/b46588f3c7d1819b637f to your computer and use it in GitHub Desktop.
Weather Response
// http://api.openweathermap.org/data/2.5/forecast/daily?q=Moscow&mode=json&units=metric&cnt=2&lang=ru
public class Response {
public static class Forecast {
public static class Temp {
@SerializedName("day")
public final double day;
@SerializedName("night")
public final double night;
public Temp(double day, double night) {
this.day = day;
this.night = night;
}
}
private static class Weather {
@SerializedName("icon")
public final String icon;
@SerializedName("description")
public final String description;
public Weather(String icon, String description) {
this.icon = icon;
this.description = description;
}
}
@SerializedName("dt")
public final long dt;
@SerializedName("temp")
public final Temp temp;
@SerializedName("weather")
public final List<Weather> weatherList;
public Forecast(long dt, Temp temp, List<Weather> weatherList) {
this.dt = dt;
this.temp = temp;
this.weatherList = weatherList;
}
}
@SerializedName("cod")
public final String code;
@SerializedName("list")
public final List<Forecast> forecastList;
public Response(String code, List<Forecast> forecastList) {
this.code = code;
this.forecastList = forecastList;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment