Class: Meibo::Course
- Inherits:
-
Object
- Object
- Meibo::Course
- Defined in:
- lib/meibo/course.rb
Direct Known Subclasses
Instance Method Summary collapse
- #classes ⇒ Object
- #collection ⇒ Object
-
#initialize(sourced_id:, title:, org_sourced_id:, status: nil, date_last_modified: nil, school_year_sourced_id: nil, course_code: nil, grades: [], subjects: [], subject_codes: [], **extension_fields) ⇒ Course
constructor
A new instance of Course.
- #organization ⇒ Object
- #school_year ⇒ Object
Constructor Details
#initialize(sourced_id:, title:, org_sourced_id:, status: nil, date_last_modified: nil, school_year_sourced_id: nil, course_code: nil, grades: [], subjects: [], subject_codes: [], **extension_fields) ⇒ Course
Returns a new instance of Course.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/meibo/course.rb', line 27 def initialize(sourced_id:, title:, org_sourced_id:, status: nil, date_last_modified: nil, school_year_sourced_id: nil, course_code: nil, grades: [], subjects: [], subject_codes: [], **extension_fields) raise InvalidDataTypeError unless subjects.is_a?(Array) && subject_codes.is_a?(Array) && subjects.size == subject_codes.size @sourced_id = sourced_id @status = status @date_last_modified = date_last_modified @school_year_sourced_id = school_year_sourced_id @title = title @course_code = course_code @grades = grades @org_sourced_id = org_sourced_id @subjects = subjects @subject_codes = subject_codes @extension_fields = extension_fields end |
Instance Method Details
#classes ⇒ Object
56 57 58 |
# File 'lib/meibo/course.rb', line 56 def classes Meibo.current_roster.classes.where(course_sourced_id: sourced_id) end |
#collection ⇒ Object
44 45 46 |
# File 'lib/meibo/course.rb', line 44 def collection Meibo.current_roster.courses end |
#organization ⇒ Object
48 49 50 |
# File 'lib/meibo/course.rb', line 48 def organization Meibo.current_roster.organizations.find(org_sourced_id) end |
#school_year ⇒ Object
52 53 54 |
# File 'lib/meibo/course.rb', line 52 def school_year Meibo.current_roster.academic_sessions.find(school_year_sourced_id) if school_year_sourced_id end |