Class: WhopSDK::Resources::CourseLessons
- Inherits:
-
Object
- Object
- WhopSDK::Resources::CourseLessons
- Defined in:
- lib/whop_sdk/resources/course_lessons.rb
Overview
Course lessons
Instance Method Summary collapse
-
#create(chapter_id:, lesson_type:, content: nil, days_from_course_start_until_unlock: nil, embed_id: nil, embed_type: nil, thumbnail: nil, title: nil, request_options: {}) ⇒ WhopSDK::Models::Lesson
Some parameter documentations has been truncated, see Models::CourseLessonCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ Boolean
Permanently delete a lesson and remove it from its chapter.
-
#initialize(client:) ⇒ CourseLessons
constructor
private
A new instance of CourseLessons.
-
#list(after: nil, before: nil, chapter_id: nil, course_id: nil, first: nil, last: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::CourseLessonListResponse>
Returns a paginated list of lessons within a course or chapter, ordered by position.
-
#mark_as_completed(lesson_id, request_options: {}) ⇒ Boolean
Mark a lesson as completed for the current user after they finish the content.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Lesson
Retrieves the details of an existing course lesson.
-
#start(lesson_id, request_options: {}) ⇒ Boolean
Record that the current user has started viewing a lesson, creating progress tracking records.
-
#submit_assessment(lesson_id, answers:, request_options: {}) ⇒ WhopSDK::Models::CourseLessonSubmitAssessmentResponse
Some parameter documentations has been truncated, see Models::CourseLessonSubmitAssessmentParams for more details.
-
#update(id, assessment_completion_requirement: nil, assessment_questions: nil, attachments: nil, content: nil, days_from_course_start_until_unlock: nil, embed_id: nil, embed_type: nil, lesson_type: nil, main_pdf: nil, max_attempts: nil, mux_asset_id: nil, thumbnail: nil, title: nil, visibility: nil, request_options: {}) ⇒ WhopSDK::Models::Lesson
Some parameter documentations has been truncated, see Models::CourseLessonUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ CourseLessons
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of CourseLessons.
267 268 269 |
# File 'lib/whop_sdk/resources/course_lessons.rb', line 267 def initialize(client:) @client = client end |
Instance Method Details
#create(chapter_id:, lesson_type:, content: nil, days_from_course_start_until_unlock: nil, embed_id: nil, embed_type: nil, thumbnail: nil, title: nil, request_options: {}) ⇒ WhopSDK::Models::Lesson
Some parameter documentations has been truncated, see Models::CourseLessonCreateParams for more details.
Create a new lesson within a course chapter. Lessons can contain video, text, or assessment content.
Required permissions:
-
‘courses:update`
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/whop_sdk/resources/course_lessons.rb', line 40 def create(params) parsed, = WhopSDK::CourseLessonCreateParams.dump_request(params) @client.request( method: :post, path: "course_lessons", body: parsed, model: WhopSDK::Lesson, options: ) end |
#delete(id, request_options: {}) ⇒ Boolean
Permanently delete a lesson and remove it from its chapter.
Required permissions:
-
‘courses:update`
187 188 189 190 191 192 193 194 |
# File 'lib/whop_sdk/resources/course_lessons.rb', line 187 def delete(id, params = {}) @client.request( method: :delete, path: ["course_lessons/%1$s", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |
#list(after: nil, before: nil, chapter_id: nil, course_id: nil, first: nil, last: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::CourseLessonListResponse>
Returns a paginated list of lessons within a course or chapter, ordered by position.
Required permissions:
-
‘courses:read`
159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/whop_sdk/resources/course_lessons.rb', line 159 def list(params = {}) parsed, = WhopSDK::CourseLessonListParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "course_lessons", query: query, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Models::CourseLessonListResponse, options: ) end |
#mark_as_completed(lesson_id, request_options: {}) ⇒ Boolean
Mark a lesson as completed for the current user after they finish the content.
207 208 209 210 211 212 213 214 |
# File 'lib/whop_sdk/resources/course_lessons.rb', line 207 def mark_as_completed(lesson_id, params = {}) @client.request( method: :post, path: ["course_lessons/%1$s/mark_as_completed", lesson_id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Lesson
Retrieves the details of an existing course lesson.
Required permissions:
-
‘courses:read`
66 67 68 69 70 71 72 73 |
# File 'lib/whop_sdk/resources/course_lessons.rb', line 66 def retrieve(id, params = {}) @client.request( method: :get, path: ["course_lessons/%1$s", id], model: WhopSDK::Lesson, options: params[:request_options] ) end |
#start(lesson_id, request_options: {}) ⇒ Boolean
Record that the current user has started viewing a lesson, creating progress tracking records.
228 229 230 231 232 233 234 235 |
# File 'lib/whop_sdk/resources/course_lessons.rb', line 228 def start(lesson_id, params = {}) @client.request( method: :post, path: ["course_lessons/%1$s/start", lesson_id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |
#submit_assessment(lesson_id, answers:, request_options: {}) ⇒ WhopSDK::Models::CourseLessonSubmitAssessmentResponse
Some parameter documentations has been truncated, see Models::CourseLessonSubmitAssessmentParams for more details.
Submit answers for a quiz or knowledge check lesson and receive a graded result.
253 254 255 256 257 258 259 260 261 262 |
# File 'lib/whop_sdk/resources/course_lessons.rb', line 253 def submit_assessment(lesson_id, params) parsed, = WhopSDK::CourseLessonSubmitAssessmentParams.dump_request(params) @client.request( method: :post, path: ["course_lessons/%1$s/submit_assessment", lesson_id], body: parsed, model: WhopSDK::Models::CourseLessonSubmitAssessmentResponse, options: ) end |
#update(id, assessment_completion_requirement: nil, assessment_questions: nil, attachments: nil, content: nil, days_from_course_start_until_unlock: nil, embed_id: nil, embed_type: nil, lesson_type: nil, main_pdf: nil, max_attempts: nil, mux_asset_id: nil, thumbnail: nil, title: nil, visibility: nil, request_options: {}) ⇒ WhopSDK::Models::Lesson
Some parameter documentations has been truncated, see Models::CourseLessonUpdateParams for more details.
Update a lesson’s content, type, visibility, assessment questions, or media attachments.
Required permissions:
-
‘courses:update`
122 123 124 125 126 127 128 129 130 131 |
# File 'lib/whop_sdk/resources/course_lessons.rb', line 122 def update(id, params = {}) parsed, = WhopSDK::CourseLessonUpdateParams.dump_request(params) @client.request( method: :patch, path: ["course_lessons/%1$s", id], body: parsed, model: WhopSDK::Lesson, options: ) end |