public class ForecastIO extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
LANG_BOSNIAN |
static String |
LANG_DUTCH |
static String |
LANG_ENGLISH |
static String |
LANG_FRENCH |
static String |
LANG_GERMAN |
static String |
LANG_ITALIAN |
static String |
LANG_POLISH |
static String |
LANG_PORTUGUESE |
static String |
LANG_SPANISH |
static String |
LANG_TETUM |
static String |
LANG_X_PG_LATIN |
static String |
UNITS_AUTO |
static String |
UNITS_CA |
static String |
UNITS_SI |
static String |
UNITS_UK |
static String |
UNITS_US |
| Constructor and Description |
|---|
ForecastIO(String API_KEY) |
ForecastIO(String LATITUDE,
String LONGITUDE,
String API_KEY) |
ForecastIO(String LATITUDE,
String LONGITUDE,
String UNITS,
String LANG,
String API_KEY) |
| Modifier and Type | Method and Description |
|---|---|
com.eclipsesource.json.JsonArray |
getAlerts()
Returns the alerts data
|
com.eclipsesource.json.JsonObject |
getCurrently()
Returns the currently data point
|
com.eclipsesource.json.JsonObject |
getDaily()
Returns the daily data block
|
String |
getExcludeURL()
Returns the excluded fields that are setted for the request.
|
com.eclipsesource.json.JsonObject |
getFlags()
Returns the flags data
|
boolean |
getForecast(com.eclipsesource.json.JsonObject forecast)
Parses the forecast reports for the given coordinates with the setted options
Useful to use with an external http library
Hint: The getForecast(String http_response) could be more useful since it receives
the raw response String instead of the JsonObect.
|
boolean |
getForecast(String http_response)
Parses the forecast reports for the given coordinates with the set options
Useful to use with an external http library
|
boolean |
getForecast(String LATITUDE,
String LONGITUDE)
Gets the forecast reports for the given coordinates with the set options
|
String |
getHeaderCache_Control()
Returns the Cache-Control response header value
|
String |
getHeaderExpires()
Returns the Expires response header value
|
String |
getHeaderX_Forecast_API_Calls()
Returns the X-Forecast-API-Calls response header value
This is the number os API calls made today from one given API Key. |
String |
getHeaderX_Response_Time()
Returns the X-Response-Time response header value
|
com.eclipsesource.json.JsonObject |
getHourly()
Returns the hourly data block
|
String |
getLang()
Returns the language that are set in the request.
|
Double |
getLatitude()
Returns the latitude that is setted for the request.
|
Double |
getLongitude()
Returns the longitude that is setted for the request.
|
com.eclipsesource.json.JsonObject |
getMinutely()
Returns the minutely data block
|
String |
getRawResponse()
Returns the raw JSON response
|
String |
getTime()
Returns the time that is setted for the request.
|
String |
getTimezone()
Returns the timezone that is setted.
|
String |
getUnits()
Returns the units that are set in the request.
|
String |
getUrl(String LATITUDE,
String LONGITUDE)
Returns the url that is created by internal UrlBuilder method.
|
boolean |
hasAlerts()
Checks if there is any flags data available
|
boolean |
hasCurrently()
Checks if there is any currently data available
|
boolean |
hasDaily()
Checks if there is any daily data available
|
boolean |
hasFlags()
Checks if there is any flags data available
|
boolean |
hasHourly()
Checks if there is any hourly data available
|
boolean |
hasMinutely()
Checks if there is any minutely data available
|
boolean |
isExtend()
Returns if the hourly report should be extended in the request.
|
String |
offset()
Returns the offset as a String with '+' or '-' sign.
|
int |
offsetValue()
Returns the timezone offset in an integer
For more information refer to the API Docs:
https://developer.forecast.io
|
void |
setExcludeURL(String excludeURL)
Sets the fields to be excluded in the request.
Format should be as follows: [field1,field2,fieldN] with no spaces For more information refer to the API Docs: https://developer.forecast.io |
void |
setExtend(boolean extend)
Sets if the hourly report should be extended in the request.
|
void |
setLang(String lang)
Sets the language to be passed in the request.
|
void |
setTime(String time)
Sets the time for the request.
|
void |
setUnits(String units)
Sets the units to be passed in the request.
|
boolean |
update()
Does another query to the API and updates the data
This only updates the data in ForecastIO class
|
public static final String UNITS_US
public static final String UNITS_SI
public static final String UNITS_CA
public static final String UNITS_UK
public static final String UNITS_AUTO
public static final String LANG_BOSNIAN
public static final String LANG_GERMAN
public static final String LANG_ENGLISH
public static final String LANG_SPANISH
public static final String LANG_FRENCH
public static final String LANG_ITALIAN
public static final String LANG_DUTCH
public static final String LANG_POLISH
public static final String LANG_PORTUGUESE
public static final String LANG_TETUM
public static final String LANG_X_PG_LATIN
public ForecastIO(String API_KEY)
public Double getLatitude()
public Double getLongitude()
public String getTimezone()
public String getTime()
public void setTime(String time)
time - in the described formatpublic String getExcludeURL()
public void setExcludeURL(String excludeURL)
excludeURL - in the described formatpublic boolean isExtend()
public void setExtend(boolean extend)
extend - true or false to extend or not the requestpublic int offsetValue()
public String offset()
public String getUnits()
public void setUnits(String units)
units - the units to be set. Units can set with a constant like ForecastIO.UNITS_SI.
(If the units are invalid the API will return an error)public String getLang()
public void setLang(String lang)
lang - the language to set. this can be set with the constant ForecastIO.LANG_ENGLISH (example for english).
If a constant is not available for a given an available API language it can be set with the language code.
(If the language is invalid the API will return an error)public com.eclipsesource.json.JsonObject getCurrently()
public com.eclipsesource.json.JsonObject getMinutely()
public com.eclipsesource.json.JsonObject getHourly()
public com.eclipsesource.json.JsonObject getFlags()
public com.eclipsesource.json.JsonArray getAlerts()
public com.eclipsesource.json.JsonObject getDaily()
public boolean hasCurrently()
public boolean hasMinutely()
public boolean hasHourly()
public boolean hasDaily()
public boolean hasFlags()
public boolean hasAlerts()
public boolean update()
public boolean getForecast(String LATITUDE, String LONGITUDE)
LATITUDE - the geographical latitudeLONGITUDE - the geographical longitudepublic boolean getForecast(String http_response)
http_response - Stringpublic boolean getForecast(com.eclipsesource.json.JsonObject forecast)
forecast - JsonObjectpublic String getUrl(String LATITUDE, String LONGITUDE)
LATITUDE - the geographical latitudeLONGITUDE - the geographical longitudepublic String getHeaderCache_Control()
public String getHeaderExpires()
public String getHeaderX_Forecast_API_Calls()
public String getHeaderX_Response_Time()
public String getRawResponse()
Copyright © 2014. All rights reserved.