Class AerisAbstractTask
- java.lang.Object
-
- android.os.AsyncTask<Void,Void,T>
-
- com.aerisweather.aeris.communication.CommunicationTask<AerisResponse>
-
- com.aerisweather.aeris.communication.AerisCommunicationTask
-
- com.aerisweather.aeris.communication.loaders.AerisAbstractTask
-
- Direct Known Subclasses:
AdvisoriesTask
,AirQualityTask
,AlertsTask
,ConditionsTask
,CountriesTask
,EarthquakesTask
,FiresTask
,ForecastsTask
,LightningTask
,MoonphasesTask
,NormalsStationsTask
,NormalsTask
,ObservationsArchiveTask
,ObservationsSummaryTask
,ObservationsTask
,PlacesAirportsTask
,PlacesPostalcodesTask
,PlacesTask
,RecordsTask
,RiversGaugesTask
,RiversTask
,StormCellsTask
,StormReportsTask
,SunmoonTask
,TidesStationsTask
,TidesTask
,TropicalCyclonesTask
public abstract class AerisAbstractTask extends AerisCommunicationTask
Abstract class that all specific endpoint tasks will use so that they can return the object in a friendly model versus have to know what response is being returned to you as by using the AerisCommunicationTask.
-
-
Field Summary
-
Fields inherited from class com.aerisweather.aeris.communication.AerisCommunicationTask
callback
-
Fields inherited from class com.aerisweather.aeris.communication.CommunicationTask
context, progressListener, request
-
-
Constructor Summary
Constructors Constructor Description AerisAbstractTask(android.content.Context context)
Constructs the abstract with the context .
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
callback(List<AerisDataJSON> responses)
Passed callback to the proper concrete class's callback.abstract EndpointType
getType()
Get the type of the Endpointabstract void
onFail(AerisError error)
Passes error callback to the proper concrete class's fail callback.protected void
onPostExecute(AerisResponse result)
void
requestClosest(PlaceParameter place)
Request to the API at the closest location to the place parametervoid
requestClosest(PlaceParameter place, Parameter... params)
Request to the API at the closest location to the place parameter with additional parametersvoid
requestClosestWithCurrentLoc()
Request a observation at the closest location using the phones gps.void
requestClosestWithCurrentLoc(Parameter... params)
Request to the API at the closest location using the phones gps.void
requestSearch(Parameter... params)
void
requestWithinBounds(double nLatitude, double wLongitude, double sLatitude, double eLongitude)
Request to the API within the bounds of a northwest and southeast point.void
requestWithinBounds(double nLatitude, double wLongitude, double sLatitude, double eLongitude, Parameter... params)
Request to the API within the bounds of a northwest and southeast point with additional parametersvoid
requestWithinPolygon(List<AerisLocation> locs)
/** Request to the API within the polygon of locations.void
requestWithinPolygon(List<AerisLocation> locs, Parameter... params)
Request to the API within the polygon of locations with additional parametersvoid
withDebug(boolean enabled)
Adds the debug output for the request.-
Methods inherited from class com.aerisweather.aeris.communication.AerisCommunicationTask
doInBackground
-
Methods inherited from class com.aerisweather.aeris.communication.CommunicationTask
executeSyncTask, isOnline, onCancelled, onPreExecute, unknownBatchError, unknownError, withProgress
-
-
-
-
Method Detail
-
requestClosestWithCurrentLoc
public void requestClosestWithCurrentLoc()
Request a observation at the closest location using the phones gps.
-
requestClosestWithCurrentLoc
public void requestClosestWithCurrentLoc(Parameter... params)
Request to the API at the closest location using the phones gps.- Parameters:
params
- optional
-
requestClosest
public void requestClosest(PlaceParameter place)
Request to the API at the closest location to the place parameter- Parameters:
place
- place parameter to use
-
requestClosest
public void requestClosest(PlaceParameter place, Parameter... params)
Request to the API at the closest location to the place parameter with additional parameters- Parameters:
place
- place parameter to useparams
- additional parameters to use in the request
-
requestWithinPolygon
public void requestWithinPolygon(List<AerisLocation> locs)
/** Request to the API within the polygon of locations.- Parameters:
locs
- list of AerisLocations to use as a polygon.
-
requestWithinPolygon
public void requestWithinPolygon(List<AerisLocation> locs, Parameter... params)
Request to the API within the polygon of locations with additional parameters- Parameters:
locs
- list of AerisLocations to use as a polygon.params
- additional parameters to use in the request
-
requestWithinBounds
public void requestWithinBounds(double nLatitude, double wLongitude, double sLatitude, double eLongitude)
Request to the API within the bounds of a northwest and southeast point.- Parameters:
nLatitude
- Northern latitude pointwLongitude
- western longitude pointsLatitude
- southern latitude pointeLongitude
- eastern longitude point
-
requestWithinBounds
public void requestWithinBounds(double nLatitude, double wLongitude, double sLatitude, double eLongitude, Parameter... params)
Request to the API within the bounds of a northwest and southeast point with additional parameters- Parameters:
nLatitude
- doublewLongitude
- doublesLatitude
- doubleeLongitude
- doubleparams
- optional
-
withDebug
public void withDebug(boolean enabled)
Adds the debug output for the request.- Parameters:
enabled
- whether the debug output to logcat should be on for this task.
-
requestSearch
public void requestSearch(Parameter... params)
- Parameters:
params
- optional
-
onPostExecute
protected void onPostExecute(AerisResponse result)
- Overrides:
onPostExecute
in classAerisCommunicationTask
-
getType
public abstract EndpointType getType()
Get the type of the Endpoint- Returns:
- endpoint type
-
callback
public abstract void callback(List<AerisDataJSON> responses)
Passed callback to the proper concrete class's callback.- Parameters:
responses
- List of data responses the concrete class should handle passing to its callback
-
onFail
public abstract void onFail(AerisError error)
Passes error callback to the proper concrete class's fail callback.- Parameters:
error
- error to pass back
-
-