Class: Barbeque::SnsSubscriptionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Barbeque::SnsSubscriptionsController
- Defined in:
- app/controllers/barbeque/sns_subscriptions_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/barbeque/sns_subscriptions_controller.rb', line 19 def create @sns_subscription = Barbeque::SNSSubscription.new(params.require(:sns_subscription).permit(:topic_arn, :job_queue_id, :job_definition_id)) if Barbeque::SNSSubscriptionService.new.subscribe(@sns_subscription) redirect_to @sns_subscription, notice: 'SNS subscription was successfully created.' else @sns_topic_arns = fetch_sns_topic_arns render :new end end |
#destroy ⇒ Object
38 39 40 41 42 |
# File 'app/controllers/barbeque/sns_subscriptions_controller.rb', line 38 def destroy sns_subscription = Barbeque::SNSSubscription.find(params[:id]) Barbeque::SNSSubscriptionService.new.unsubscribe(sns_subscription) redirect_to sns_subscriptions_path, notice: 'SNS subscription was successfully destroyed.' end |
#edit ⇒ Object
15 16 17 |
# File 'app/controllers/barbeque/sns_subscriptions_controller.rb', line 15 def edit @sns_subscription = Barbeque::SNSSubscription.find(params[:id]) end |
#index ⇒ Object
2 3 4 |
# File 'app/controllers/barbeque/sns_subscriptions_controller.rb', line 2 def index @sns_subscriptions = Barbeque::SNSSubscription.all end |
#new ⇒ Object
10 11 12 13 |
# File 'app/controllers/barbeque/sns_subscriptions_controller.rb', line 10 def new @sns_topic_arns = fetch_sns_topic_arns @sns_subscription = Barbeque::SNSSubscription.new end |
#show ⇒ Object
6 7 8 |
# File 'app/controllers/barbeque/sns_subscriptions_controller.rb', line 6 def show @sns_subscription = Barbeque::SNSSubscription.find(params[:id]) end |
#update ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'app/controllers/barbeque/sns_subscriptions_controller.rb', line 29 def update @sns_subscription = Barbeque::SNSSubscription.find(params[:id]) if @sns_subscription.update(params.require(:sns_subscription).permit(:job_definition_id)) redirect_to @sns_subscription, notice: 'SNS subscription was successfully updated.' else render :edit end end |