Class: ActiveInTime::TimetableEntry
- Inherits:
-
Object
- Object
- ActiveInTime::TimetableEntry
- Defined in:
- lib/ait_connect/timetable_entry.rb
Instance Attribute Summary collapse
-
#json ⇒ Object
readonly
Returns the value of attribute json.
Instance Method Summary collapse
- #cancellation_reason ⇒ Object
- #date ⇒ Object
- #end_time ⇒ Object
- #facility ⇒ Object
-
#id ⇒ Object
def fetch @json = @active_in_time.get(“timetables/##timetable_id/timetable_entries/##id”)[“timetable_entry”] self end.
-
#initialize(active_in_time, json) ⇒ TimetableEntry
constructor
A new instance of TimetableEntry.
- #instructor ⇒ Object
- #is_cancelled ⇒ Object
- #level ⇒ Object
-
#name ⇒ Object
not sure what this is.
- #start_time ⇒ Object
- #term_type ⇒ Object
- #timetable_id ⇒ Object
- #timetable_session ⇒ Object
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
#json ⇒ Object (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_reason ⇒ Object
72 73 74 |
# File 'lib/ait_connect/timetable_entry.rb', line 72 def cancellation_reason @json["cancellation_reason"] end |
#date ⇒ Object
29 30 31 |
# File 'lib/ait_connect/timetable_entry.rb', line 29 def date Date.parse(@json["date"]) end |
#end_time ⇒ Object
25 26 27 |
# File 'lib/ait_connect/timetable_entry.rb', line 25 def end_time Time.zone.parse(@json["end_time"]) end |
#facility ⇒ Object
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 |
#id ⇒ Object
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 |
#instructor ⇒ Object
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_cancelled ⇒ Object
68 69 70 |
# File 'lib/ait_connect/timetable_entry.rb', line 68 def is_cancelled @json["is_cancelled"] end |
#level ⇒ Object
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 |
#name ⇒ Object
not sure what this is.
64 65 66 |
# File 'lib/ait_connect/timetable_entry.rb', line 64 def name @json["name"] end |
#start_time ⇒ Object
21 22 23 |
# File 'lib/ait_connect/timetable_entry.rb', line 21 def start_time Time.zone.parse(@json["start_time"]) end |
#term_type ⇒ Object
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_id ⇒ Object
59 60 61 |
# File 'lib/ait_connect/timetable_entry.rb', line 59 def @json["timetable_id"] end |
#timetable_session ⇒ Object
42 43 44 45 |
# File 'lib/ait_connect/timetable_entry.rb', line 42 def return nil if !@json['timetable_session'] ActiveInTime::TimetableSession.new(@active_in_time,@json['timetable_session']) end |