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
50 51 52 53 |
# File 'app/controllers/api/v2/webhooks_controller.rb', line 50 def create @webhook = Webhook.new(webhook_params) process_response @webhook.save end |
#destroy ⇒ Object
65 66 67 |
# File 'app/controllers/api/v2/webhooks_controller.rb', line 65 def destroy process_response @webhook.destroy end |
#events ⇒ Object
70 71 72 |
# File 'app/controllers/api/v2/webhooks_controller.rb', line 70 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
58 59 60 61 |
# File 'app/controllers/api/v2/webhooks_controller.rb', line 58 def update @webhook = Webhook.find(params[:id]) process_response @webhook.update(webhook_params) end |