Sha256: d0692ef65bf1ca49e84feb7b5c4dedc9862b06393cb81ebf0007fe7f63dcb44d

Contents?: true

Size: 524 Bytes

Versions: 190

Compression:

Stored size: 524 Bytes

Contents

# frozen_string_literal: true

module Motor
  class SendAlertsController < ApiBaseController
    wrap_parameters :data

    before_action :build_alert, only: :create
    authorize_resource :alert, only: :create

    def create
      AlertsMailer.alert_email(@alert).deliver_now!

      head :ok
    end

    private

    def build_alert
      @alert = Motor::Alerts::Persistance.build_from_params(alert_params)
    end

    def alert_params
      params.require(:data).permit(:query_id, :name, :to_emails)
    end
  end
end

Version data entries

190 entries across 190 versions & 2 rubygems

Version Path
motor-admin-0.2.72 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.71 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.70 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.69 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.68 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.67 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.66 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.65 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.64 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.63 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.62 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.61 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.60 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.59 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.58 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.57 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.56 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.55 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.54 app/controllers/motor/send_alerts_controller.rb
motor-admin-0.2.53 app/controllers/motor/send_alerts_controller.rb