public void sync(Child child) throws IOException, JSONException { child.setSynced(true); fluentRequest .path(String.format("/children/%s", child.getUniqueId())) .context(context) .param("child", child.toString()); if (child.opt("current_photo_key") != null && !child.optString("current_photo_key").equals("")) { fluentRequest.param("current_photo_key", child.optString("current_photo_key")); } fluentRequest.put(); repository.update(child); }
public List<Child> getAllChildren() throws IOException { HttpResponse response = fluentRequest.context(context).path("/children").get(); String childrenJson = CharStreams.toString(new InputStreamReader(response.getEntity().getContent())); return convertToChildRecords(childrenJson); }