use of com.instructure.canvasapi2.models.Submission in project instructure-android by instructure.
the class SubmissionManager_Test method getStudentSubmissionsForCourse.
public static void getStudentSubmissionsForCourse(long studentId, long courseId, StatusCallback<List<Submission>> callback) {
// TODO:
Response response = new Response.Builder().request(new Request.Builder().url("https://test.com").build()).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<Submission> submissions = new ArrayList<>();
retrofit2.Response<List<Submission>> response1 = retrofit2.Response.success(submissions, response);
callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
use of com.instructure.canvasapi2.models.Submission in project instructure-android by instructure.
the class AssignmentTest method isWithoutGradedSubmission_TestTrueNotNull.
@Test
public void isWithoutGradedSubmission_TestTrueNotNull() {
Assignment assignment = new Assignment();
Submission submission = new Submission();
submission.setWorkflowState("submitted");
submission.setGrade(null);
submission.setSubmissionType(null);
assignment.setSubmission(submission);
assertEquals(true, assignment.isWithoutGradedSubmission());
}
use of com.instructure.canvasapi2.models.Submission in project instructure-android by instructure.
the class AssignmentTest method isWithoutGradedSubmission_TestFalse.
@Test
public void isWithoutGradedSubmission_TestFalse() {
Assignment assignment = new Assignment();
Submission submission = new Submission();
submission.setWorkflowState("submitted");
submission.setGrade("A");
submission.setSubmissionType("Online_Quiz");
assignment.setSubmission(submission);
assertEquals(false, assignment.isWithoutGradedSubmission());
}
use of com.instructure.canvasapi2.models.Submission in project instructure-android by instructure.
the class SubmissionManager method postTextSubmission.
public static void postTextSubmission(CanvasContext canvasContext, long assignmentId, String text, StatusCallback<Submission> callback) {
if (isTesting() || mTesting) {
// TODO
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withCanvasContext(canvasContext).build();
SubmissionAPI.postTextSubmission(canvasContext.getId(), assignmentId, text, adapter, params, callback);
}
}
use of com.instructure.canvasapi2.models.Submission in project instructure-android by instructure.
the class SubmissionManager method postUrlSubmission.
public static void postUrlSubmission(CanvasContext canvasContext, long assignmentId, String url, boolean isLti, StatusCallback<Submission> callback) {
if (isTesting() || mTesting) {
// TODO
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withCanvasContext(canvasContext).build();
String type = isLti ? "basic_lti_launch" : "online_url";
SubmissionAPI.postUrlSubmission(canvasContext.getId(), assignmentId, type, url, adapter, params, callback);
}
}
Aggregations