bullet_train-outgoing_webhooks 1.10.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f05164f0cc1efa97d9aff7eb8b3155d9757aa1095d2e3685085a8dee53a61f71
4
- data.tar.gz: f60da1db30e0882e710f1fcc289527710e644a870f0cb1d124dac07496aba39b
3
+ metadata.gz: 5fd29a32747a0d977b22af52ff49e34066a8821c3e3c114ed867cf1e8f5e21e2
4
+ data.tar.gz: f4cc860a39f4a2d86b53343c0f4473476308455277c0d29d4b0eb8de0de5346a
5
5
  SHA512:
6
- metadata.gz: da7980542b5203eefbebfab4a0bcaa3888ebc7c01e0427d2e6b8ba8ebbd412e34e24f2ea07bc6b85a7de1e61a453cd1bb88aad11455c230b3aab1385ca42ea66
7
- data.tar.gz: adadb0105180a5cdb5c3802955cabbedd13ca2ef6cc3f89c051cdc92111faa03b18bd525f64ad17f84251b44ee9929653e35634721a291f33685f7a4e406bce6
6
+ metadata.gz: 869d13fa76c4de21099919a9b0349b70f88a58d5b0202aa39e90efe8d6be826150bd4aa1752d021375c1c492d5fa0cf4295bacfa6c338f68db1b0f01752ef926
7
+ data.tar.gz: 9e98e66961f06942bd870b991fc7227c1dc1d2ecd4704c3525772e0af30c734faf9fe0805e7826e4eada846a4892cfeaa1b646d386b0804f1366727d23cc227a
@@ -1,61 +1,3 @@
1
1
  class Api::V1::Webhooks::Outgoing::EndpointsController < Api::V1::ApplicationController
2
- account_load_and_authorize_resource :endpoint,
3
- through: BulletTrain::OutgoingWebhooks.parent_association,
4
- through_association: :webhooks_outgoing_endpoints
5
-
6
- # GET /api/v1/teams/:team_id/webhooks/outgoing/endpoints
7
- def index
8
- end
9
-
10
- # GET /api/v1/webhooks/outgoing/endpoints/:id
11
- def show
12
- end
13
-
14
- # POST /api/v1/teams/:team_id/webhooks/outgoing/endpoints
15
- def create
16
- if @endpoint.save
17
- render :show, status: :created, location: [:api, :v1, @endpoint]
18
- else
19
- render json: @endpoint.errors, status: :unprocessable_entity
20
- end
21
- end
22
-
23
- # PATCH/PUT /api/v1/webhooks/outgoing/endpoints/:id
24
- def update
25
- if @endpoint.update(endpoint_params)
26
- render :show
27
- else
28
- render json: @endpoint.errors, status: :unprocessable_entity
29
- end
30
- end
31
-
32
- # DELETE /api/v1/webhooks/outgoing/endpoints/:id
33
- def destroy
34
- @endpoint.destroy
35
- end
36
-
37
- private
38
-
39
- module StrongParameters
40
- # Only allow a list of trusted parameters through.
41
- def endpoint_params
42
- strong_params = params.require(:webhooks_outgoing_endpoint).permit(
43
- *permitted_fields,
44
- :url,
45
- :name,
46
- :api_version,
47
- :scaffolding_absolutely_abstract_creative_concept_id,
48
- # 🚅 super scaffolding will insert new fields above this line.
49
- *permitted_arrays,
50
- event_type_ids: [],
51
- # 🚅 super scaffolding will insert new arrays above this line.
52
- )
53
-
54
- process_params(strong_params)
55
-
56
- strong_params
57
- end
58
- end
59
-
60
- include StrongParameters
2
+ include Api::V1::Webhooks::Outgoing::Endpoints::ControllerBase
61
3
  end
@@ -1,15 +1,3 @@
1
1
  class Api::V1::Webhooks::Outgoing::EventsController < Api::V1::ApplicationController
2
- account_load_and_authorize_resource :event,
3
- through: BulletTrain::OutgoingWebhooks.parent_association,
4
- through_association: :webhooks_outgoing_events
5
-
6
- # GET /api/v1/teams/:team_id/webhooks/outgoing/events
7
- def index
8
- render json: @events.map(&:payload)
9
- end
10
-
11
- # GET /api/v1/webhooks/outgoing/events/:id
12
- def show
13
- render json: @event.payload
14
- end
2
+ include Api::V1::Webhooks::Outgoing::Events::ControllerBase
15
3
  end
@@ -0,0 +1,65 @@
1
+ module Api::V1::Webhooks::Outgoing::Endpoints::ControllerBase
2
+ extend ActiveSupport::Concern
3
+
4
+ module StrongParameters
5
+ # Only allow a list of trusted parameters through.
6
+ def endpoint_params
7
+ strong_params = params.require(:webhooks_outgoing_endpoint).permit(
8
+ *permitted_fields,
9
+ :url,
10
+ :name,
11
+ :api_version,
12
+ :scaffolding_absolutely_abstract_creative_concept_id,
13
+ # 🚅 super scaffolding will insert new fields above this line.
14
+ *permitted_arrays,
15
+ event_type_ids: [],
16
+ # 🚅 super scaffolding will insert new arrays above this line.
17
+ )
18
+
19
+ process_params(strong_params)
20
+
21
+ strong_params
22
+ end
23
+ end
24
+
25
+ included do
26
+ account_load_and_authorize_resource :endpoint,
27
+ through: BulletTrain::OutgoingWebhooks.parent_association,
28
+ through_association: :webhooks_outgoing_endpoints
29
+
30
+ private
31
+
32
+ include StrongParameters
33
+ end
34
+
35
+ # GET /api/v1/teams/:team_id/webhooks/outgoing/endpoints
36
+ def index
37
+ end
38
+
39
+ # GET /api/v1/webhooks/outgoing/endpoints/:id
40
+ def show
41
+ end
42
+
43
+ # POST /api/v1/teams/:team_id/webhooks/outgoing/endpoints
44
+ def create
45
+ if @endpoint.save
46
+ render :show, status: :created, location: [:api, :v1, @endpoint]
47
+ else
48
+ render json: @endpoint.errors, status: :unprocessable_entity
49
+ end
50
+ end
51
+
52
+ # PATCH/PUT /api/v1/webhooks/outgoing/endpoints/:id
53
+ def update
54
+ if @endpoint.update(endpoint_params)
55
+ render :show
56
+ else
57
+ render json: @endpoint.errors, status: :unprocessable_entity
58
+ end
59
+ end
60
+
61
+ # DELETE /api/v1/webhooks/outgoing/endpoints/:id
62
+ def destroy
63
+ @endpoint.destroy
64
+ end
65
+ end
@@ -0,0 +1,19 @@
1
+ module Api::V1::Webhooks::Outgoing::Events::ControllerBase
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ account_load_and_authorize_resource :event,
6
+ through: BulletTrain::OutgoingWebhooks.parent_association,
7
+ through_association: :webhooks_outgoing_events
8
+ end
9
+
10
+ # GET /api/v1/teams/:team_id/webhooks/outgoing/events
11
+ def index
12
+ render json: @events.map(&:payload)
13
+ end
14
+
15
+ # GET /api/v1/webhooks/outgoing/events/:id
16
+ def show
17
+ render json: @event.payload
18
+ end
19
+ end
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module OutgoingWebhooks
3
- VERSION = "1.10.0"
3
+ VERSION = "1.11.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-outgoing_webhooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-21 00:00:00.000000000 Z
11
+ date: 2024-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -86,6 +86,8 @@ files:
86
86
  - app/controllers/api/v1/webhooks/outgoing.rb
87
87
  - app/controllers/api/v1/webhooks/outgoing/endpoints_controller.rb
88
88
  - app/controllers/api/v1/webhooks/outgoing/events_controller.rb
89
+ - app/controllers/concerns/api/v1/webhooks/outgoing/endpoints/controller_base.rb
90
+ - app/controllers/concerns/api/v1/webhooks/outgoing/events/controller_base.rb
89
91
  - app/jobs/webhooks/outgoing/delivery_job.rb
90
92
  - app/jobs/webhooks/outgoing/generate_job.rb
91
93
  - app/models/concerns/webhooks/outgoing/delivery_attempt_support.rb