Class: LessonlyApi::Lessons
- Inherits:
-
Request
- Object
- ResourceType::Base
- Request
- LessonlyApi::Lessons
- Defined in:
- lib/lessonly_api/lessons.rb
Class Method Summary collapse
-
.archive(id) ⇒ ResourceType::Lesson
Archive a lesson docs.lessonly.com/#archive-lesson.
-
.assign_lesson(id, assignments = []) ⇒ ResourceType::Assignments
Allow to make assignments to a particular lesson in the API docs.lessonly.com/#assign-lesson.
-
.lesson_assignments(id, page: 1, per_page: 50) ⇒ ResourceType::LessonAssignment
Retrieve all the assignments for a particular lesson docs.lessonly.com/#lesson-assignments.
-
.lesson_completed_assignments(id) ⇒ ResourceType::LessonAssignmentsCompleted
Retrieves the number of completed assignments for a given lesson docs.lessonly.com/#lesson-completed-assignments-v1-1.
-
.list ⇒ ResourceType::Lessons
Retrieve all lessons docs.lessonly.com/#list-lessons.
-
.restore(id) ⇒ ResourceType::Lesson
Restore an archived lesson docs.lessonly.com/#restore-lesson.
-
.show(id) ⇒ ResourceType::Lesson
Retrieve the lesson’s information docs.lessonly.com/#show-lesson-details.
-
.update(id, attributes = {}) ⇒ ResourceType::Lesson
Update a lesson docs.lessonly.com/#update-lesson.
Methods inherited from Request
Methods inherited from ResourceType::Base
#attributes, dump, fields, from_json, #initialize, load
Constructor Details
This class inherits a constructor from LessonlyApi::ResourceType::Base
Class Method Details
.archive(id) ⇒ ResourceType::Lesson
Archive a lesson docs.lessonly.com/#archive-lesson
39 40 41 42 |
# File 'lib/lessonly_api/lessons.rb', line 39 def archive(id) raw_result = send_put("/lessons/#{id}/archive") ResourceType::Lesson.new(raw_result) end |
.assign_lesson(id, assignments = []) ⇒ ResourceType::Assignments
Allow to make assignments to a particular lesson in the API docs.lessonly.com/#assign-lesson
82 83 84 85 |
# 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 |
.lesson_assignments(id, page: 1, per_page: 50) ⇒ ResourceType::LessonAssignment
Retrieve all the assignments for a particular lesson docs.lessonly.com/#lesson-assignments
61 62 63 64 |
# 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 |
.lesson_completed_assignments(id) ⇒ ResourceType::LessonAssignmentsCompleted
Retrieves the number of completed assignments for a given lesson docs.lessonly.com/#lesson-completed-assignments-v1-1
71 72 73 74 |
# 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 |
.list ⇒ ResourceType::Lessons
Retrieve all lessons docs.lessonly.com/#list-lessons
8 9 10 11 |
# File 'lib/lessonly_api/lessons.rb', line 8 def list raw_result = send_get('/lessons') ResourceType::Lessons.new(raw_result) end |
.restore(id) ⇒ ResourceType::Lesson
Restore an archived lesson docs.lessonly.com/#restore-lesson
49 50 51 52 |
# File 'lib/lessonly_api/lessons.rb', line 49 def restore(id) raw_result = send_put("/lessons/#{id}/restore") ResourceType::Lesson.new(raw_result) end |
.show(id) ⇒ ResourceType::Lesson
Retrieve the lesson’s information docs.lessonly.com/#show-lesson-details
18 19 20 21 |
# File 'lib/lessonly_api/lessons.rb', line 18 def show(id) raw_result = send_get("/lessons/#{id}") ResourceType::Lesson.new(raw_result) end |
.update(id, attributes = {}) ⇒ ResourceType::Lesson
Update a lesson docs.lessonly.com/#update-lesson
29 30 31 32 |
# 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 |