Class: Program

Inherits:
Element show all
Defined in:
lib/Appolo/Models/main_model/program.rb

Constant Summary collapse

'programs'

Instance Attribute Summary collapse

Attributes inherited from Element

#id, #links, #short_name

Instance Method Summary collapse

Methods inherited from Element

#check_json_info

Constructor Details

#initialize(data) ⇒ Program

Returns a new instance of Program.



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

def initialize(data)
  json_data = check_json_info data


  super(json_data[ModelUtils::ID],
        json_data[ModelUtils::SHORT_NAME],
        json_data[ModelUtils::LINKS],
        @@type_for_links)

  @name = (json_data[ModelUtils::FULL_NAME] || json_data[ModelUtils::NAME])

  @course_units = get_course_units json_data[ModelUtils::COURSE_UNIT]
end

Instance Attribute Details

#course_unitsObject (readonly)

Returns the value of attribute course_units.



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

def course_units
  @course_units
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#to_sObject



25
26
27
# File 'lib/Appolo/Models/main_model/program.rb', line 25

def to_s
  "#{@id} - #{@full_name}"
end