bullet_train-outgoing_webhooks-api 1.0.0 → 1.0.1
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/version.rb +1 -1
- metadata +4 -4
- 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: 1f12f4c774f39633187ee43d2d8ed5d437b7428c9892bca71615c0389486bba2
|
4
|
+
data.tar.gz: d3b6d4d3d396b3f178dd5063604bf2b59caab9a79049e8abf42b7c28b8ae5974
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cffb2a0de6be090ef2e1647540b141b0b762ed45dafce8d58df124e1e420d130eac7928bf2457ff3e5e60ae4896461af86589d8db19c5e2d70dabed1c7631643
|
7
|
+
data.tar.gz: 1f901519176b74355ac5a84f07b1ae170872df8a3b9c9f2772e549a0d0acd3b470d64a50ad739e910878588e7b51b9717ef051977f273bb376f5318d7e9b95a3
|
@@ -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
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
@@ -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
|
@@ -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
|