Package com.aerisweather.aeris.response
Class StormcellsSummaryResponse
- java.lang.Object
-
- com.aerisweather.aeris.response.StormcellsSummaryResponse
-
public class StormcellsSummaryResponse extends Object
Object to make the StormcellsSummary endpoint response more friendly to determine what parts of the AerisDataJSON have come back in the response.
-
-
Field Summary
Fields Modifier and Type Field Description AerisError
error
List<StormcellsSummaryDataJSON>
responses
boolean
success
-
Constructor Summary
Constructors Constructor Description StormcellsSummaryResponse()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StormcellsSummaryResponse
createObjectWithError(String code, String description)
Creates a JSON String for an StormCellsSummaryResponse with a specific Error code and description.static String
createWithError(String code, String description)
Creates a JSON String for an StormCellsSummaryResponse with a specific Error code and description.static StormcellsSummaryResponse
fromJSON(org.json.JSONObject jsonObject)
AerisError
getError()
Gets the error from the response, if there is one.StormcellsSummaryDataJSON
getFirstResponse()
Gets the first index in the list of the responses.List<StormcellsSummaryDataJSON>
getListOfResponse()
Gets the list of data responsesint
getNumberOfResponses()
Returns the number of responses for this AerisResponse.StormcellsSummaryDataJSON
getResponse(int index)
Gets the data for the given index.boolean
isSuccessful()
Gets the success of the response.boolean
isSuccessfulWithResponses()
Gets the success of the response along with checking that there was no warning, and that the list of responses is not null.void
parseResponse(org.json.JSONObject object)
-
-
-
Field Detail
-
error
public AerisError error
-
success
public boolean success
-
responses
public List<StormcellsSummaryDataJSON> responses
-
-
Method Detail
-
fromJSON
public static StormcellsSummaryResponse fromJSON(org.json.JSONObject jsonObject)
-
createWithError
public static String createWithError(String code, String description)
Creates a JSON String for an StormCellsSummaryResponse with a specific Error code and description.- Parameters:
code
- Code of the errordescription
- description of the error- Returns:
- String JSON object of an AerisResponse with the code and description
-
createObjectWithError
public static StormcellsSummaryResponse createObjectWithError(String code, String description)
Creates a JSON String for an StormCellsSummaryResponse with a specific Error code and description.- Parameters:
code
- Code of the errordescription
- description of the error- Returns:
- String JSON object of an AerisResponse with the code and description
-
parseResponse
public void parseResponse(org.json.JSONObject object) throws org.json.JSONException
- Throws:
org.json.JSONException
-
getNumberOfResponses
public int getNumberOfResponses()
Returns the number of responses for this AerisResponse.- Returns:
- Number of responses
-
getResponse
public StormcellsSummaryDataJSON getResponse(int index)
Gets the data for the given index. Pass into a AerisFriendlyResponse- Parameters:
index
- index to get the response at.- Returns:
- AerisData at that index.
-
getFirstResponse
public StormcellsSummaryDataJSON getFirstResponse()
Gets the first index in the list of the responses.- Returns:
- data for the first response.
-
getListOfResponse
public List<StormcellsSummaryDataJSON> getListOfResponse()
Gets the list of data responses- Returns:
- The list of data responses.
-
isSuccessfulWithResponses
public boolean isSuccessfulWithResponses()
Gets the success of the response along with checking that there was no warning, and that the list of responses is not null.- Returns:
- true if the response was successful with responses
-
isSuccessful
public boolean isSuccessful()
Gets the success of the response. Returns true if the response was successful or had a warning.- Returns:
- true if the response was successful.
-
getError
public AerisError getError()
Gets the error from the response, if there is one.- Returns:
- the error
-
-