Search in sources :

Example 6 with DiscussionEntry

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

the class DiscussionTopicHeaderTest method convertToDiscussionEntryTest_Description.

@Test
public void convertToDiscussionEntryTest_Description() throws Exception {
    String localized_graded = "Graded discussion";
    DiscussionTopicHeader header = new DiscussionTopicHeader();
    Assignment assignment = new Assignment();
    header.setAssignment(assignment);
    DiscussionEntry entry = header.convertToDiscussionEntry(localized_graded, "points");
    assertEquals(localized_graded, entry.getDescription());
}
Also used : Assignment(com.instructure.canvasapi2.models.Assignment) DiscussionTopicHeader(com.instructure.canvasapi2.models.DiscussionTopicHeader) DiscussionEntry(com.instructure.canvasapi2.models.DiscussionEntry) Test(org.junit.Test)

Example 7 with DiscussionEntry

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

the class DiscussionTopicHeaderTest method convertToDiscussionEntryTest_ParentID.

@Test
public void convertToDiscussionEntryTest_ParentID() throws Exception {
    DiscussionTopicHeader header = new DiscussionTopicHeader();
    DiscussionEntry entry = header.convertToDiscussionEntry("grade", "points");
    assertEquals(-1, entry.getParentId());
}
Also used : DiscussionTopicHeader(com.instructure.canvasapi2.models.DiscussionTopicHeader) DiscussionEntry(com.instructure.canvasapi2.models.DiscussionEntry) Test(org.junit.Test)

Example 8 with DiscussionEntry

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

the class DiscussionTopicHeaderTest method convertToDiscussionEntryTest_NullParent.

@Test
public void convertToDiscussionEntryTest_NullParent() throws Exception {
    DiscussionTopicHeader header = new DiscussionTopicHeader();
    DiscussionEntry entry = header.convertToDiscussionEntry("grade", "points");
    assertEquals(null, entry.getParent());
}
Also used : DiscussionTopicHeader(com.instructure.canvasapi2.models.DiscussionTopicHeader) DiscussionEntry(com.instructure.canvasapi2.models.DiscussionEntry) Test(org.junit.Test)

Example 9 with DiscussionEntry

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

the class DiscussionManager method updateDiscussionEntry.

public static void updateDiscussionEntry(CanvasContext canvasContext, long topicId, long entryId, DiscussionEntryPostBody updatedEntry, StatusCallback<DiscussionEntry> callback) {
    if (isTesting() || mTesting) {
    // TODO:
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().build();
        DiscussionAPI.updateDiscussionEntry(adapter, canvasContext, topicId, entryId, updatedEntry, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 10 with DiscussionEntry

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

the class DiscussionManager method postToDiscussionTopic.

public static void postToDiscussionTopic(CanvasContext canvasContext, long topicId, String message, File attachment, String mimeType, StatusCallback<DiscussionEntry> callback) {
    if (isTesting() || mTesting) {
    // TODO:
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().build();
        DiscussionAPI.postToDiscussionTopicWithAttachment(adapter, canvasContext, topicId, message, attachment, mimeType, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Aggregations

DiscussionEntry (com.instructure.canvasapi2.models.DiscussionEntry)14 Test (org.junit.Test)14 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)6 RestParams (com.instructure.canvasapi2.builders.RestParams)6 DiscussionTopic (com.instructure.canvasapi2.models.DiscussionTopic)4 DiscussionTopicHeader (com.instructure.canvasapi2.models.DiscussionTopicHeader)4 DiscussionEntryHtmlConverter (com.instructure.pandautils.discussions.DiscussionEntryHtmlConverter)2 Assignment (com.instructure.canvasapi2.models.Assignment)1 RemoteFile (com.instructure.canvasapi2.models.RemoteFile)1 ArrayList (java.util.ArrayList)1