class Academical::Api::Schools

All schools that are using Academical

Public Class Methods

new(client) click to toggle source
# File lib/academical/api/schools.rb, line 8
def initialize(client)
  @client = client
end

Public Instance Methods

create(name, nickname, locale, timezone, departments, identity_providers, app_ui, terms, options = {}) click to toggle source

Creates a new school object in Academical. All required parameters must be provided

‘/schools/’ POST

name - Name of the school nickname - Nickname of the school locale - Locale of the school timezone - Timezone of the school departments - A list of Department objects. Each department should specify a name and faculty_name identity_providers - A list of Identify Providers to use with this school app_ui - Object describing UI specific parameters for our planner app terms - A list containing Term objects. Each term should define a name, a start date and end date.

# File lib/academical/api/schools.rb, line 90
def create(name, nickname, locale, timezone, departments, identity_providers, app_ui, terms, options = {})
  body = options.fetch(:body, {})
  body[:name] = name
  body[:nickname] = nickname
  body[:locale] = locale
  body[:timezone] = timezone
  body[:departments] = departments
  body[:identity_providers] = identity_providers
  body[:app_ui] = app_ui
  body[:terms] = terms

  @client.post("/schools/", body, options)
end
delete(id, options = {}) click to toggle source

Delete a school from the API given its ID

‘/schools/:id’ DELETE

id - ID of the school

# File lib/academical/api/schools.rb, line 28
def delete(id, options = {})
  body = options.fetch(:body, {})

  @client.delete("/schools/#{id}", body, options)
end
get(id, options = {}) click to toggle source

Returns a school object given its ID

‘/schools/:id’ GET

id - ID of the school

# File lib/academical/api/schools.rb, line 17
def get(id, options = {})
  body = options.fetch(:query, {})

  @client.get("/schools/#{id}", body, options)
end
schedules(id, options = {}) click to toggle source

Returns a list of schedules that have been created in a given school

‘/schools/:id/schedules’ GET

id - ID of the school

# File lib/academical/api/schools.rb, line 39
def schedules(id, options = {})
  body = options.fetch(:query, {})

  @client.get("/schools/#{id}/schedules", body, options)
end
sections(id, options = {}) click to toggle source

Returns a list of sections for a given school

‘/schools/:id/sections’ GET

id - ID of the school

# File lib/academical/api/schools.rb, line 61
def sections(id, options = {})
  body = options.fetch(:query, {})

  @client.get("/schools/#{id}/sections", body, options)
end
students(id, options = {}) click to toggle source

Returns a list of students for a given school

‘/schools/:id/students’ GET

id - ID of the school

# File lib/academical/api/schools.rb, line 50
def students(id, options = {})
  body = options.fetch(:query, {})

  @client.get("/schools/#{id}/students", body, options)
end
teachers(id, options = {}) click to toggle source

Return a list of teachers for a given school

‘/schools/:id/teachers’ GET

id - ID of the school

# File lib/academical/api/schools.rb, line 72
def teachers(id, options = {})
  body = options.fetch(:query, {})

  @client.get("/schools/#{id}/teachers", body, options)
end
update(id, name, nickname, locale, timezone, departments, identity_providers, app_ui, terms, options = {}) click to toggle source

Update a new school in Academical. You must provide all of the required parameters

‘/schools/:id/’ PUT

id - Generated ID for the school name - Name of the school nickname - Nickname of the school locale - Locale of the school timezone - Timezone of the school departments - A list of Department objects. Each department should specify a name and faculty_name identity_providers - A list of Identify Providers to use with this school app_ui - Object describing UI specific parameters for our planner app terms - A list containing Term objects. Each term should define a name, a start date and end date.

# File lib/academical/api/schools.rb, line 117
def update(id, name, nickname, locale, timezone, departments, identity_providers, app_ui, terms, options = {})
  body = options.fetch(:body, {})
  body[:name] = name
  body[:nickname] = nickname
  body[:locale] = locale
  body[:timezone] = timezone
  body[:departments] = departments
  body[:identity_providers] = identity_providers
  body[:app_ui] = app_ui
  body[:terms] = terms

  @client.put("/schools/#{id}/", body, options)
end