Skip to content

Commit

Permalink
start f cleanup of keys
Browse files Browse the repository at this point in the history
  • Loading branch information
synapticloop committed Dec 9, 2016
1 parent f064d67 commit 64a4cf3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
Expand Up @@ -36,11 +36,8 @@ public AccountEstimateInvoiceResponse(JSONObject jsonObject) throws ApiException

if(!hasErrors()) {
JSONObject dataObject = jsonObject.getJSONObject(JSON_KEY_DATA);
this.invoiceTo = ResponseHelper.convertDate(dataObject.getString(JSON_KEY_INVOICE_TO));
dataObject.remove(JSON_KEY_INVOICE_TO);

this.amount = dataObject.getDouble(JSON_KEY_AMOUNT);
dataObject.remove(JSON_KEY_AMOUNT);
this.invoiceTo = readDate(dataObject, JSON_KEY_INVOICE_TO);
this.amount = readDouble(dataObject, JSON_KEY_AMOUNT);

ResponseHelper.warnOnMissedKeys(LOGGER, dataObject);
}
Expand Down
Expand Up @@ -54,20 +54,14 @@ public AccountInfoResponse(JSONObject jsonObject) throws ApiException {

if(!hasErrors()) {
JSONObject dataObject = jsonObject.getJSONObject(JSON_KEY_DATA);
this.activeSince = ResponseHelper.convertDate(dataObject.getString("ACTIVE_SINCE"));
dataObject.remove("ACTIVE_SINCE");
this.transferPool = dataObject.getLong("TRANSFER_POOL");
dataObject.remove("TRANSFER_POOL");
this.transferUsed = dataObject.getLong("TRANSFER_USED");
dataObject.remove("TRANSFER_USED");
this.transferBillable = dataObject.getLong("TRANSFER_BILLABLE");
dataObject.remove("TRANSFER_BILLABLE");
this.isManaged = dataObject.getBoolean("MANAGED");
dataObject.remove("MANAGED");
this.billingMethod = dataObject.getString("BILLING_METHOD");
dataObject.remove("BILLING_METHOD");
this.balance = dataObject.getLong("BALANCE");
dataObject.remove("BALANCE");

this.activeSince = readDate(dataObject, JSON_KEY_ACTIVE_SINCE);
this.transferPool = readLong(dataObject, JSON_KEY_TRANSFER_POOL);
this.transferUsed = readLong(dataObject, JSON_KEY_TRANSFER_USED);
this.transferBillable = readLong(dataObject, JSON_KEY_TRANSFER_BILLABLE);
this.isManaged = readBoolean(dataObject, JSON_KEY_MANAGED);
this.billingMethod = readString(dataObject, JSON_KEY_BILLING_METHOD);
this.balance = readLong(dataObject, JSON_KEY_BALANCE);

ResponseHelper.warnOnMissedKeys(LOGGER, dataObject);
}
Expand Down
Expand Up @@ -78,8 +78,8 @@ public ApiSpecResponse(JSONObject jsonObject) {
jsonObject.remove(JSON_KEY_DATA);

ResponseHelper.warnOnMissedKeys(LOGGER, jsonObject);

}

public List<Method> getMethods() {
return this.methods;
}
Expand Down
Expand Up @@ -37,6 +37,14 @@ public abstract class BaseResponse extends BaseJsonReader {
protected static final String JSON_KEY_METHODS = "METHODS";
protected static final String JSON_KEY_INVOICE_TO = "INVOICE_TO";
protected static final String JSON_KEY_AMOUNT = "AMOUNT";
protected static final String JSON_KEY_BALANCE = "BALANCE";
protected static final String JSON_KEY_BILLING_METHOD = "BILLING_METHOD";
protected static final String JSON_KEY_MANAGED = "MANAGED";
protected static final String JSON_KEY_TRANSFER_BILLABLE = "TRANSFER_BILLABLE";
protected static final String JSON_KEY_TRANSFER_USED = "TRANSFER_USED";
protected static final String JSON_KEY_TRANSFER_POOL = "TRANSFER_POOL";
protected static final String JSON_KEY_ACTIVE_SINCE = "ACTIVE_SINCE";


private final JSONObject jsonObject;

Expand Down

0 comments on commit 64a4cf3

Please sign in to comment.