class Academical::Api::Sections
Represents the section of a course in a school
Public Class Methods
# File lib/academical/api/sections.rb, line 8 def initialize(client) @client = client end
Public Instance Methods
Creates a new section object in Academical
. All required parameters must be provided.
‘/sections/’ POST
course_name - Name of the course course_code - The code of the course which this section belongs to section_number - Section number of the course. This is X of Y sections for course K section_id - Unique identifier for the section term - The term object this section will be taking place in seats - Object describing the number of available, taken and total seats for the section school_id - ID of the school this section belongs to events - A list of events this section takes place on departments - List of departments this section belongs to. credits - Number of credits this course is worth
# File lib/academical/api/sections.rb, line 48 def create(course_name, course_code, section_number, section_id, term, seats, school_id, events, departments, credits, options = {}) body = options.fetch(:body, {}) body[:course_name] = course_name body[:course_code] = course_code body[:section_number] = section_number body[:section_id] = section_id body[:term] = term body[:seats] = seats body[:school_id] = school_id body[:events] = events body[:departments] = departments body[:credits] = credits @client.post("/sections/", body, options) end
Delete a section given its ID
‘/sections/:id’ DELETE
id - ID of the section
# File lib/academical/api/sections.rb, line 28 def delete(id, options = {}) body = options.fetch(:body, {}) @client.delete("/sections/#{id}", body, options) end
Returns a section object given its ID
‘/sections/:id’ GET
id - ID of the section
# File lib/academical/api/sections.rb, line 17 def get(id, options = {}) body = options.fetch(:query, {}) @client.get("/sections/#{id}", body, options) end
List of all the schedules with a given section
‘/sections/:id/schedules’ GET
id - ID of the section
# File lib/academical/api/sections.rb, line 111 def schedules(id, options = {}) body = options.fetch(:query, {}) @client.get("/sections/#{id}/schedules", body, options) end
Returns the list of teachers given a section ID
‘/sections/:id/teachers’ GET
id - ID of the section
# File lib/academical/api/sections.rb, line 100 def teachers(id, options = {}) body = options.fetch(:query, {}) @client.get("/sections/#{id}/teachers", body, options) end
Update the attributes of a section given its ID as a part of the body of the request
‘/sections/:id’ PUT
id - ID of the section course_name - Name of the course course_code - The code of the course which this section belongs to section_number - Section number of the course. This is X of Y sections for course K section_id - Unique identifier for the section term - The term object this section will be taking place in seats - Object describing the number of available, taken and total seats for the section school_id - ID of the school this section belongs to events - A list of events this section takes place on departments - List of departments this section belongs to. credits - Number of credits this course is worth
# File lib/academical/api/sections.rb, line 79 def update(id, course_name, course_code, section_number, section_id, term, seats, school_id, events, departments, credits, options = {}) body = options.fetch(:body, {}) body[:course_name] = course_name body[:course_code] = course_code body[:section_number] = section_number body[:section_id] = section_id body[:term] = term body[:seats] = seats body[:school_id] = school_id body[:events] = events body[:departments] = departments body[:credits] = credits @client.put("/sections/#{id}", body, options) end