Class: Api::V2::WebhooksController
- Inherits:
-
V2::BaseController
- Object
- V2::BaseController
- Api::V2::WebhooksController
- Includes:
- Api::Version2, ForemanWebhooks::Controller::Parameters::Webhook
- Defined in:
- app/controllers/api/v2/webhooks_controller.rb
Instance Method Summary collapse
Methods included from ForemanWebhooks::Controller::Parameters::Webhook
Instance Method Details
#create ⇒ Object
44 45 46 47 |
# File 'app/controllers/api/v2/webhooks_controller.rb', line 44 def create @webhook = Webhook.new(webhook_params) process_response @webhook.save end |
#destroy ⇒ Object
59 60 61 |
# File 'app/controllers/api/v2/webhooks_controller.rb', line 59 def destroy process_response @webhook.destroy end |
#events ⇒ Object
64 65 66 |
# File 'app/controllers/api/v2/webhooks_controller.rb', line 64 def events render json: Webhook.available_events.sort.map { |e| e.delete_suffix(Webhook::EVENT_POSTFIX) }.to_json end |
#index ⇒ Object
14 15 16 |
# File 'app/controllers/api/v2/webhooks_controller.rb', line 14 def index @webhooks = resource_scope_for_index end |
#show ⇒ Object
20 |
# File 'app/controllers/api/v2/webhooks_controller.rb', line 20 def show; end |
#update ⇒ Object
52 53 54 55 |
# File 'app/controllers/api/v2/webhooks_controller.rb', line 52 def update @webhook = Webhook.find(params[:id]) process_response @webhook.update(webhook_params) end |