Class: Teacher

Inherits:
Object
  • Object
show all
Defined in:
lib/Appolo/Models/main_model/teacher.rb

Constant Summary collapse

TYPE =
'teachers'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json_info) ⇒ Teacher

Returns a new instance of Teacher.


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/Appolo/Models/main_model/teacher.rb', line 12

def initialize(json_info)
    if json_info.is_a? Hash
      json_data = json_info
    else
      json_data = JSON.parse json_info
    end

    @id = json_data[ModelUtils::ID]
    @number = json_data[ModelUtils::NUMBER]
    @short_name = json_data[ModelUtils::SHORT_NAME]
    @name = json_data[ModelUtils::NAME]
    @academic_email = json_data[ModelUtils::ACADEMIC_EMAIL]
    @links = Links.new(json_data[ModelUtils::LINKS], TYPE)
    @avatar_url = AvatarUrl.new(json_data[ModelUtils::AVATAR_URL])

end

Instance Attribute Details

#academic_emailObject (readonly)

Returns the value of attribute academic_email


8
9
10
# File 'lib/Appolo/Models/main_model/teacher.rb', line 8

def academic_email
  @academic_email
end

#avatar_urlObject (readonly)

Returns the value of attribute avatar_url


9
10
11
# File 'lib/Appolo/Models/main_model/teacher.rb', line 9

def avatar_url
  @avatar_url
end

#idObject (readonly)

Returns the value of attribute id


8
9
10
# File 'lib/Appolo/Models/main_model/teacher.rb', line 8

def id
  @id
end

Returns the value of attribute links


9
10
11
# File 'lib/Appolo/Models/main_model/teacher.rb', line 9

def links
  @links
end

#nameObject (readonly)

Returns the value of attribute name


8
9
10
# File 'lib/Appolo/Models/main_model/teacher.rb', line 8

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number


8
9
10
# File 'lib/Appolo/Models/main_model/teacher.rb', line 8

def number
  @number
end

#short_nameObject (readonly)

Returns the value of attribute short_name


8
9
10
# File 'lib/Appolo/Models/main_model/teacher.rb', line 8

def short_name
  @short_name
end

Instance Method Details

#to_sObject


30
31
32
# File 'lib/Appolo/Models/main_model/teacher.rb', line 30

def to_s
  "#{@id} - #{@short_name} : #{@academic_email}"
end