Sha256: ad3adcdc523c98586ccf1f0f4f8be13b541fd539d415c868ea74d4e28dcc91cf

Contents?: true

Size: 532 Bytes

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
signum-0.6.0 app/controllers/signum/signal_controller.rb