Class: Canvas::Models::Enrollment

Inherits:
BaseModel
  • Object
show all
Defined in:
app/models/canvas/models/enrollment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#==, #initialize

Constructor Details

This class inherits a constructor from Canvas::Models::BaseModel

Instance Attribute Details

#associated_user_sis_idObject

Returns the value of attribute associated_user_sis_id.



7
8
9
# File 'app/models/canvas/models/enrollment.rb', line 7

def associated_user_sis_id
  @associated_user_sis_id
end

#course_sis_idObject

Returns the value of attribute course_sis_id.



7
8
9
# File 'app/models/canvas/models/enrollment.rb', line 7

def course_sis_id
  @course_sis_id
end

#roleObject

Returns the value of attribute role.



7
8
9
# File 'app/models/canvas/models/enrollment.rb', line 7

def role
  @role
end

#section_sis_idObject

Returns the value of attribute section_sis_id.



7
8
9
# File 'app/models/canvas/models/enrollment.rb', line 7

def section_sis_id
  @section_sis_id
end

#statusObject

Returns the value of attribute status.



7
8
9
# File 'app/models/canvas/models/enrollment.rb', line 7

def status
  @status
end

#user_sis_idObject

Returns the value of attribute user_sis_id.



7
8
9
# File 'app/models/canvas/models/enrollment.rb', line 7

def user_sis_id
  @user_sis_id
end

Instance Method Details

#after_initializeObject



13
14
15
# File 'app/models/canvas/models/enrollment.rb', line 13

def after_initialize
  self.status ||= 'active'
end

#course_or_sectionObject



9
10
11
# File 'app/models/canvas/models/enrollment.rb', line 9

def course_or_section
  errors.add(:id, 'An enrollment must have either a course_id or a section_id') unless @course_sis_id || @section_sis_id
end