Sha256: fd3ae6209c0072a3199fdfdc5f1b0861eb3e9369919421622a564c37651637fc

Contents?: true

Size: 1.15 KB

Versions: 13

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true
require_dependency "think_feel_do_engine/application_controller"

module ThinkFeelDoEngine
  module Participants
    # Captures participant use of media.
    class MediaAccessEventsController < ApplicationController
      before_action :authenticate_participant!

      def create
        @media_access_event = current_participant
                              .media_access_events
                              .build(media_access_event_params)

        if @media_access_event.save
          render json: {
            media_access_event_id: @media_access_event.id,
            status: 201
          }
        else
          head :unprocessable_entity
        end
      end

      def update
        @media_access_event = MediaAccessEvent.find(params[:id])

        if @media_access_event.update(media_access_event_params)
          head :ok
        else
          head :unprocessable_entity
        end
      end

      private

      def media_access_event_params
        params.require(:media_access_event)
              .permit([:media_type, :bit_core_slide_id, :media_link, :end_time,
                       :id])
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
think_feel_do_engine-3.22.9 app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb
think_feel_do_engine-3.22.8 app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb
think_feel_do_engine-3.22.7 app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb
think_feel_do_engine-3.22.6 app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb
think_feel_do_engine-3.22.5 app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb
think_feel_do_engine-3.22.4 app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb
think_feel_do_engine-3.22.2 app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb
think_feel_do_engine-3.22.1 app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb
think_feel_do_engine-3.22.0 app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb
think_feel_do_engine-3.21.2 app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb
think_feel_do_engine-3.21.1 app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb
think_feel_do_engine-3.21.0 app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb
think_feel_do_engine-3.20.1 app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb