Class: Fosm::Admin::WebhooksController

Inherits:
BaseController show all
Defined in:
app/controllers/fosm/admin/webhooks_controller.rb

Instance Method Summary collapse

Methods inherited from Fosm::ApplicationController

use_host_routes!

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
# File 'app/controllers/fosm/admin/webhooks_controller.rb', line 14

def create
  @webhook = Fosm::WebhookSubscription.new(webhook_params)
  if @webhook.save
    redirect_to fosm.admin_webhooks_path, notice: "Webhook created successfully."
  else
    @apps = Fosm::Registry.all
    render :new, status: :unprocessable_entity
  end
end

#destroyObject



24
25
26
27
28
# File 'app/controllers/fosm/admin/webhooks_controller.rb', line 24

def destroy
  @webhook = Fosm::WebhookSubscription.find(params[:id])
  @webhook.destroy
  redirect_to fosm.admin_webhooks_path, notice: "Webhook removed."
end

#indexObject



4
5
6
7
# File 'app/controllers/fosm/admin/webhooks_controller.rb', line 4

def index
  @webhooks = Fosm::WebhookSubscription.all.order(:model_class_name, :event_name)
  @apps = Fosm::Registry.all
end

#newObject



9
10
11
12
# File 'app/controllers/fosm/admin/webhooks_controller.rb', line 9

def new
  @webhook = Fosm::WebhookSubscription.new
  @apps = Fosm::Registry.all
end