Class: Academical::Api::Schools
- Inherits:
-
Object
- Object
- Academical::Api::Schools
- Defined in:
- lib/academical/api/schools.rb
Overview
All schools that are using Academical
Instance Method Summary collapse
-
#create(name, nickname, locale, timezone, departments, identity_providers, app_ui, terms, options = {}) ⇒ Object
Creates a new school object in Academical.
-
#delete(id, options = {}) ⇒ Object
Delete a school from the API given its ID.
-
#get(id, options = {}) ⇒ Object
Returns a school object given its ID.
-
#initialize(client) ⇒ Schools
constructor
A new instance of Schools.
-
#schedules(id, options = {}) ⇒ Object
Returns a list of schedules that have been created in a given school.
-
#sections(id, options = {}) ⇒ Object
Returns a list of sections for a given school.
-
#students(id, options = {}) ⇒ Object
Returns a list of students for a given school.
-
#teachers(id, options = {}) ⇒ Object
Return a list of teachers for a given school.
-
#update(id, name, nickname, locale, timezone, departments, identity_providers, app_ui, terms, options = {}) ⇒ Object
Update a new school in Academical.
Constructor Details
#initialize(client) ⇒ Schools
Returns a new instance of Schools.
8 9 10 |
# File 'lib/academical/api/schools.rb', line 8 def initialize(client) @client = client end |
Instance Method Details
#create(name, nickname, locale, timezone, departments, identity_providers, app_ui, terms, options = {}) ⇒ Object
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.
90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/academical/api/schools.rb', line 90 def create(name, nickname, locale, timezone, departments, identity_providers, app_ui, terms, = {}) body = .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, ) end |
#delete(id, options = {}) ⇒ Object
Delete a school from the API given its ID
‘/schools/:id’ DELETE
id - ID of the school
28 29 30 31 32 |
# File 'lib/academical/api/schools.rb', line 28 def delete(id, = {}) body = .fetch(:body, {}) @client.delete("/schools/#{id}", body, ) end |
#get(id, options = {}) ⇒ Object
Returns a school object given its ID
‘/schools/:id’ GET
id - ID of the school
17 18 19 20 21 |
# File 'lib/academical/api/schools.rb', line 17 def get(id, = {}) body = .fetch(:query, {}) @client.get("/schools/#{id}", body, ) end |
#schedules(id, options = {}) ⇒ Object
Returns a list of schedules that have been created in a given school
‘/schools/:id/schedules’ GET
id - ID of the school
39 40 41 42 43 |
# File 'lib/academical/api/schools.rb', line 39 def schedules(id, = {}) body = .fetch(:query, {}) @client.get("/schools/#{id}/schedules", body, ) end |
#sections(id, options = {}) ⇒ Object
Returns a list of sections for a given school
‘/schools/:id/sections’ GET
id - ID of the school
61 62 63 64 65 |
# File 'lib/academical/api/schools.rb', line 61 def sections(id, = {}) body = .fetch(:query, {}) @client.get("/schools/#{id}/sections", body, ) end |
#students(id, options = {}) ⇒ Object
Returns a list of students for a given school
‘/schools/:id/students’ GET
id - ID of the school
50 51 52 53 54 |
# File 'lib/academical/api/schools.rb', line 50 def students(id, = {}) body = .fetch(:query, {}) @client.get("/schools/#{id}/students", body, ) end |
#teachers(id, options = {}) ⇒ Object
Return a list of teachers for a given school
‘/schools/:id/teachers’ GET
id - ID of the school
72 73 74 75 76 |
# File 'lib/academical/api/schools.rb', line 72 def teachers(id, = {}) body = .fetch(:query, {}) @client.get("/schools/#{id}/teachers", body, ) end |
#update(id, name, nickname, locale, timezone, departments, identity_providers, app_ui, terms, options = {}) ⇒ Object
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.
117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/academical/api/schools.rb', line 117 def update(id, name, nickname, locale, timezone, departments, identity_providers, app_ui, terms, = {}) body = .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, ) end |