Sha256: 4f3aafd8228331e13629525cbad6c4b12236c74f91d995fb5b9c300ce0f3345d

Contents?: true

Size: 1.67 KB

Versions: 6

Compression:

Stored size: 1.67 KB

Contents

class Api::V1::Webhooks::Outgoing::DeliveriesEndpoint < Api::V1::Root
  helpers do
    params :endpoint_id do
      requires :endpoint_id, type: Integer, allow_blank: false, desc: "Endpoint ID"
    end

    params :id do
      requires :id, type: Integer, allow_blank: false, desc: "Delivery ID"
    end

    params :delivery do
      optional :event_id, type: String, desc: Api.heading(:event_id)
      optional :endpoint_url, type: String, desc: Api.heading(:endpoint_url)
      optional :delivered_at, type: DateTime, desc: Api.heading(:delivered_at)
      # 🚅 super scaffolding will insert new fields above this line.
      # 🚅 super scaffolding will insert new arrays above this line.

      # 🚅 super scaffolding will insert processing for new fields above this line.
    end
  end

  resource "webhooks/outgoing/endpoints", desc: Api.title(:collection_actions) do
    after_validation do
      load_and_authorize_api_resource Webhooks::Outgoing::Delivery
    end

    #
    # INDEX
    #

    desc Api.title(:index), &Api.index_desc
    params do
      use :endpoint_id
    end
    oauth2
    paginate per_page: 100
    get "/:endpoint_id/deliveries" do
      @paginated_deliveries = paginate @deliveries
      render @paginated_deliveries, serializer: Api.serializer
    end
  end

  resource "webhooks/outgoing/deliveries", desc: Api.title(:member_actions) do
    after_validation do
      load_and_authorize_api_resource Webhooks::Outgoing::Delivery
    end

    #
    # SHOW
    #

    desc Api.title(:show), &Api.show_desc
    params do
      use :id
    end
    oauth2
    route_param :id do
      get do
        render @delivery, serializer: Api.serializer
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
bullet_train-outgoing_webhooks-1.0.5 app/controllers/api/v1/webhooks/outgoing/deliveries_endpoint.rb
bullet_train-outgoing_webhooks-1.0.4 app/controllers/api/v1/webhooks/outgoing/deliveries_endpoint.rb
bullet_train-outgoing_webhooks-api-1.0.4 app/controllers/api/v1/webhooks/outgoing/deliveries_endpoint.rb
bullet_train-outgoing_webhooks-api-1.0.3 app/controllers/api/v1/webhooks/outgoing/deliveries_endpoint.rb
bullet_train-outgoing_webhooks-api-1.0.2 app/controllers/api/v1/webhooks/outgoing/deliveries_endpoint.rb
bullet_train-outgoing_webhooks-api-1.0.1 app/controllers/api/v1/webhooks/outgoing/deliveries_endpoint.rb