Search in sources :

Example 1 with WebGetExchangeRatesHistoryResponse

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

the class WebGetExchangeRatesHistoryRequestHandler method handle.

@Override
public ApiResponse handle(ApiRequest apiRequest) {
    WebGetExchangeRatesHistoryRequest req = (WebGetExchangeRatesHistoryRequest) apiRequest;
    // Currency curr=Store.getDefaultCurrency(context);
    // Log.e("XCHANGE",Constants.WWW_RUN_IOTA+"/xchangehist.jsp?step="+req.step+"&cp="+req.cp);
    JSONObject result = JSONUrlReader.readJsonObjectFromUrl(context, Constants.WWW_RUN_IOTA + "/xchangehist.jsp?step=" + req.step + "&cp=" + req.cp);
    if (result != null) {
        // Log.e("GOT-HIST",result.toString());
        Store.updateTickerHist(context, result);
        return new WebGetExchangeRatesHistoryResponse(result);
    }
    NetworkError error = new NetworkError();
    error.setErrorType(NetworkErrorType.NETWORK_ERROR);
    return error;
}
Also used : WebGetExchangeRatesHistoryRequest(run.wallet.iota.api.requests.WebGetExchangeRatesHistoryRequest) JSONObject(run.wallet.common.json.JSONObject) WebGetExchangeRatesHistoryResponse(run.wallet.iota.api.responses.WebGetExchangeRatesHistoryResponse) NetworkError(run.wallet.iota.api.responses.error.NetworkError)

Aggregations

JSONObject (run.wallet.common.json.JSONObject)1 WebGetExchangeRatesHistoryRequest (run.wallet.iota.api.requests.WebGetExchangeRatesHistoryRequest)1 WebGetExchangeRatesHistoryResponse (run.wallet.iota.api.responses.WebGetExchangeRatesHistoryResponse)1 NetworkError (run.wallet.iota.api.responses.error.NetworkError)1