class Academical::Api::Teachers
A teacher in a school.
Public Class Methods
new(client)
click to toggle source
# File lib/academical/api/teachers.rb, line 8 def initialize(client) @client = client end
Public Instance Methods
create(name, school_id, options = {})
click to toggle source
Create a new teacher in Academical
. You must provide all of the required values
‘/teachers/’ POST
name - Object with the name of the teacher school_id - ID of the school which this teacher belongs to
# File lib/academical/api/teachers.rb, line 40 def create(name, school_id, options = {}) body = options.fetch(:body, {}) body[:name] = name body[:school_id] = school_id @client.post("/teachers/", body, options) end
delete(id, options = {})
click to toggle source
Delete a teacher given its ID
‘/teachers/:id’ DELETE
id - ID of the teacher
# File lib/academical/api/teachers.rb, line 28 def delete(id, options = {}) body = options.fetch(:body, {}) @client.delete("/teachers/#{id}", body, options) end
get(id, options = {})
click to toggle source
Get a teacher given its ID
‘/teachers/:id’ GET
id - ID of the teacher
# File lib/academical/api/teachers.rb, line 17 def get(id, options = {}) body = options.fetch(:query, {}) @client.get("/teachers/#{id}", body, options) end
update(id, name, school_id, options = {})
click to toggle source
Update a teacher in Academical
. You must provide all of the required parameters
‘/teachers/:id’ PUT
id - ID of the teacher name - Object with the name of the teacher school_id - ID of the school which this teacher belongs to
# File lib/academical/api/teachers.rb, line 55 def update(id, name, school_id, options = {}) body = options.fetch(:body, {}) body[:id] = id body[:name] = name body[:school_id] = school_id @client.put("/teachers/#{id}", body, options) end