public Exercise getExercise(int id) throws IOException, JSONException { JSONObject json = restclient.getJson(String.format("getExercise?id=%d", id)); Exercise exercise = new Exercise(); exercise.setWording(json.getString("wording")); exercise.setId(json.getInt("id")); return exercise; }
public Status getStatus(String dni) throws IOException, JSONException { JSONObject json = restclient.getJson(String.format("getStatus?dni=%s", dni)); Status user = new Status( json.getInt("id"), json.getString("user"), json.getInt("lessonNumber"), json.getString("lessonTitle"), json.getInt("nextTest"), json.getInt("nextExercise")); return user; }
public Data(String user, String passwd) { restclient = new RestClient(urlBase); restclient.setHttpBasicAuth(user, passwd); }