Class: ConvertCourses

Inherits:
Object
  • Object
show all
Includes:
Interpipe::Interactor
Defined in:
app/interactors/convert_courses.rb

Instance Method Summary collapse

Methods included from Interpipe::Interactor

included, #initialize, #setup

Instance Method Details

#convert_course(course_link) ⇒ Object


15
16
17
18
# File 'app/interactors/convert_courses.rb', line 15

def convert_course(course_link)
  course_code = course_link.link_id
  Course.new(name: Sequel.hstore({cs: course_link.link_title})) { |c| c.id = course_code }
end

#perform(kosapi_courses:, **opts) ⇒ Object


7
8
9
# File 'app/interactors/convert_courses.rb', line 7

def perform(kosapi_courses:, **opts)
  @courses = kosapi_courses.map { |course| convert_course(course) }
end

#resultsObject


11
12
13
# File 'app/interactors/convert_courses.rb', line 11

def results
  { courses: @courses }
end