aboutsummaryrefslogtreecommitdiff
path: root/src/org/happysanta/gd/API/Response.java
blob: 827fae4d157d0376aa34fa23890d493125dd0070 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package org.happysanta.gd.API;

import org.happysanta.gd.API.*;
import org.json.JSONArray;
import org.json.JSONException;

public class Response {

	JSONArray jsonArray;

	public Response(String result) throws JSONException, APIException {
		jsonArray = new JSONArray(result);
		if (!isOK()) {
			throw new APIException(jsonArray.getString(1));
		}
	}

	public boolean isOK() throws JSONException {
		return jsonArray.getString(0).equals("ok");
	}

	public JSONArray getJSON() {
		return jsonArray;
	}

}