Sha256: fbcc41608367eab0c05161cf02424027dfd41839e5f914ac6793f6f23ebdaa1c
Contents?: true
Size: 853 Bytes
Versions: 23
Compression:
Stored size: 853 Bytes
Contents
# <%= autogenerated_event_warning %> module LiveEvents class UserEvent < LiveEvents::BaseEvent # The following is provided in the live events call: # { # user_id: user.global_id, # uuid: user.uuid, # name: user.name, # short_name: user.short_name, # workflow_state: user.workflow_state, # created_at: user.created_at, # updated_at: user.updated_at # } def perform(event_payload) super attrs = { canvas_user_id: local_canvas_id(payload[:user_id]), full_name: payload[:name], status: payload[:workflow_state], } create_or_update(attrs) end private def create_or_update(attrs) user = User.where(canvas_user_id: attrs[:canvas_user_id]).first_or_initialize user.assign_attributes(attrs) user.save! end end end
Version data entries
23 entries across 23 versions & 1 rubygems