Class: ActiveInTime::TimetableEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/ait_connect/timetable_entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(active_in_time, json) ⇒ TimetableEntry

Returns a new instance of TimetableEntry.



8
9
10
# File 'lib/ait_connect/timetable_entry.rb', line 8

def initialize(active_in_time, json)
  @active_in_time, @json = active_in_time, json
end

Instance Attribute Details

#jsonObject (readonly)

Returns the value of attribute json.



6
7
8
# File 'lib/ait_connect/timetable_entry.rb', line 6

def json
  @json
end

Instance Method Details

#cancellation_reasonObject



72
73
74
# File 'lib/ait_connect/timetable_entry.rb', line 72

def cancellation_reason
  @json["cancellation_reason"]
end

#dateObject



29
30
31
# File 'lib/ait_connect/timetable_entry.rb', line 29

def date
  Date.parse(@json["date"])
end

#end_timeObject



25
26
27
# File 'lib/ait_connect/timetable_entry.rb', line 25

def end_time
  Time.zone.parse(@json["end_time"])
end

#facilityObject



33
34
35
36
# File 'lib/ait_connect/timetable_entry.rb', line 33

def facility
  return nil if !@json['facility']
  ActiveInTime::Facility.new(@active_in_time,@json['facility'])
end

#idObject

def fetch

  @json = @active_in_time.get("timetables/#{timetable_id}/timetable_entries/#{id}")["timetable_entry"]
  self
end


17
18
19
# File 'lib/ait_connect/timetable_entry.rb', line 17

def id
  @json["id"]
end

#instructorObject



47
48
49
50
# File 'lib/ait_connect/timetable_entry.rb', line 47

def instructor
  return nil if !@json['instructor']
  ActiveInTime::Instructor.new(@active_in_time,@json['instructor'])
end

#is_cancelledObject



68
69
70
# File 'lib/ait_connect/timetable_entry.rb', line 68

def is_cancelled
  @json["is_cancelled"]
end

#levelObject



52
53
54
55
56
# File 'lib/ait_connect/timetable_entry.rb', line 52

def level
  return nil if !@json['level']
  ActiveInTime::Level.new(@active_in_time,@json['level'])
  
end

#nameObject

not sure what this is.



64
65
66
# File 'lib/ait_connect/timetable_entry.rb', line 64

def name
  @json["name"]
end

#start_timeObject



21
22
23
# File 'lib/ait_connect/timetable_entry.rb', line 21

def start_time
  Time.zone.parse(@json["start_time"])
end

#term_typeObject



38
39
40
# File 'lib/ait_connect/timetable_entry.rb', line 38

def term_type
  ActiveInTime::TermType.new(@active_in_time,@json['term_type'])
end

#timetable_idObject



59
60
61
# File 'lib/ait_connect/timetable_entry.rb', line 59

def timetable_id
  @json["timetable_id"]
end

#timetable_sessionObject



42
43
44
45
# File 'lib/ait_connect/timetable_entry.rb', line 42

def timetable_session
  return nil if !@json['timetable_session']
  ActiveInTime::TimetableSession.new(@active_in_time,@json['timetable_session'])
end