Class: LectiveSemester

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

Constant Summary collapse

TYPE =
'lectiveSemesters'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json_str) ⇒ LectiveSemester

Returns a new instance of LectiveSemester.


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

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

  @lective_semester_id = json_data[ModelUtils::LECTIVE_ID]
  @short_name = json_data[ModelUtils::SHORT_NAME]
  @start_year = json_data[ModelUtils::START_YEAR]
  @term = json_data[ModelUtils::TERM]
  @term_name = json_data[ModelUtils::TERM_NAME]
  @links = Links.new json_data[ModelUtils::LINKS], TYPE
end

Instance Attribute Details

#lective_semester_idObject (readonly)

Returns the value of attribute lective_semester_id


6
7
8
# File 'lib/Appolo/Models/main_model/lective_semester.rb', line 6

def lective_semester_id
  @lective_semester_id
end

Returns the value of attribute links


7
8
9
# File 'lib/Appolo/Models/main_model/lective_semester.rb', line 7

def links
  @links
end

#short_nameObject (readonly)

Returns the value of attribute short_name


6
7
8
# File 'lib/Appolo/Models/main_model/lective_semester.rb', line 6

def short_name
  @short_name
end

#start_yearObject (readonly)

Returns the value of attribute start_year


6
7
8
# File 'lib/Appolo/Models/main_model/lective_semester.rb', line 6

def start_year
  @start_year
end

#termObject (readonly)

Returns the value of attribute term


6
7
8
# File 'lib/Appolo/Models/main_model/lective_semester.rb', line 6

def term
  @term
end

#term_nameObject (readonly)

Returns the value of attribute term_name


6
7
8
# File 'lib/Appolo/Models/main_model/lective_semester.rb', line 6

def term_name
  @term_name
end

Instance Method Details

#to_sObject


26
27
28
# File 'lib/Appolo/Models/main_model/lective_semester.rb', line 26

def to_s
  "#{@lective_semester_id} - #{@short_name} : #{@term_name} #{@start_year}"
end