Search in sources :

Example 11 with QuizSubmissionResponse

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

the class QuizManager method submitQuiz.

public static void submitQuiz(CanvasContext canvasContext, QuizSubmission quizSubmission, final boolean forceNetwork, final StatusCallback<QuizSubmissionResponse> callback) {
    final RestBuilder adapter = new RestBuilder(callback);
    final RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
    QuizAPI.submitQuiz(canvasContext, quizSubmission, adapter, params, callback);
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 12 with QuizSubmissionResponse

use of com.instructure.canvasapi2.models.QuizSubmissionResponse 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)7 RestParams (com.instructure.canvasapi2.builders.RestParams)7 QuizSubmissionResponse (com.instructure.canvasapi2.models.QuizSubmissionResponse)6 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)5 QuizSubmission (com.instructure.canvasapi2.models.QuizSubmission)4 QuizSubmissionQuestionResponse (com.instructure.canvasapi2.models.QuizSubmissionQuestionResponse)4 ArrayList (java.util.ArrayList)4 StatusCallback (com.instructure.canvasapi2.StatusCallback)3 ApiType (com.instructure.canvasapi2.utils.ApiType)3 NonNull (android.support.annotation.NonNull)2 QuizSubmissionTime (com.instructure.canvasapi2.models.QuizSubmissionTime)2 Response (okhttp3.Response)2 Response (retrofit2.Response)2 Activity (android.app.Activity)1 Bundle (android.os.Bundle)1 Nullable (android.support.annotation.Nullable)1 Fragment (android.support.v4.app.Fragment)1 FragmentActivity (android.support.v4.app.FragmentActivity)1 WebView (android.webkit.WebView)1 NavigationActivity (com.instructure.candroid.activity.NavigationActivity)1