Sha256: e7ef156dc47265cbdfec2c6e2ea8bbcf9dd8a6e8d049f35a7a46eaa70c56d1ee

Contents?: true

Size: 1.52 KB

Versions: 7

Compression:

Stored size: 1.52 KB

Contents

class Api::V1::Webhooks::Outgoing::EndpointsController < Api::V1::ApplicationController
  account_load_and_authorize_resource :endpoint, through: :team, through_association: :webhooks_outgoing_endpoints

  # GET /api/v1/teams/:team_id/webhooks/outgoing/endpoints
  def index
  end

  # GET /api/v1/webhooks/outgoing/endpoints/:id
  def show
  end

  # POST /api/v1/teams/:team_id/webhooks/outgoing/endpoints
  def create
    if @endpoint.save
      render :show, status: :created, location: [:api, :v1, @endpoint]
    else
      render json: @endpoint.errors, status: :unprocessable_entity
    end
  end

  # PATCH/PUT /api/v1/webhooks/outgoing/endpoints/:id
  def update
    if @endpoint.update(endpoint_params)
      render :show
    else
      render json: @endpoint.errors, status: :unprocessable_entity
    end
  end

  # DELETE /api/v1/webhooks/outgoing/endpoints/:id
  def destroy
    @endpoint.destroy
  end

  private

  module StrongParameters
    # Only allow a list of trusted parameters through.
    def endpoint_params
      strong_params = params.require(:webhooks_outgoing_endpoint).permit(
        *permitted_fields,
        :url,
        :name,
        :version,
        :scaffolding_absolutely_abstract_creative_concept_id,
        # 🚅 super scaffolding will insert new fields above this line.
        *permitted_arrays,
        event_type_ids: [],
        # 🚅 super scaffolding will insert new arrays above this line.
      )

      process_params(strong_params)

      strong_params
    end
  end

  include StrongParameters
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bullet_train-outgoing_webhooks-1.2.16 app/controllers/api/v1/webhooks/outgoing/endpoints_controller.rb
bullet_train-outgoing_webhooks-1.2.15 app/controllers/api/v1/webhooks/outgoing/endpoints_controller.rb
bullet_train-outgoing_webhooks-1.2.14 app/controllers/api/v1/webhooks/outgoing/endpoints_controller.rb
bullet_train-outgoing_webhooks-1.2.13 app/controllers/api/v1/webhooks/outgoing/endpoints_controller.rb
bullet_train-outgoing_webhooks-1.2.12 app/controllers/api/v1/webhooks/outgoing/endpoints_controller.rb
bullet_train-outgoing_webhooks-1.2.11 app/controllers/api/v1/webhooks/outgoing/endpoints_controller.rb
bullet_train-outgoing_webhooks-1.2.10 app/controllers/api/v1/webhooks/outgoing/endpoints_controller.rb