Class: Meibo::AcademicSession
- Inherits:
-
Object
- Object
- Meibo::AcademicSession
show all
- Defined in:
- lib/meibo/academic_session.rb
Constant Summary
collapse
- TYPES =
{
grading_period: "gradingPeriod",
semester: "semester",
school_year: "schoolYear",
term: "term"
}.freeze
Instance Method Summary
collapse
Constructor Details
#initialize(sourced_id:, school_year:, type:, start_date:, end_date:, status: nil, date_last_modified: nil, title: nil, parent_sourced_id: nil, **extension_fields) ⇒ AcademicSession
Returns a new instance of AcademicSession.
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/meibo/academic_session.rb', line 35
def initialize(sourced_id:, school_year:, type:, start_date:, end_date:, status: nil, date_last_modified: nil,
title: nil, parent_sourced_id: nil, **extension_fields)
@sourced_id = sourced_id
@status = status
@date_last_modified = date_last_modified
@title = title
@type = type
@start_date = start_date
@end_date = end_date
@parent_sourced_id = parent_sourced_id
@school_year = school_year
@extension_fields = extension_fields
end
|
Instance Method Details
#children ⇒ Object
73
74
75
|
# File 'lib/meibo/academic_session.rb', line 73
def children
collection.where(parent_sourced_id: sourced_id)
end
|
#collection ⇒ Object
49
50
51
|
# File 'lib/meibo/academic_session.rb', line 49
def collection
Meibo.current_roster.academic_sessions
end
|
#grading_period? ⇒ Boolean
53
54
55
|
# File 'lib/meibo/academic_session.rb', line 53
def grading_period?
type == TYPES[:grading_period]
end
|
#parent ⇒ Object
69
70
71
|
# File 'lib/meibo/academic_session.rb', line 69
def parent
parent_sourced_id && collection.find(parent_sourced_id)
end
|
#school_year? ⇒ Boolean
61
62
63
|
# File 'lib/meibo/academic_session.rb', line 61
def school_year?
type == TYPES[:school_year]
end
|
#semester? ⇒ Boolean
57
58
59
|
# File 'lib/meibo/academic_session.rb', line 57
def semester?
type == TYPES[:semester]
end
|
#term? ⇒ Boolean
65
66
67
|
# File 'lib/meibo/academic_session.rb', line 65
def term?
type == TYPES[:term]
end
|