use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class CalendarEventManager method getCalendarEvent.
public static void getCalendarEvent(long eventId, StatusCallback<ScheduleItem> callback, boolean forceNetwork) {
if (isTesting() || mTesting) {
// TODO
} else {
final RestBuilder adapter = new RestBuilder(callback);
final RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).build();
CalendarEventAPI.getCalendarEvent(eventId, adapter, params, callback);
}
}
use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class CalendarEventManager method getUpcomingEventsSynchronous.
@NonNull
public static List<ScheduleItem> getUpcomingEventsSynchronous(boolean forceNetwork) throws IOException {
if (isTesting() || mTesting) {
// TODO
return new ArrayList();
} else {
final RestBuilder adapter = new RestBuilder();
final RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).build();
Response<List<ScheduleItem>> response = CalendarEventAPI.getUpcomingEventsSynchronous(adapter, params);
return (response != null && response.isSuccessful() && response.body() != null) ? response.body() : new ArrayList();
}
}
use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class CalendarEventManager method deleteCalendarEvent.
public static void deleteCalendarEvent(long eventId, String cancelReason, StatusCallback<ScheduleItem> callback) {
if (isTesting() || mTesting) {
// TODO
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().build();
CalendarEventAPI.deleteCalendarEvent(eventId, cancelReason, adapter, params, callback);
}
}
use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class CalendarEventManager method getAllCalendarEventsWithSubmissionsAirwolf.
public static void getAllCalendarEventsWithSubmissionsAirwolf(String airwolfDomain, String parentId, String studentId, String startDate, String endDate, ArrayList<String> canvasContexts, boolean forceNetwork, StatusCallback<List<ScheduleItem>> callback) {
if (isTesting() || mTesting) {
// TODO:
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withDomain(airwolfDomain).withAPIVersion("").withForceReadFromNetwork(forceNetwork).build();
CalendarEventAPI.getAllCalendarEventsWithSubmissionAirwolf(parentId, studentId, startDate, endDate, canvasContexts, adapter, callback, params);
}
}
use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class ScheduleItemTest method getIdTest_AssignmentOverrides.
@Test
public void getIdTest_AssignmentOverrides() throws Exception {
// can't set a schedule item's id to be a string by any exposed method, so use JSON parsing
// to test it
String scheduleItemJSON = "{\n\"all_day\": true,\n\"all_day_date\": \"2012-10-17\",\n\"created_at\": \"2012-10-06T01:09:52Z\",\n\"end_at\": \"2012-10-17T06:00:00Z\",\n\"id\": \"assignment_673956\",\n\"location_address\": null,\n\"location_name\": null,\n\"start_at\": \"2012-10-17T06:00:00Z\",\n\"title\": \"No Class\",\n\"updated_at\": \"2012-10-06T01:09:52Z\",\n\"workflow_state\": \"active\",\n\"description\": null,\n\"context_code\": \"course_833052\",\n\"child_events_count\": 0,\n\"parent_event_id\": null,\n\"hidden\": false,\n\"child_events\": [],\n\"url\": \"https://mobiledev.instructure.com/api/v1/calendar_events/673956\",\n\"html_url\": \"https://mobiledev.instructure.com/calendar?event_id=673956&include_contexts=course_833052#7b2273686f77223a2267726f75705f636f757273655f383333303532227d\"\n}";
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
ScheduleItem scheduleItem = gson.fromJson(scheduleItemJSON, ScheduleItem.class);
AssignmentOverride assignmentOverride = new AssignmentOverride();
assignmentOverride.setId(1234567);
ArrayList<AssignmentOverride> assignmentOverrides = new ArrayList<>();
assignmentOverrides.add(assignmentOverride);
scheduleItem.setAssignmentOverrides(assignmentOverrides);
assertEquals(1234567, scheduleItem.getId());
}
Aggregations