bullet_train-outgoing_webhooks-api 1.0.0 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v1/webhooks/outgoing/deliveries_endpoint.rb +63 -0
- data/app/controllers/api/v1/webhooks/outgoing/delivery_attempts_endpoint.rb +65 -0
- data/app/controllers/api/v1/webhooks/outgoing/endpoints_endpoint.rb +119 -0
- data/lib/bullet_train/outgoing_webhooks/api/engine.rb +7 -0
- data/lib/bullet_train/outgoing_webhooks/api/version.rb +1 -1
- metadata +7 -7
- data/app/serializers/api/v1/webhooks/outgoing/delivery_attempt_serializer.rb +0 -16
- data/app/serializers/api/v1/webhooks/outgoing/delivery_serializer.rb +0 -14
- data/app/serializers/api/v1/webhooks/outgoing/endpoint_serializer.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d1dcf8e1fa9328862e8cf38e8522825b823dd03407b47c142e90223d655565c
|
4
|
+
data.tar.gz: d44193115033570f9a06400f54ab7fe79ad2d4c6863ad51f1cf1eaefe3dcf687
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37d66efb78e4d82291a8b7e856a214b4ceeac7a7c5c4ab5238125efaa5c2290763ed840c4225140e276fc883d8f9b05bba2b9c3f8335cf93c2bfd4596484a61b
|
7
|
+
data.tar.gz: da7d83075169233051b0e3d28e4420a8f77d57f674b5265a4ad0078db439f47765bc0f4277c2e640078c6801e15fe38be7a11696e517724f565aaf269cf519b1
|
@@ -0,0 +1,63 @@
|
|
1
|
+
class Api::V1::Webhooks::Outgoing::DeliveriesEndpoint < Api::V1::Root
|
2
|
+
helpers do
|
3
|
+
params :endpoint_id do
|
4
|
+
requires :endpoint_id, type: Integer, allow_blank: false, desc: "Endpoint ID"
|
5
|
+
end
|
6
|
+
|
7
|
+
params :id do
|
8
|
+
requires :id, type: Integer, allow_blank: false, desc: "Delivery ID"
|
9
|
+
end
|
10
|
+
|
11
|
+
params :delivery do
|
12
|
+
optional :event_id, type: String, desc: Api.heading(:event_id)
|
13
|
+
optional :endpoint_url, type: String, desc: Api.heading(:endpoint_url)
|
14
|
+
optional :delivered_at, type: DateTime, desc: Api.heading(:delivered_at)
|
15
|
+
# 🚅 super scaffolding will insert new fields above this line.
|
16
|
+
# 🚅 super scaffolding will insert new arrays above this line.
|
17
|
+
|
18
|
+
# 🚅 super scaffolding will insert processing for new fields above this line.
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
resource "webhooks/outgoing/endpoints", desc: Api.title(:collection_actions) do
|
23
|
+
after_validation do
|
24
|
+
load_and_authorize_api_resource Webhooks::Outgoing::Delivery
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# INDEX
|
29
|
+
#
|
30
|
+
|
31
|
+
desc Api.title(:index), &Api.index_desc
|
32
|
+
params do
|
33
|
+
use :endpoint_id
|
34
|
+
end
|
35
|
+
oauth2
|
36
|
+
paginate per_page: 100
|
37
|
+
get "/:endpoint_id/deliveries" do
|
38
|
+
@paginated_deliveries = paginate @deliveries
|
39
|
+
render @paginated_deliveries, serializer: Api.serializer
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
resource "webhooks/outgoing/deliveries", desc: Api.title(:member_actions) do
|
44
|
+
after_validation do
|
45
|
+
load_and_authorize_api_resource Webhooks::Outgoing::Delivery
|
46
|
+
end
|
47
|
+
|
48
|
+
#
|
49
|
+
# SHOW
|
50
|
+
#
|
51
|
+
|
52
|
+
desc Api.title(:show), &Api.show_desc
|
53
|
+
params do
|
54
|
+
use :id
|
55
|
+
end
|
56
|
+
oauth2
|
57
|
+
route_param :id do
|
58
|
+
get do
|
59
|
+
render @delivery, serializer: Api.serializer
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
class Api::V1::Webhooks::Outgoing::DeliveryAttemptsEndpoint < Api::V1::Root
|
2
|
+
helpers do
|
3
|
+
params :delivery_id do
|
4
|
+
requires :delivery_id, type: Integer, allow_blank: false, desc: "Delivery ID"
|
5
|
+
end
|
6
|
+
|
7
|
+
params :id do
|
8
|
+
requires :id, type: Integer, allow_blank: false, desc: "Delivery Attempt ID"
|
9
|
+
end
|
10
|
+
|
11
|
+
params :delivery_attempt do
|
12
|
+
optional :response_code, type: String, desc: Api.heading(:response_code)
|
13
|
+
optional :response_body, type: String, desc: Api.heading(:response_body)
|
14
|
+
optional :response_message, type: String, desc: Api.heading(:response_message)
|
15
|
+
optional :error_message, type: String, desc: Api.heading(:error_message)
|
16
|
+
optional :attempt_number, type: String, desc: Api.heading(:attempt_number)
|
17
|
+
# 🚅 super scaffolding will insert new fields above this line.
|
18
|
+
# 🚅 super scaffolding will insert new arrays above this line.
|
19
|
+
|
20
|
+
# 🚅 super scaffolding will insert processing for new fields above this line.
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
resource "webhooks/outgoing/deliveries", desc: Api.title(:collection_actions) do
|
25
|
+
after_validation do
|
26
|
+
load_and_authorize_api_resource Webhooks::Outgoing::DeliveryAttempt
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
# INDEX
|
31
|
+
#
|
32
|
+
|
33
|
+
desc Api.title(:index), &Api.index_desc
|
34
|
+
params do
|
35
|
+
use :delivery_id
|
36
|
+
end
|
37
|
+
oauth2
|
38
|
+
paginate per_page: 100
|
39
|
+
get "/:delivery_id/delivery_attempts" do
|
40
|
+
@paginated_delivery_attempts = paginate @delivery_attempts
|
41
|
+
render @paginated_delivery_attempts, serializer: Api.serializer
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
resource "webhooks/outgoing/delivery_attempts", desc: Api.title(:member_actions) do
|
46
|
+
after_validation do
|
47
|
+
load_and_authorize_api_resource Webhooks::Outgoing::DeliveryAttempt
|
48
|
+
end
|
49
|
+
|
50
|
+
#
|
51
|
+
# SHOW
|
52
|
+
#
|
53
|
+
|
54
|
+
desc Api.title(:show), &Api.show_desc
|
55
|
+
params do
|
56
|
+
use :id
|
57
|
+
end
|
58
|
+
oauth2
|
59
|
+
route_param :id do
|
60
|
+
get do
|
61
|
+
render @delivery_attempt, serializer: Api.serializer
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
class Api::V1::Webhooks::Outgoing::EndpointsEndpoint < Api::V1::Root
|
2
|
+
helpers do
|
3
|
+
params :team_id do
|
4
|
+
requires :team_id, type: Integer, allow_blank: false, desc: "Team ID"
|
5
|
+
end
|
6
|
+
|
7
|
+
params :id do
|
8
|
+
requires :id, type: Integer, allow_blank: false, desc: "Endpoint ID"
|
9
|
+
end
|
10
|
+
|
11
|
+
params :endpoint do
|
12
|
+
optional :name, type: String, desc: Api.heading(:name)
|
13
|
+
optional :url, type: String, desc: Api.heading(:url)
|
14
|
+
# 🚅 super scaffolding will insert new fields above this line.
|
15
|
+
optional :event_type_ids, type: Array, desc: Api.heading(:event_type_ids)
|
16
|
+
# 🚅 super scaffolding will insert new arrays above this line.
|
17
|
+
|
18
|
+
# 🚅 super scaffolding will insert processing for new fields above this line.
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
resource "teams", desc: Api.title(:collection_actions) do
|
23
|
+
after_validation do
|
24
|
+
load_and_authorize_api_resource Webhooks::Outgoing::Endpoint
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# INDEX
|
29
|
+
#
|
30
|
+
|
31
|
+
desc Api.title(:index), &Api.index_desc
|
32
|
+
params do
|
33
|
+
use :team_id
|
34
|
+
end
|
35
|
+
oauth2
|
36
|
+
paginate per_page: 100
|
37
|
+
get "/:team_id/webhooks/outgoing/endpoints" do
|
38
|
+
@paginated_endpoints = paginate @endpoints
|
39
|
+
render @paginated_endpoints, serializer: Api.serializer
|
40
|
+
end
|
41
|
+
|
42
|
+
#
|
43
|
+
# CREATE
|
44
|
+
#
|
45
|
+
|
46
|
+
desc Api.title(:create), &Api.create_desc
|
47
|
+
params do
|
48
|
+
use :team_id
|
49
|
+
use :endpoint
|
50
|
+
end
|
51
|
+
route_setting :api_resource_options, permission: :create
|
52
|
+
oauth2 "write"
|
53
|
+
post "/:team_id/webhooks/outgoing/endpoints" do
|
54
|
+
if @endpoint.save
|
55
|
+
render @endpoint, serializer: Api.serializer
|
56
|
+
else
|
57
|
+
record_not_saved @endpoint
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
resource "webhooks/outgoing/endpoints", desc: Api.title(:member_actions) do
|
63
|
+
after_validation do
|
64
|
+
load_and_authorize_api_resource Webhooks::Outgoing::Endpoint
|
65
|
+
end
|
66
|
+
|
67
|
+
#
|
68
|
+
# SHOW
|
69
|
+
#
|
70
|
+
|
71
|
+
desc Api.title(:show), &Api.show_desc
|
72
|
+
params do
|
73
|
+
use :id
|
74
|
+
end
|
75
|
+
oauth2
|
76
|
+
route_param :id do
|
77
|
+
get do
|
78
|
+
render @endpoint, serializer: Api.serializer
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
#
|
83
|
+
# UPDATE
|
84
|
+
#
|
85
|
+
|
86
|
+
desc Api.title(:update), &Api.update_desc
|
87
|
+
params do
|
88
|
+
use :id
|
89
|
+
use :endpoint
|
90
|
+
end
|
91
|
+
route_setting :api_resource_options, permission: :update
|
92
|
+
oauth2 "write"
|
93
|
+
route_param :id do
|
94
|
+
put do
|
95
|
+
if @endpoint.update(declared(params, include_missing: false))
|
96
|
+
render @endpoint, serializer: Api.serializer
|
97
|
+
else
|
98
|
+
record_not_saved @endpoint
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
#
|
104
|
+
# DESTROY
|
105
|
+
#
|
106
|
+
|
107
|
+
desc Api.title(:destroy), &Api.destroy_desc
|
108
|
+
params do
|
109
|
+
use :id
|
110
|
+
end
|
111
|
+
route_setting :api_resource_options, permission: :destroy
|
112
|
+
oauth2 "delete"
|
113
|
+
route_param :id do
|
114
|
+
delete do
|
115
|
+
render @endpoint.destroy, serializer: Api.serializer
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -2,6 +2,13 @@ module BulletTrain
|
|
2
2
|
module OutgoingWebhooks
|
3
3
|
module Api
|
4
4
|
class Engine < ::Rails::Engine
|
5
|
+
initializer "bullet_train.outgoing_webhooks.register_api_endpoints" do |app|
|
6
|
+
if BulletTrain::Api
|
7
|
+
BulletTrain::Api.endpoints << "Api::V1::Webhooks::Outgoing::EndpointsEndpoint"
|
8
|
+
BulletTrain::Api.endpoints << "Api::V1::Webhooks::Outgoing::DeliveriesEndpoint"
|
9
|
+
BulletTrain::Api.endpoints << "Api::V1::Webhooks::Outgoing::DeliveryAttemptsEndpoint"
|
10
|
+
end
|
11
|
+
end
|
5
12
|
end
|
6
13
|
end
|
7
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train-outgoing_webhooks-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 7.0.0
|
27
|
-
description: Bullet Train Outgoing Webhooks
|
27
|
+
description: Bullet Train Outgoing Webhooks API
|
28
28
|
email:
|
29
29
|
- andrew.culver@gmail.com
|
30
30
|
executables: []
|
@@ -35,9 +35,9 @@ files:
|
|
35
35
|
- README.md
|
36
36
|
- Rakefile
|
37
37
|
- app/assets/config/bullet_train_outgoing_webhooks_api_manifest.js
|
38
|
-
- app/
|
39
|
-
- app/
|
40
|
-
- app/
|
38
|
+
- app/controllers/api/v1/webhooks/outgoing/deliveries_endpoint.rb
|
39
|
+
- app/controllers/api/v1/webhooks/outgoing/delivery_attempts_endpoint.rb
|
40
|
+
- app/controllers/api/v1/webhooks/outgoing/endpoints_endpoint.rb
|
41
41
|
- config/routes.rb
|
42
42
|
- lib/bullet_train/outgoing_webhooks/api.rb
|
43
43
|
- lib/bullet_train/outgoing_webhooks/api/engine.rb
|
@@ -67,5 +67,5 @@ requirements: []
|
|
67
67
|
rubygems_version: 3.2.22
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
|
-
summary: Bullet Train Outgoing Webhooks
|
70
|
+
summary: Bullet Train Outgoing Webhooks API
|
71
71
|
test_files: []
|
@@ -1,16 +0,0 @@
|
|
1
|
-
class Api::V1::Webhooks::Outgoing::DeliveryAttemptSerializer < Api::V1::ApplicationSerializer
|
2
|
-
set_type "webhooks/outgoing/delivery_attempt"
|
3
|
-
|
4
|
-
attributes :id,
|
5
|
-
:delivery_id,
|
6
|
-
:response_code,
|
7
|
-
:response_body,
|
8
|
-
:response_message,
|
9
|
-
:error_message,
|
10
|
-
:attempt_number,
|
11
|
-
# 🚅 super scaffolding will insert new fields above this line.
|
12
|
-
:created_at,
|
13
|
-
:updated_at
|
14
|
-
|
15
|
-
belongs_to :delivery, serializer: Api::V1::Webhooks::Outgoing::DeliverySerializer
|
16
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
class Api::V1::Webhooks::Outgoing::DeliverySerializer < Api::V1::ApplicationSerializer
|
2
|
-
set_type "webhooks/outgoing/delivery"
|
3
|
-
|
4
|
-
attributes :id,
|
5
|
-
:endpoint_id,
|
6
|
-
:event_id,
|
7
|
-
:endpoint_url,
|
8
|
-
:delivered_at,
|
9
|
-
# 🚅 super scaffolding will insert new fields above this line.
|
10
|
-
:created_at,
|
11
|
-
:updated_at
|
12
|
-
|
13
|
-
belongs_to :endpoint, serializer: Api::V1::Webhooks::Outgoing::EndpointSerializer
|
14
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
class Api::V1::Webhooks::Outgoing::EndpointSerializer < Api::V1::ApplicationSerializer
|
2
|
-
set_type "webhooks/outgoing/endpoint"
|
3
|
-
|
4
|
-
attributes :id,
|
5
|
-
:team_id,
|
6
|
-
:name,
|
7
|
-
:url,
|
8
|
-
:event_type_ids,
|
9
|
-
# 🚅 super scaffolding will insert new fields above this line.
|
10
|
-
:created_at,
|
11
|
-
:updated_at
|
12
|
-
|
13
|
-
belongs_to :team, serializer: Api::V1::TeamSerializer
|
14
|
-
end
|