Module: Metova::WebhooksBase

Extended by:
ActiveSupport::Concern
Defined in:
lib/metova/webhooks/controllers/webhooks_base.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
# File 'lib/metova/webhooks/controllers/webhooks_base.rb', line 8

def create
  @webhook = Metova::Webhook.new permitted_params.merge(user: current_user)
  if block_given?
    yield @webhook
  end
  @webhook.save if @webhook.errors.empty?
  respond_with @webhook, location: nil
end

#destroyObject



17
18
19
20
21
# File 'lib/metova/webhooks/controllers/webhooks_base.rb', line 17

def destroy
  @webhook = Metova::Webhook.where(user: current_user).find(params[:id])
  @webhook.destroy
  respond_with @webhook
end

#indexObject



4
5
6
# File 'lib/metova/webhooks/controllers/webhooks_base.rb', line 4

def index
  respond_with Metova::Webhook.where(user: current_user)
end