Class: TeacherTimetableSlotSource

Inherits:
Object
  • Object
show all
Includes:
Celluloid, ETLConsumer, ETLProducer
Defined in:
lib/actors/teacher_timetable_slot_source.rb

Overview

Loads teacher timetable slots from KOSapi.

Instance Method Summary collapse

Methods included from ETLConsumer

#consume_row, #input=, #notify_hungry, #pop_processed_row, #processed_row, #processed_row=, #start!

Methods included from ETLBase

#empty?, #eof_received?, #logger, #mark_empty!, #receive_eof, #unmark_empty!

Methods included from ETLProducer

#buffer_empty?, #buffer_full?, #buffer_pop, #buffer_put, #emit_eof, #emit_row, #output=, #output_hungry?, #output_row, #process_eof, #produce_row, #receive_hungry

Constructor Details

#initialize(input, output, faculty_semester) ⇒ TeacherTimetableSlotSource


12
13
14
15
16
17
# File 'lib/actors/teacher_timetable_slot_source.rb', line 12

def initialize(input, output, faculty_semester)
  self.input = input
  self.output = output
  @faculty_semester = faculty_semester
  @timetable_slots = [].each
end

Instance Method Details

#generate_rowArray(KOSapiClient::Entity::TeacherTimetableSlot, String)


32
33
34
# File 'lib/actors/teacher_timetable_slot_source.rb', line 32

def generate_row
  [@timetable_slots.next, @username]
end

#process_row(username) ⇒ Object

Fetches all TeacherTimetableSlots for a teacher from KOSapi and buffers them for processing by a next pipeline step.


23
24
25
26
27
28
29
# File 'lib/actors/teacher_timetable_slot_source.rb', line 23

def process_row(username)
  logger.debug "Started processing teacher timetable slots for #{username}."
  timetable_slots = fetch_teacher_timetable_slots(username)
  @timetable_slots = timetable_slots.each
  @username = username
  logger.debug "Finished processing teacher timetable slots for #{username}."
end