Module: CanvasSync::Concerns::LiveEventSync

Extended by:
ActiveSupport::Concern
Defined in:
lib/canvas_sync/concerns/live_event_sync.rb

Instance Method Summary collapse

Instance Method Details

#process_live_event(event_type, payload, metadata) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/canvas_sync/concerns/live_event_sync.rb', line 27

def process_live_event(event_type, payload, )
  if self.has_attribute?(:workflow_state) && payload['workflow_state'].present? && payload['workflow_state'] == 'deleted'
    # API will respond with 404, so just update the workflow_state
    update(workflow_state: payload['workflow_state'])
  else
    api_response = request_from_api
    assign_from_api_params(api_response)
  end
end