Class: LearnSprout::Section
- Inherits:
-
Object
- Object
- LearnSprout::Section
- Defined in:
- lib/learnsprout/section.rb
Instance Attribute Summary collapse
-
#course_id ⇒ Object
Returns the value of attribute course_id.
-
#number ⇒ Object
Returns the value of attribute number.
-
#room ⇒ Object
Returns the value of attribute room.
-
#school_id ⇒ Object
Returns the value of attribute school_id.
-
#section_id ⇒ Object
Returns the value of attribute section_id.
-
#teacher_id ⇒ Object
Returns the value of attribute teacher_id.
-
#term_id ⇒ Object
Returns the value of attribute term_id.
-
#time_updated ⇒ Object
Returns the value of attribute time_updated.
Instance Method Summary collapse
- #course ⇒ Object
-
#initialize(attrs = {}) ⇒ Section
constructor
A new instance of Section.
- #school ⇒ Object
- #students ⇒ Object
- #teacher ⇒ Object
- #term ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Section
Returns a new instance of Section.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/learnsprout/section.rb', line 13 def initialize(attrs={}) @client = attrs["client"] @org_id = attrs["org_id"] @section_id = attrs["id"] @number = attrs["number"] @room = attrs["room"] @term_id = attrs["term"] && attrs["term"]["id"] @teacher_id = attrs["teacher"] && attrs["teacher"]["id"] @school_id = attrs["school"] && attrs["school"]["id"] @course_id = attrs["course"] && attrs["course"]["id"] @time_updated = attrs["time_updated"] @student_ids = [] if attrs["students"] attrs["students"].each do |student| @student_ids.push student["id"] end end end |
Instance Attribute Details
#course_id ⇒ Object
Returns the value of attribute course_id.
4 5 6 |
# File 'lib/learnsprout/section.rb', line 4 def course_id @course_id end |
#number ⇒ Object
Returns the value of attribute number.
4 5 6 |
# File 'lib/learnsprout/section.rb', line 4 def number @number end |
#room ⇒ Object
Returns the value of attribute room.
4 5 6 |
# File 'lib/learnsprout/section.rb', line 4 def room @room end |
#school_id ⇒ Object
Returns the value of attribute school_id.
4 5 6 |
# File 'lib/learnsprout/section.rb', line 4 def school_id @school_id end |
#section_id ⇒ Object
Returns the value of attribute section_id.
4 5 6 |
# File 'lib/learnsprout/section.rb', line 4 def section_id @section_id end |
#teacher_id ⇒ Object
Returns the value of attribute teacher_id.
4 5 6 |
# File 'lib/learnsprout/section.rb', line 4 def teacher_id @teacher_id end |
#term_id ⇒ Object
Returns the value of attribute term_id.
4 5 6 |
# File 'lib/learnsprout/section.rb', line 4 def term_id @term_id end |
#time_updated ⇒ Object
Returns the value of attribute time_updated.
4 5 6 |
# File 'lib/learnsprout/section.rb', line 4 def time_updated @time_updated end |
Instance Method Details
#course ⇒ Object
44 45 46 |
# File 'lib/learnsprout/section.rb', line 44 def course @course_id && @client.course(@org_id, @course_id) end |
#school ⇒ Object
40 41 42 |
# File 'lib/learnsprout/section.rb', line 40 def school @school_id && @client.school(@org_id, @school_id) end |
#students ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/learnsprout/section.rb', line 48 def students temp_students = [] if @student_ids.count > 0 @student_ids.each do |student_id| temp_students.push @client.student(@org_id, student_id) end end return temp_students end |
#teacher ⇒ Object
36 37 38 |
# File 'lib/learnsprout/section.rb', line 36 def teacher @teacher_id && @client.teacher(@org_id, @teacher_id) end |
#term ⇒ Object
32 33 34 |
# File 'lib/learnsprout/section.rb', line 32 def term @term_id && @client.term(@org_id, @term_id) end |