bring back language to json (EDU-882)

This commit is contained in:
Liana.Bakradze
2017-04-18 17:11:17 +03:00
parent 2b6eafadc6
commit 2fd76932ee
2 changed files with 7 additions and 7 deletions
@@ -26,7 +26,7 @@ public class Course {
@Expose @SerializedName("summary") private String description;
@Expose @SerializedName("title") private String name;
transient private String myLanguage = "Python";
@Expose @SerializedName("language") private String myLanguage = "Python";
//this field is used to distinguish ordinary and CheckIO projects,
//"PyCharm" is used here for historical reasons
@@ -25,7 +25,6 @@ import org.jetbrains.annotations.NotNull;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import java.io.IOException;
import java.lang.reflect.Modifier;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URI;
@@ -70,10 +69,10 @@ public class EduStepicClient {
}
static <T> T deserializeStepicResponse(Class<T> container, String responseString) {
Gson gson = new GsonBuilder().registerTypeAdapter(StepicWrappers.StepOptions.class, new StudySerializationUtils.Json.StepicStepOptionsAdapter()).
excludeFieldsWithModifiers(Modifier.TRANSIENT).
setDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").
setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
Gson gson =
new GsonBuilder().registerTypeAdapter(StepicWrappers.StepOptions.class, new StudySerializationUtils.Json.StepicStepOptionsAdapter()).
setDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").
setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
return gson.fromJson(responseString, container);
}
@@ -116,7 +115,8 @@ public class EduStepicClient {
CloseableHttpClient httpClient = getBuilder().setDefaultHeaders(headers).build();
try {
final StepicWrappers.AuthorWrapper wrapper = getFromStepic(EduStepicNames.CURRENT_USER, StepicWrappers.AuthorWrapper.class, httpClient);
final StepicWrappers.AuthorWrapper wrapper =
getFromStepic(EduStepicNames.CURRENT_USER, StepicWrappers.AuthorWrapper.class, httpClient);
if (wrapper != null && !wrapper.users.isEmpty()) {
StepicUser user = wrapper.users.get(0);
return user != null && !user.isGuest();