Search in sources :

Example 1 with WebGetExchangeRatesResponse

use of run.wallet.iota.api.responses.WebGetExchangeRatesResponse in project run-wallet-android by runplay.

the class WebGetExchangeRatesRequestHandler method handle.

@Override
public ApiResponse handle(ApiRequest apiRequest) {
    JSONObject result = JSONUrlReader.readJsonObjectFromUrl(context, Constants.WWW_RUN_IOTA + "/xchange.jsp");
    if (result != null) {
        Store.updateTickers(context, result);
        JSONArray msgs = result.optJSONArray("sysmsg");
        if (msgs != null && msgs.length() > 0) {
            for (int i = 0; i < msgs.length(); i++) {
                Store.addSystemMessage(context, msgs.optJSONObject(i));
            }
        }
        return new WebGetExchangeRatesResponse(result);
    }
    return new WebGetExchangeRatesResponse(new JSONObject());
// NetworkError error = new NetworkError();
// error.setErrorType(NetworkErrorType.NETWORK_ERROR);
// return error;
}
Also used : JSONObject(run.wallet.common.json.JSONObject) JSONArray(run.wallet.common.json.JSONArray) WebGetExchangeRatesResponse(run.wallet.iota.api.responses.WebGetExchangeRatesResponse)

Aggregations

JSONArray (run.wallet.common.json.JSONArray)1 JSONObject (run.wallet.common.json.JSONObject)1 WebGetExchangeRatesResponse (run.wallet.iota.api.responses.WebGetExchangeRatesResponse)1