Class: ActiveInTime::Timetable
- Inherits:
-
Object
- Object
- ActiveInTime::Timetable
- Defined in:
- lib/ait_connect/timetable.rb
Instance Attribute Summary collapse
-
#json ⇒ Object
readonly
Returns the value of attribute json.
Instance Method Summary collapse
- #facilities ⇒ Object
- #fetch ⇒ Object
- #id ⇒ Object
-
#initialize(active_in_time, json) ⇒ Timetable
constructor
A new instance of Timetable.
- #name ⇒ Object
- #timetable_entries(options = {}) ⇒ Object
- #timetable_sessions ⇒ Object
Constructor Details
#initialize(active_in_time, json) ⇒ Timetable
Returns a new instance of Timetable.
5 6 7 |
# File 'lib/ait_connect/timetable.rb', line 5 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.
3 4 5 |
# File 'lib/ait_connect/timetable.rb', line 3 def json @json end |
Instance Method Details
#facilities ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/ait_connect/timetable.rb', line 22 def facilities return [] if !@json["facilities"] || @json["facilities"].empty? facilities = [] json['facilities'].each do |facility| facilities << ActiveInTime::Facility.new(@active_in_time, facility) end facilities end |
#fetch ⇒ Object
9 10 11 12 |
# File 'lib/ait_connect/timetable.rb', line 9 def fetch @json = @active_in_time.get("timetables/#{id}")["timetable"] self end |
#id ⇒ Object
14 15 16 |
# File 'lib/ait_connect/timetable.rb', line 14 def id @json["id"] end |
#name ⇒ Object
18 19 20 |
# File 'lib/ait_connect/timetable.rb', line 18 def name @json["name"] end |
#timetable_entries(options = {}) ⇒ Object
42 43 44 |
# File 'lib/ait_connect/timetable.rb', line 42 def ( = {}) @active_in_time..find(self.id,) end |
#timetable_sessions ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/ait_connect/timetable.rb', line 32 def return [] if !@json["timetable_sessions"] || @json["timetable_sessions"].empty? = [] json['timetable_sessions'].each do |facility| << ActiveInTime::TimetableSession.new(@active_in_time, facility) end end |