Class: AbsorbApi::CourseEnrollment
- Defined in:
- lib/absorb_api/course_enrollment.rb
Instance Attribute Summary collapse
-
#accepted_terms_and_conditions ⇒ Object
Returns the value of attribute accepted_terms_and_conditions.
-
#certificate_id ⇒ Object
Returns the value of attribute certificate_id.
-
#course_id ⇒ Object
Returns the value of attribute course_id.
-
#course_name ⇒ Object
Returns the value of attribute course_name.
-
#course_version_id ⇒ Object
Returns the value of attribute course_version_id.
-
#credits ⇒ Object
Returns the value of attribute credits.
-
#date_completed ⇒ Object
Returns the value of attribute date_completed.
-
#date_started ⇒ Object
Returns the value of attribute date_started.
-
#enrollment_key_id ⇒ Object
Returns the value of attribute enrollment_key_id.
-
#full_name ⇒ Object
Returns the value of attribute full_name.
-
#id ⇒ Object
Returns the value of attribute id.
-
#progress ⇒ Object
Returns the value of attribute progress.
-
#score ⇒ Object
Returns the value of attribute score.
-
#status ⇒ Object
Returns the value of attribute status.
-
#time_spent ⇒ Object
Returns the value of attribute time_spent.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Class Method Summary collapse
-
.lessons_from_collection(course_enrollments, **filters) ⇒ Object
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.
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from AbsorbApi::Base
Instance Attribute Details
#accepted_terms_and_conditions ⇒ Object
Returns the value of attribute accepted_terms_and_conditions.
3 4 5 |
# File 'lib/absorb_api/course_enrollment.rb', line 3 def accepted_terms_and_conditions @accepted_terms_and_conditions end |
#certificate_id ⇒ Object
Returns the value of attribute certificate_id.
3 4 5 |
# File 'lib/absorb_api/course_enrollment.rb', line 3 def certificate_id @certificate_id end |
#course_id ⇒ Object
Returns the value of attribute course_id.
3 4 5 |
# File 'lib/absorb_api/course_enrollment.rb', line 3 def course_id @course_id end |
#course_name ⇒ Object
Returns the value of attribute course_name.
3 4 5 |
# File 'lib/absorb_api/course_enrollment.rb', line 3 def course_name @course_name end |
#course_version_id ⇒ Object
Returns the value of attribute course_version_id.
3 4 5 |
# File 'lib/absorb_api/course_enrollment.rb', line 3 def course_version_id @course_version_id end |
#credits ⇒ Object
Returns the value of attribute credits.
3 4 5 |
# File 'lib/absorb_api/course_enrollment.rb', line 3 def credits @credits end |
#date_completed ⇒ Object
Returns the value of attribute date_completed.
3 4 5 |
# File 'lib/absorb_api/course_enrollment.rb', line 3 def date_completed @date_completed end |
#date_started ⇒ Object
Returns the value of attribute date_started.
3 4 5 |
# File 'lib/absorb_api/course_enrollment.rb', line 3 def date_started @date_started end |
#enrollment_key_id ⇒ Object
Returns the value of attribute enrollment_key_id.
3 4 5 |
# File 'lib/absorb_api/course_enrollment.rb', line 3 def enrollment_key_id @enrollment_key_id end |
#full_name ⇒ Object
Returns the value of attribute full_name.
3 4 5 |
# File 'lib/absorb_api/course_enrollment.rb', line 3 def full_name @full_name end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/absorb_api/course_enrollment.rb', line 3 def id @id end |
#progress ⇒ Object
Returns the value of attribute progress.
3 4 5 |
# File 'lib/absorb_api/course_enrollment.rb', line 3 def progress @progress end |
#score ⇒ Object
Returns the value of attribute score.
3 4 5 |
# File 'lib/absorb_api/course_enrollment.rb', line 3 def score @score end |
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'lib/absorb_api/course_enrollment.rb', line 3 def status @status end |
#time_spent ⇒ Object
Returns the value of attribute time_spent.
3 4 5 |
# File 'lib/absorb_api/course_enrollment.rb', line 3 def time_spent @time_spent end |
#user_id ⇒ Object
Returns the value of attribute user_id.
3 4 5 |
# File 'lib/absorb_api/course_enrollment.rb', line 3 def user_id @user_id end |
Class Method Details
.lessons_from_collection(course_enrollments, **filters) ⇒ Object
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
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/absorb_api/course_enrollment.rb', line 15 def self.lessons_from_collection(course_enrollments, **filters) lessons = [] course_enrollments.each_slice(105) do |enrollment_slice| AbsorbApi.api.in_parallel do enrollment_slice.each do |enrollment| lessons << AbsorbApi.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 |
Instance Method Details
#lessons(**conditions) ⇒ Object
5 6 7 8 9 |
# File 'lib/absorb_api/course_enrollment.rb', line 5 def lessons(**conditions) AbsorbApi.api.get("users/#{self.user_id}/enrollments/#{self.course_id}/lessons", conditions).body.map! do |lesson_attributes| LessonEnrollment.new(lesson_attributes) end end |