Search in sources :

Example 21 with QuizSubmission

use of com.instructure.canvasapi2.models.QuizSubmission in project instructure-android by instructure.

the class QuizManager_Test method getAllQuizSubmissions.

public static void getAllQuizSubmissions(StatusCallback<List<QuizSubmission>> callback) {
    Response response = new Response.Builder().code(200).message("todo").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "todo".getBytes())).addHeader("content-type", "application/json").build();
    List<QuizSubmission> quizSubmissions = new ArrayList<>();
    QuizSubmission quizSubmission = new QuizSubmission();
    quizSubmission.setQuizId(456321L);
    quizSubmissions.add(quizSubmission);
    retrofit2.Response<List<QuizSubmission>> response1 = retrofit2.Response.success(quizSubmissions, response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Also used : QuizSubmissionResponse(com.instructure.canvasapi2.models.QuizSubmissionResponse) Response(okhttp3.Response) QuizSubmissionQuestionResponse(com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse) QuizSubmission(com.instructure.canvasapi2.models.QuizSubmission) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 22 with QuizSubmission

use of com.instructure.canvasapi2.models.QuizSubmission in project instructure-android by instructure.

the class QuizManager_Test method startQuizPreview.

public static void startQuizPreview(long courseId, long quizId, StatusCallback<QuizSubmissionResponse> callback) {
    // TODO:
    Response response = new Response.Builder().code(200).message("todo").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "todo".getBytes())).addHeader("content-type", "application/json").build();
    QuizSubmissionResponse quizSubmissionResponse = new QuizSubmissionResponse();
    QuizSubmission quizSubmission = new QuizSubmission();
    quizSubmission.setId(8);
    List<QuizSubmission> quizSubmissions = new ArrayList<>();
    quizSubmissions.add(quizSubmission);
    quizSubmissionResponse.setQuizSubmissions(quizSubmissions);
    retrofit2.Response<QuizSubmissionResponse> response1 = retrofit2.Response.success(quizSubmissionResponse, response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Also used : QuizSubmissionResponse(com.instructure.canvasapi2.models.QuizSubmissionResponse) Response(okhttp3.Response) QuizSubmissionQuestionResponse(com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse) QuizSubmission(com.instructure.canvasapi2.models.QuizSubmission) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) ArrayList(java.util.ArrayList) QuizSubmissionResponse(com.instructure.canvasapi2.models.QuizSubmissionResponse)

Aggregations

RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)11 RestParams (com.instructure.canvasapi2.builders.RestParams)11 QuizSubmissionResponse (com.instructure.canvasapi2.models.QuizSubmissionResponse)9 StatusCallback (com.instructure.canvasapi2.StatusCallback)8 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)8 QuizSubmissionQuestionResponse (com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse)7 QuizSubmission (com.instructure.canvasapi2.models.QuizSubmission)5 ApiType (com.instructure.canvasapi2.utils.ApiType)5 ArrayList (java.util.ArrayList)5 NonNull (android.support.annotation.NonNull)4 Response (retrofit2.Response)4 QuizSubmissionQuestion (com.instructure.canvasapi2.models.QuizSubmissionQuestion)3 Response (okhttp3.Response)3 LinkedTreeMap (com.google.gson.internal.LinkedTreeMap)2 QuizSubmissionTime (com.instructure.canvasapi2.models.QuizSubmissionTime)2 List (java.util.List)2 Activity (android.app.Activity)1 Bundle (android.os.Bundle)1 Nullable (android.support.annotation.Nullable)1 Fragment (android.support.v4.app.Fragment)1