class AbsorbApi::CourseEnrollment

Attributes

accepted_terms_and_conditions[RW]
certificate_id[RW]
course_id[RW]
course_name[RW]
course_version_id[RW]
credits[RW]
date_completed[RW]
date_started[RW]
enrollment_key_id[RW]
full_name[RW]
id[RW]
progress[RW]
score[RW]
status[RW]
time_spent[RW]
user_id[RW]

Public Class Methods

lessons_from_collection(course_enrollments, **filters) click to toggle source

gets all associated lessons given a collection of enrollments all calls are called in parallel enrollments are chunked in groups of 105 to keep typhoeus from getting bogged down modifiedSince must be a DateTime object

# File lib/absorb_api/course_enrollment.rb, line 17
def self.lessons_from_collection(course_enrollments, **filters)
  lessons = []
  course_enrollments.each_slice(105) do |enrollment_slice|
    api.in_parallel do
      enrollment_slice.each do |enrollment|
        lessons << api.get("users/#{enrollment.user_id}/enrollments/#{enrollment.course_id}/lessons", filters)
      end
    end
  end
  lessons.map { |response| response.body.map { |body| LessonEnrollment.new(body) } }.flatten.reject { |lesson| AbsorbApi.configuration.ignored_lesson_types.include? lesson.type }
end

Public Instance Methods

lessons(**conditions) click to toggle source
# File lib/absorb_api/course_enrollment.rb, line 7
def lessons(**conditions)
  api.get("users/#{self.user_id}/enrollments/#{self.course_id}/lessons", conditions).body.map! do |lesson_attributes|
    LessonEnrollment.new(lesson_attributes)
  end
end