@Override
public Gist updateGist(String gistId, String description,
Map<String, String> contents) {
GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.GistApiUrls.UPDATE_GIST_URL);
String apiUrl = builder.withField(ParameterNames.GIST_ID, gistId).buildUrl();
Gist gist = new Gist();
gist.setDescription(description);
for (String filename : contents.keySet()) {
File file = new File();
file.setFilename(filename);
file.setContent(contents.get(filename));
gist.getFiles().put(filename, file);
}
JsonObject json = unmarshall(callApiMethod(apiUrl, marshall(gist), ApplicationConstants.CONTENT_TYPE_JSON, HttpMethod.POST, 200));
return unmarshall(new TypeToken<Gist>(){}, json);
}