Sha256: 7a0b8fe68f182fc7759a0e34565088b1f7d5be45ebd4bca2d9456b7fed898424
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
# # # AUTO GENERATED LIVE EVENT # This was auto generated by the CanvasSync Gem. # You can customize it as needed, but make sure you test # any changes you make to the auto generated methods. # module LiveEvents class CourseEvent < LiveEvents::BaseEvent # The following is provided in the live events call: # { # course_id: course.global_id, # uuid: course.uuid, # account_id: course.global_account_id, # name: course.name, # created_at: course.created_at, # updated_at: course.updated_at, # workflow_state: course.workflow_state # } def perform(event_payload) super attrs = { canvas_course_id: local_canvas_id(payload[:course_id]), canvas_account_id: local_canvas_id(payload[:account_id]), name: payload[:name], status: payload[:workflow_state], } create_or_update(attrs) end private def create_or_update(attrs) course = Course.where(canvas_course_id: attrs[:canvas_course_id]).first_or_initialize course.assign_attributes(attrs) course.save! course end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
canvas_sync-0.10.2 | spec/dummy/app/services/live_events/course_event.rb |
canvas_sync-0.10.0 | spec/dummy/app/services/live_events/course_event.rb |