Search in sources :

Example 46 with Submission

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

the class SubmissionManager method postSubmissionAttachmentsSynchronous.

@Nullable
public static Submission postSubmissionAttachmentsSynchronous(long courseId, long assignmentId, List<Long> attachmentsIds) {
    if (isTesting() || mTesting) {
    // TODO
    } else {
        RestBuilder adapter = new RestBuilder();
        RestParams params = new RestParams.Builder().build();
        return SubmissionAPI.postSubmissionAttachmentsSynchronous(courseId, assignmentId, attachmentsIds, adapter, params);
    }
    return null;
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) Nullable(android.support.annotation.Nullable)

Example 47 with Submission

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

the class SubmissionManager method postSubmissionGrade.

public static void postSubmissionGrade(long courseId, long assignmentId, long userId, String score, boolean isExcused, boolean forceNetwork, @NonNull StatusCallback<Submission> callback) {
    if (isTesting() | mTesting) {
    // SubmissionManager_Test.postSubmissionGrade(courseId, assignmentId, userId, score, callback);
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
        SubmissionAPI.postSubmissionGrade(courseId, assignmentId, userId, score, isExcused, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 48 with Submission

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

the class AssignmentManager_Test method getAllSubmissionsForAssignment.

public static void getAllSubmissionsForAssignment(long courseId, long assignmentId, StatusCallback<List<Submission>> callback) {
    // TODO:
    Response httpResponse = 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>> response = retrofit2.Response.success(submissions, httpResponse);
    callback.onResponse(response, new LinkHeaders(), ApiType.CACHE);
}
Also used : Response(okhttp3.Response) Submission(com.instructure.canvasapi2.models.Submission) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) Request(okhttp3.Request) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

Submission (com.instructure.canvasapi2.models.Submission)33 Assignment (com.instructure.canvasapi2.models.Assignment)20 Test (org.junit.Test)17 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)14 RestParams (com.instructure.canvasapi2.builders.RestParams)13 ArrayList (java.util.ArrayList)8 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)7 Date (java.util.Date)7 List (java.util.List)5 Request (okhttp3.Request)4 Response (okhttp3.Response)4 NonNull (android.support.annotation.NonNull)3 View (android.view.View)3 StatusCallback (com.instructure.canvasapi2.StatusCallback)3 GradeableStudentSubmission (com.instructure.canvasapi2.models.GradeableStudentSubmission)3 ApiType (com.instructure.canvasapi2.utils.ApiType)3 Navigation (com.instructure.interactions.Navigation)3 Response (retrofit2.Response)3 Intent (android.content.Intent)2 Paint (android.graphics.Paint)2