Sha256: 6f1e49ace096917310f86454f40c5d45622b678e926fd7f4eb1cebb79c367ea3

Contents?: true

Size: 532 Bytes

Versions: 2

Compression:

Stored size: 532 Bytes

Contents

module Signum
  class SignalController < ApiController
    def show
      signal = Signum::Signal.find(signal_params[:id])
      signal.show! if signal.broadcasted?
      head :ok
    end

    def close
      signal = Signum::Signal.find(signal_params[:id])
      signal.close!
      head :ok
    end

    def close_all
      signals = current_user.signals.where.not(state: "closed")
      signals.each(&:close!)
      head :ok
    end

    private

    def signal_params
      params.require(:signal).permit(:id)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
signum-0.7.1 app/controllers/signum/signal_controller.rb
signum-0.7.0 app/controllers/signum/signal_controller.rb