Class: OneRoster::Types::Class

Inherits:
Base
  • Object
show all
Defined in:
lib/types/class.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#to_h

Constructor Details

#initialize(attributes = {}) ⇒ Class

Returns a new instance of Class.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/types/class.rb', line 15

def initialize(attributes = {}, *)
  @uid        = attributes['sourcedId']
  @title      = capitalize(attributes['title'])
  @course_uid = attributes['course']['sourcedId']
  @status     = attributes['status']
  @period     = first_period(attributes) || period_from_code(attributes)
  @grades     = presence(attributes['grades']) || []
  @subjects   = presence(attributes['subjects']) || []
  @term_id    = attributes.dig('terms', 0, 'sourcedId')
  @provider   = 'oneroster'
end

Instance Attribute Details

#course_uidObject (readonly)

Returns the value of attribute course_uid.



6
7
8
# File 'lib/types/class.rb', line 6

def course_uid
  @course_uid
end

#gradesObject (readonly)

Returns the value of attribute grades.



6
7
8
# File 'lib/types/class.rb', line 6

def grades
  @grades
end

#periodObject (readonly)

Returns the value of attribute period.



6
7
8
# File 'lib/types/class.rb', line 6

def period
  @period
end

#providerObject (readonly)

Returns the value of attribute provider.



6
7
8
# File 'lib/types/class.rb', line 6

def provider
  @provider
end

#subjectsObject (readonly)

Returns the value of attribute subjects.



6
7
8
# File 'lib/types/class.rb', line 6

def subjects
  @subjects
end

#term_idObject (readonly)

Returns the value of attribute term_id.



6
7
8
# File 'lib/types/class.rb', line 6

def term_id
  @term_id
end

#titleObject (readonly)

Returns the value of attribute title.



6
7
8
# File 'lib/types/class.rb', line 6

def title
  @title
end

#uidObject (readonly)

Returns the value of attribute uid.



6
7
8
# File 'lib/types/class.rb', line 6

def uid
  @uid
end