Sha256: af9847648b7cd8d63cb92f62717d853f1bdfd2176d6ecf2a7bbb25b3cf40f1af

Contents?: true

Size: 1.61 KB

Versions: 13

Compression:

Stored size: 1.61 KB

Contents

module Api::V1::Webhooks::Outgoing::Endpoints::ControllerBase
  extend ActiveSupport::Concern

  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,
        :api_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

  included do
    account_load_and_authorize_resource :endpoint,
      through: BulletTrain::OutgoingWebhooks.parent_association,
      through_association: :webhooks_outgoing_endpoints

    private

    include StrongParameters
  end

  # 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
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
bullet_train-outgoing_webhooks-1.17.1 app/controllers/concerns/api/v1/webhooks/outgoing/endpoints/controller_base.rb
bullet_train-outgoing_webhooks-1.17.0 app/controllers/concerns/api/v1/webhooks/outgoing/endpoints/controller_base.rb
bullet_train-outgoing_webhooks-1.16.0 app/controllers/concerns/api/v1/webhooks/outgoing/endpoints/controller_base.rb
bullet_train-outgoing_webhooks-1.15.0 app/controllers/concerns/api/v1/webhooks/outgoing/endpoints/controller_base.rb
bullet_train-outgoing_webhooks-1.14.2 app/controllers/concerns/api/v1/webhooks/outgoing/endpoints/controller_base.rb
bullet_train-outgoing_webhooks-1.14.1 app/controllers/concerns/api/v1/webhooks/outgoing/endpoints/controller_base.rb
bullet_train-outgoing_webhooks-1.14.0 app/controllers/concerns/api/v1/webhooks/outgoing/endpoints/controller_base.rb
bullet_train-outgoing_webhooks-1.13.0 app/controllers/concerns/api/v1/webhooks/outgoing/endpoints/controller_base.rb
bullet_train-outgoing_webhooks-1.12.3 app/controllers/concerns/api/v1/webhooks/outgoing/endpoints/controller_base.rb
bullet_train-outgoing_webhooks-1.12.2 app/controllers/concerns/api/v1/webhooks/outgoing/endpoints/controller_base.rb
bullet_train-outgoing_webhooks-1.12.1 app/controllers/concerns/api/v1/webhooks/outgoing/endpoints/controller_base.rb
bullet_train-outgoing_webhooks-1.12.0 app/controllers/concerns/api/v1/webhooks/outgoing/endpoints/controller_base.rb
bullet_train-outgoing_webhooks-1.11.0 app/controllers/concerns/api/v1/webhooks/outgoing/endpoints/controller_base.rb