course_sections_controller.rb 753 Bytes
Newer Older
Zac Wood's avatar
Zac Wood committed
1
# Contains all actions having to do with CourseSections.
Zac Wood's avatar
Zac Wood committed
2
# This is a nested controller -- see +config/routes.rb+ for details
Zac Wood's avatar
Zac Wood committed
3
class CourseSectionsController < ApplicationController
Zac Wood's avatar
Zac Wood committed
4
  resource_description do
Zac Wood's avatar
Zac Wood committed
5
    short 'Working with course sections, e.g. CS 112 001'
Zac Wood's avatar
Zac Wood committed
6
  end
Zac Wood's avatar
Zac Wood committed
7

8
  api :GET, '/course_sections', 'Get a list of course sections'
Zac Wood's avatar
Zac Wood committed
9
  param :course_id, Integer, desc: "Only get the course sections belonging to the course with this ID"
Zac Wood's avatar
Zac Wood committed
10
  param :crn, String, desc: "Get the course section with this CRN"
11
  param :instructor, String, desc: "Get course sections being taught by this instructor"
Zach Perkins's avatar
Zach Perkins committed
12
  param :query, String, desc: 'A generic query ex. "CS 110"'
13

Zac Wood's avatar
Zac Wood committed
14
  def index
15
    @sections = CourseSection.fetch(params).all
Zac Wood's avatar
Zac Wood committed
16 17 18
    render json: @sections
  end
end