Class: Student
- Defined in:
- lib/Appolo/Models/main_model/student.rb
Constant Summary collapse
- @@type_for_links =
'students'
Instance Attribute Summary collapse
-
#academic_email ⇒ Object
readonly
Returns the value of attribute academic_email.
-
#avatar_url ⇒ Object
readonly
Returns the value of attribute avatar_url.
-
#github_username ⇒ Object
readonly
Returns the value of attribute github_username.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#program ⇒ Object
readonly
Returns the value of attribute program.
-
#students ⇒ Object
readonly
Returns the value of attribute students.
Attributes inherited from Element
Instance Method Summary collapse
-
#initialize(json_str = nil) ⇒ Student
constructor
A new instance of Student.
- #to_s ⇒ Object
Methods inherited from Element
Constructor Details
#initialize(json_str = nil) ⇒ Student
Returns a new instance of Student.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/Appolo/Models/main_model/student.rb', line 15 def initialize(json_str = nil) if json_str.nil? return end json_data = check_json_info json_str super(json_data[ModelUtils::ID], json_data[ModelUtils::SHORT_NAME], json_data[ModelUtils::LINKS], @@type_for_links) @number = json_data[ModelUtils::NUMBER] @name = json_data[ModelUtils::NAME] || json_data[ModelUtils::FULL_NAME] @academic_email = json_data[ModelUtils::ACADEMIC_EMAIL] @github_username = json_data[ModelUtils::GITHUB_USERNAME] program_info = json_data[ModelUtils::PROGRAM] @program = Program.new(program_info) unless program_info.nil? @avatar_url = AvatarUrl.new(json_data[ModelUtils::AVATAR_URL]) end |
Instance Attribute Details
#academic_email ⇒ Object (readonly)
Returns the value of attribute academic_email.
12 13 14 |
# File 'lib/Appolo/Models/main_model/student.rb', line 12 def academic_email @academic_email end |
#avatar_url ⇒ Object (readonly)
Returns the value of attribute avatar_url.
13 14 15 |
# File 'lib/Appolo/Models/main_model/student.rb', line 13 def avatar_url @avatar_url end |
#github_username ⇒ Object (readonly)
Returns the value of attribute github_username.
12 13 14 |
# File 'lib/Appolo/Models/main_model/student.rb', line 12 def github_username @github_username end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/Appolo/Models/main_model/student.rb', line 12 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
12 13 14 |
# File 'lib/Appolo/Models/main_model/student.rb', line 12 def number @number end |
#program ⇒ Object (readonly)
Returns the value of attribute program.
13 14 15 |
# File 'lib/Appolo/Models/main_model/student.rb', line 13 def program @program end |
#students ⇒ Object (readonly)
Returns the value of attribute students.
13 14 15 |
# File 'lib/Appolo/Models/main_model/student.rb', line 13 def students @students end |
Instance Method Details
#to_s ⇒ Object
37 38 39 |
# File 'lib/Appolo/Models/main_model/student.rb', line 37 def to_s "#{@id} : Number #{@number.to_s} - #{@short_name}" end |