Class: Spree::Admin::BoltWebhooksController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/admin/bolt_webhooks_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/spree/admin/bolt_webhooks_controller.rb', line 8

def create
  response = SolidusBolt::Webhooks::CreateService.call(
    event: bolt_webhook_params[:event],
    url: bolt_webhook_params[:webhook_url]
  )
  flash[:success] = "Successfully created webhook. Webhook ID #{response['webhook_id']}"

  render :new
rescue SolidusBolt::ServerError => e
  flash[:error] = e.message

  render :new
end

#newObject



6
# File 'app/controllers/spree/admin/bolt_webhooks_controller.rb', line 6

def new; end