class LessonlyApi::Lessons
Public Class Methods
Archive a lesson docs.lessonly.com/#archive-lesson
@param id [Integer] ID of a lesson to archive @return [ResourceType::Lesson] the response converted to a resource object
# File lib/lessonly_api/lessons.rb, line 39 def archive(id) raw_result = send_put("/lessons/#{id}/archive") ResourceType::Lesson.new(raw_result) end
Allow to make assignments to a particular lesson in the API docs.lessonly.com/#assign-lesson
@param id [Integer] ID of a lesson @param assignments [Array] array with assignments' attributes to create @return [ResourceType::Assignments] the response converted to a resource object
# File lib/lessonly_api/lessons.rb, line 82 def assign_lesson(id, assignments = []) raw_result = send_post("/lessons/#{id}/assignments", assignments: assignments) ResourceType::Assignments.new(raw_result) end
Retrieve all the assignments for a particular lesson docs.lessonly.com/#lesson-assignments
@param id [Integer] ID of a lesson @param page [Integer] the number of the page @param per_page [Integer] the numer of records per page @return [ResourceType::LessonAssignment] the response converted to a resource object
# File lib/lessonly_api/lessons.rb, line 61 def lesson_assignments(id, page: 1, per_page: 50) raw_result = send_get("/lessons/#{id}/assignments", page: page, per_page: per_page) ResourceType::Assignments.new(raw_result) end
Retrieves the number of completed assignments for a given lesson docs.lessonly.com/#lesson-completed-assignments-v1-1
@param id [Integer] ID of a lesson @return [ResourceType::LessonAssignmentsCompleted] the response converted to a resource object
# File lib/lessonly_api/lessons.rb, line 71 def lesson_completed_assignments(id) raw_result = send_get("/lessons/#{id}/assignments/completed") ResourceType::LessonAssignmentsCompleted.new(raw_result) end
Retrieve all lessons docs.lessonly.com/#list-lessons
@return [ResourceType::Lessons] the response converted to a resource object
# File lib/lessonly_api/lessons.rb, line 8 def list raw_result = send_get('/lessons') ResourceType::Lessons.new(raw_result) end
Restore an archived lesson docs.lessonly.com/#restore-lesson
@param id [Integer] ID of a lesson to restore @return [ResourceType::Lesson] the response converted to a resource object
# File lib/lessonly_api/lessons.rb, line 49 def restore(id) raw_result = send_put("/lessons/#{id}/restore") ResourceType::Lesson.new(raw_result) end
Retrieve the lesson's information docs.lessonly.com/#show-lesson-details
@param id [Integer] ID of the group @return [ResourceType::Lesson] the response converted to a resource object
# File lib/lessonly_api/lessons.rb, line 18 def show(id) raw_result = send_get("/lessons/#{id}") ResourceType::Lesson.new(raw_result) end
Update a lesson docs.lessonly.com/#update-lesson
@param id [Integer] ID of a lesson to update @param attributes [Hash] hash with lesson's attributes to update @return [ResourceType::Lesson] the response converted to a resource object
# File lib/lessonly_api/lessons.rb, line 29 def update(id, attributes = {}) raw_result = send_put("/lessons/#{id}", attributes) ResourceType::Lesson.new(raw_result) end