use of com.instructure.canvasapi2.models.Attachment in project instructure-android by instructure.
the class DiscussionManager method createStudentDiscussion.
public static void createStudentDiscussion(CanvasContext canvasContext, DiscussionTopicHeader newDiscussionHeader, @Nullable MultipartBody.Part attachment, StatusCallback<DiscussionTopicHeader> callback) {
if (isTesting() || mTesting) {
// TODO
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
DiscussionAPI.createStudentDiscussion(adapter, params, canvasContext, newDiscussionHeader, attachment, callback);
}
}
use of com.instructure.canvasapi2.models.Attachment in project instructure-android by instructure.
the class FileSubmitObject method toAttachment.
/**
* Used to get a basic attachment object for display.
* @return A skin & bones attachment object
*/
@NonNull
public Attachment toAttachment() {
Attachment attachment = new Attachment();
attachment.setContentType(contentType);
attachment.setDisplayName(name);
attachment.setThumbnailUrl(fullPath);
return attachment;
}
use of com.instructure.canvasapi2.models.Attachment in project instructure-android by instructure.
the class DiscussionAttachmentTest method shouldShowToUser_hidden.
@Test
public void shouldShowToUser_hidden() {
DiscussionAttachment attachment = new DiscussionAttachment();
attachment.setHidden(true);
assertEquals(false, attachment.shouldShowToUser());
}
use of com.instructure.canvasapi2.models.Attachment in project instructure-android by instructure.
the class DiscussionAttachmentTest method shouldShowToUser_locked_noUnlockDate.
@Test
public void shouldShowToUser_locked_noUnlockDate() {
DiscussionAttachment attachment = new DiscussionAttachment();
attachment.setLocked(true);
attachment.setUnlockAt(null);
assertEquals(false, attachment.shouldShowToUser());
}
use of com.instructure.canvasapi2.models.Attachment in project instructure-android by instructure.
the class DiscussionAttachmentTest method shouldShowToUser_locked_unlockDateNotPassed.
@Test
public void shouldShowToUser_locked_unlockDateNotPassed() {
Date lockDate = new Date(System.currentTimeMillis() + MILLIS_PER_DAY);
DiscussionAttachment attachment = new DiscussionAttachment();
attachment.setUnlockAt(APIHelper.dateToString(lockDate));
attachment.setLocked(true);
assertEquals(false, attachment.shouldShowToUser());
}
Aggregations