class Student

Attributes

academic_email[R]
avatar_url[R]
github_username[R]
name[R]
number[R]
program[R]
students[R]

Public Class Methods

new(json_str = nil) click to toggle source
Calls superclass method Element::new
# 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

Public Instance Methods

to_s() click to toggle source
# File lib/Appolo/Models/main_model/student.rb, line 37
def to_s
  "#{@id} : Number #{@number.to_s} - #{@short_name}"
end