bullet_train-outgoing_webhooks 1.10.0 → 1.12.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: 21d30806d58353b6cd0e09e88a7199f87c829f1d7647bf717554c1f45758e7d8
4
+ data.tar.gz: d92f03ab9fe51209f002c915c82c957e0c160464abff2a287fc917b2d704062b
5
5
  SHA512:
6
- metadata.gz: da7980542b5203eefbebfab4a0bcaa3888ebc7c01e0427d2e6b8ba8ebbd412e34e24f2ea07bc6b85a7de1e61a453cd1bb88aad11455c230b3aab1385ca42ea66
7
- data.tar.gz: adadb0105180a5cdb5c3802955cabbedd13ca2ef6cc3f89c051cdc92111faa03b18bd525f64ad17f84251b44ee9929653e35634721a291f33685f7a4e406bce6
6
+ metadata.gz: 7d1b0ca9902a08bb7261887cea4c5480093d2f2fa82e332d5ef2b19ab9786c0e4f7cb06a68dc42fa0fa70bc90f0d8c689992681ea8bd78c306f7d43812d0b1a6
7
+ data.tar.gz: a161c88c6b676a271badf009490d3abe68fdc7abbdc3ab9f6fbc71180d09737614e2c6b56ba64d71cd57f4e4961c31a236c694f705f48f9890d839420bdc3de0
@@ -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.12.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.12.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-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: simplecov
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rails
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -86,6 +100,8 @@ files:
86
100
  - app/controllers/api/v1/webhooks/outgoing.rb
87
101
  - app/controllers/api/v1/webhooks/outgoing/endpoints_controller.rb
88
102
  - app/controllers/api/v1/webhooks/outgoing/events_controller.rb
103
+ - app/controllers/concerns/api/v1/webhooks/outgoing/endpoints/controller_base.rb
104
+ - app/controllers/concerns/api/v1/webhooks/outgoing/events/controller_base.rb
89
105
  - app/jobs/webhooks/outgoing/delivery_job.rb
90
106
  - app/jobs/webhooks/outgoing/generate_job.rb
91
107
  - app/models/concerns/webhooks/outgoing/delivery_attempt_support.rb