All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.endercrest.uwaterlooapi.weather.WeatherAPI Maven / Gradle / Ivy

package com.endercrest.uwaterlooapi.weather;

import com.endercrest.uwaterlooapi.data.ApiRequest;
import com.endercrest.uwaterlooapi.weather.models.WeatherCurrent;
import com.google.gson.reflect.TypeToken;

/**
 * Created by Thomas Cordua-von Specht on 12/2/2016.
 */
public class WeatherAPI {

    private static final String WEATHER_ENDPOINT = "weather/current";

    private final String apiKey;

    public WeatherAPI(String apiKey){
        this.apiKey = apiKey;
    }

    /**
     * Returns the current weather details for the University of Waterloo.
     * @see http://weather.uwaterloo.ca
     * @return {@link WeatherCurrent}
     */
    public ApiRequest getCurrentWeather(){
        return ApiRequest.createApiRequest(WEATHER_ENDPOINT, apiKey,
                new TypeToken>(){}.getType());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy