Class: Wonde::SessionAttendanceRecord
- Inherits:
-
Object
- Object
- Wonde::SessionAttendanceRecord
- Defined in:
- lib/writeback/sessionattendancerecord.rb
Instance Attribute Summary collapse
-
#attendance_code_id ⇒ Object
Returns the value of attribute attendance_code_id.
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#date ⇒ Object
Returns the value of attribute date.
-
#session ⇒ Object
Returns the value of attribute session.
-
#student_id ⇒ Object
Returns the value of attribute student_id.
Instance Method Summary collapse
- #getAttendanceCodeId ⇒ Object
- #getComment ⇒ Object
- #getDate ⇒ Object
- #getSession ⇒ Object
- #getStudentId ⇒ Object
- #isValid ⇒ Object
- #setAttendanceCodeId(attendanceCodeId) ⇒ Object
- #setComment(comment) ⇒ Object
- #setDate(date) ⇒ Object
- #setSession(session) ⇒ Object
-
#setStudentId(studentId) ⇒ Object
most of these methods are here to be compatible 1:1 with the php module, standard ruby getters and setters should still work too.
- #toArray ⇒ Object
Instance Attribute Details
#attendance_code_id ⇒ Object
Returns the value of attribute attendance_code_id.
4 5 6 |
# File 'lib/writeback/sessionattendancerecord.rb', line 4 def attendance_code_id @attendance_code_id end |
#comment ⇒ Object
Returns the value of attribute comment.
4 5 6 |
# File 'lib/writeback/sessionattendancerecord.rb', line 4 def comment @comment end |
#date ⇒ Object
Returns the value of attribute date.
4 5 6 |
# File 'lib/writeback/sessionattendancerecord.rb', line 4 def date @date end |
#session ⇒ Object
Returns the value of attribute session.
4 5 6 |
# File 'lib/writeback/sessionattendancerecord.rb', line 4 def session @session end |
#student_id ⇒ Object
Returns the value of attribute student_id.
4 5 6 |
# File 'lib/writeback/sessionattendancerecord.rb', line 4 def student_id @student_id end |
Instance Method Details
#getAttendanceCodeId ⇒ Object
56 57 58 |
# File 'lib/writeback/sessionattendancerecord.rb', line 56 def getAttendanceCodeId() return self.attendance_code_id end |
#getComment ⇒ Object
81 82 83 |
# File 'lib/writeback/sessionattendancerecord.rb', line 81 def getComment() return self.comment; end |
#getDate ⇒ Object
60 61 62 |
# File 'lib/writeback/sessionattendancerecord.rb', line 60 def getDate() return self.date.to_s end |
#getSession ⇒ Object
64 65 66 |
# File 'lib/writeback/sessionattendancerecord.rb', line 64 def getSession() return self.session end |
#getStudentId ⇒ Object
51 52 53 |
# File 'lib/writeback/sessionattendancerecord.rb', line 51 def getStudentId() return self.student_id end |
#isValid ⇒ Object
47 48 49 |
# File 'lib/writeback/sessionattendancerecord.rb', line 47 def isValid() return ! (self.getDate().empty? || self.getStudentId().empty? || self.getSession().empty? || self.getAttendanceCodeId().empty?) end |
#setAttendanceCodeId(attendanceCodeId) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/writeback/sessionattendancerecord.rb', line 16 def setAttendanceCodeId(attendanceCodeId) if attendanceCodeId.empty? or attendanceCodeId.nil? throw InvalidAttendanceException, 'Attendance code id can not be set to null.' end @attendance_code_id = attendanceCodeId end |
#setComment(comment) ⇒ Object
85 86 87 |
# File 'lib/writeback/sessionattendancerecord.rb', line 85 def setComment(comment) self.comment = comment; end |
#setDate(date) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/writeback/sessionattendancerecord.rb', line 23 def setDate(date) if date.empty? or date.nil? throw InvalidAttendanceException, 'Date can not be set to null.' end begin mytime = Time.parse(date).to_i rescue throw InvalidAttendanceException, 'Date provided is invalid' end newdate = Time.at(mytime) self.date = newdate end |
#setSession(session) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/writeback/sessionattendancerecord.rb', line 37 def setSession(session) session = session.upcase if (session == 'AM' || session == 'PM') self.session = session else throw InvalidSessionException, 'The session is invalid' end end |
#setStudentId(studentId) ⇒ Object
most of these methods are here to be compatible 1:1 with the php module, standard ruby getters and setters should still work too
8 9 10 11 12 13 |
# File 'lib/writeback/sessionattendancerecord.rb', line 8 def setStudentId(studentId) if studentId.empty? or studentId.nil? throw InvalidAttendanceException, 'Student id can not be set to null.' end @student_id = studentId end |
#toArray ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/writeback/sessionattendancerecord.rb', line 68 def toArray() required = { 'date': self.getDate(), 'session': self.getSession(), 'student_id': self.getStudentId(), 'attendance_code_id': self.getAttendanceCodeId() } unless self.getComment.nil? or self.getComment.empty? required['comment'] = self.getComment() end return required end |