# Contains functionality for generating schedules.
class SchedulesController < ApplicationController
short 'Endpoints for generating iCal files'
# Render an iCal file containing the schedules of all the
# course sections with the given CRNs.
api :GET, '/schedules', 'Generate an iCal file with events for the given CRNs'
param :crns, String, desc: 'Comma separated list of CRNs to include as events in the calendar', required: true
crns = params["crns"].split ','
@schedule = Schedule.new crns
render plain: @schedule.to_ical # render a plaintext iCal file