bullet_train-outgoing_webhooks 1.0.0 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +11 -26
  4. data/Rakefile +5 -11
  5. data/app/assets/config/bullet_train_outgoing_webhooks_manifest.js +0 -0
  6. data/app/controllers/account/webhooks/outgoing/deliveries_controller.rb +79 -0
  7. data/app/controllers/account/webhooks/outgoing/delivery_attempts_controller.rb +80 -0
  8. data/app/controllers/account/webhooks/outgoing/endpoints_controller.rb +79 -0
  9. data/app/controllers/api/v1/webhooks/outgoing/deliveries_endpoint.rb +63 -0
  10. data/app/controllers/api/v1/webhooks/outgoing/delivery_attempts_endpoint.rb +65 -0
  11. data/app/controllers/api/v1/webhooks/outgoing/endpoints_endpoint.rb +119 -0
  12. data/app/jobs/webhooks/outgoing/delivery_job.rb +7 -0
  13. data/{lib → app}/models/concerns/webhooks/outgoing/issuing_model.rb +6 -14
  14. data/{lib → app}/models/concerns/webhooks/outgoing/team_support.rb +0 -0
  15. data/{lib → app}/models/webhooks/outgoing/delivery.rb +18 -1
  16. data/{lib → app}/models/webhooks/outgoing/delivery_attempt.rb +17 -1
  17. data/{lib → app}/models/webhooks/outgoing/endpoint.rb +15 -5
  18. data/{lib → app}/models/webhooks/outgoing/event.rb +3 -3
  19. data/{lib → app}/models/webhooks/outgoing/event_type.rb +4 -6
  20. data/{lib → app}/models/webhooks/outgoing.rb +0 -3
  21. data/app/models/webhooks.rb +5 -0
  22. data/app/serializers/api/v1/webhooks/outgoing/delivery_attempt_serializer.rb +16 -0
  23. data/app/serializers/api/v1/webhooks/outgoing/delivery_serializer.rb +14 -0
  24. data/app/serializers/api/v1/webhooks/outgoing/endpoint_serializer.rb +14 -0
  25. data/app/views/account/webhooks/outgoing/deliveries/_breadcrumbs.html.erb +8 -0
  26. data/app/views/account/webhooks/outgoing/deliveries/_delivery.json.jbuilder +10 -0
  27. data/app/views/account/webhooks/outgoing/deliveries/_form.html.erb +21 -0
  28. data/app/views/account/webhooks/outgoing/deliveries/_index.html.erb +73 -0
  29. data/app/views/account/webhooks/outgoing/deliveries/_menu_item.html.erb +10 -0
  30. data/app/views/account/webhooks/outgoing/deliveries/_success_indicator.html.erb +7 -0
  31. data/app/views/account/webhooks/outgoing/deliveries/edit.html.erb +12 -0
  32. data/app/views/account/webhooks/outgoing/deliveries/index.html.erb +6 -0
  33. data/app/views/account/webhooks/outgoing/deliveries/index.json.jbuilder +1 -0
  34. data/app/views/account/webhooks/outgoing/deliveries/new.html.erb +12 -0
  35. data/app/views/account/webhooks/outgoing/deliveries/show.html.erb +37 -0
  36. data/app/views/account/webhooks/outgoing/deliveries/show.json.jbuilder +1 -0
  37. data/app/views/account/webhooks/outgoing/delivery_attempts/_breadcrumbs.html.erb +8 -0
  38. data/app/views/account/webhooks/outgoing/delivery_attempts/_delivery_attempt.json.jbuilder +12 -0
  39. data/app/views/account/webhooks/outgoing/delivery_attempts/_form.html.erb +22 -0
  40. data/app/views/account/webhooks/outgoing/delivery_attempts/_index.html.erb +69 -0
  41. data/app/views/account/webhooks/outgoing/delivery_attempts/_menu_item.html.erb +10 -0
  42. data/app/views/account/webhooks/outgoing/delivery_attempts/_success_indicator.html.erb +7 -0
  43. data/app/views/account/webhooks/outgoing/delivery_attempts/edit.html.erb +12 -0
  44. data/app/views/account/webhooks/outgoing/delivery_attempts/index.html.erb +6 -0
  45. data/app/views/account/webhooks/outgoing/delivery_attempts/index.json.jbuilder +1 -0
  46. data/app/views/account/webhooks/outgoing/delivery_attempts/new.html.erb +12 -0
  47. data/app/views/account/webhooks/outgoing/delivery_attempts/show.html.erb +32 -0
  48. data/app/views/account/webhooks/outgoing/delivery_attempts/show.json.jbuilder +1 -0
  49. data/app/views/account/webhooks/outgoing/endpoints/_breadcrumbs.html.erb +8 -0
  50. data/app/views/account/webhooks/outgoing/endpoints/_endpoint.json.jbuilder +10 -0
  51. data/app/views/account/webhooks/outgoing/endpoints/_form.html.erb +21 -0
  52. data/app/views/account/webhooks/outgoing/endpoints/_index.html.erb +62 -0
  53. data/app/views/account/webhooks/outgoing/endpoints/_menu_item.html.erb +10 -0
  54. data/app/views/account/webhooks/outgoing/endpoints/edit.html.erb +12 -0
  55. data/app/views/account/webhooks/outgoing/endpoints/index.html.erb +6 -0
  56. data/app/views/account/webhooks/outgoing/endpoints/index.json.jbuilder +1 -0
  57. data/app/views/account/webhooks/outgoing/endpoints/new.html.erb +12 -0
  58. data/app/views/account/webhooks/outgoing/endpoints/show.html.erb +42 -0
  59. data/app/views/account/webhooks/outgoing/endpoints/show.json.jbuilder +1 -0
  60. data/config/locales/en/webhooks/outgoing/deliveries.en.yml +112 -0
  61. data/config/locales/en/webhooks/outgoing/delivery_attempts.en.yml +122 -0
  62. data/config/locales/en/webhooks/outgoing/endpoints.en.yml +108 -0
  63. data/config/locales/en/webhooks/outgoing/events.en.yml +10 -0
  64. data/config/routes.rb +18 -0
  65. data/db/migrate/20180420013127_create_webhooks_outgoing_endpoints.rb +10 -0
  66. data/db/migrate/20180420013505_create_webhooks_outgoing_endpoint_event_types.rb +10 -0
  67. data/db/migrate/20180420013852_create_webhooks_outgoing_event_types.rb +9 -0
  68. data/db/migrate/20180420014623_create_webhooks_outgoing_events.rb +12 -0
  69. data/db/migrate/20180420021016_create_webhooks_outgoing_deliveries.rb +11 -0
  70. data/db/migrate/20180420022027_add_team_to_webhooks_outgoing_events.rb +5 -0
  71. data/db/migrate/20180420165345_create_webhooks_outgoing_delivery_attempts.rb +11 -0
  72. data/db/migrate/20180420172112_add_error_message_to_webhooks_outgoing_delivery_attempt.rb +6 -0
  73. data/db/migrate/20181012234232_add_name_to_webhooks_outgoing_endpoints.rb +5 -0
  74. data/db/migrate/20181013030208_add_delivered_at_to_webhooks_outgoing_deliveries.rb +5 -0
  75. data/db/migrate/20181013165056_add_uuid_to_webhooks_outgoing_events.rb +5 -0
  76. data/db/migrate/20181013174539_add_payload_to_webhooks_outgoing_events.rb +5 -0
  77. data/db/migrate/20181013192951_add_attempt_number_to_webhooks_outgoing_delivery_attempts.rb +5 -0
  78. data/db/migrate/20210805060451_change_body_to_data_on_webhooks_outgoing_events.rb +5 -0
  79. data/db/migrate/20211126230846_add_event_type_ids_to_webhooks_outgoing_endpoints.rb +5 -0
  80. data/db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb +8 -0
  81. data/db/migrate/20211127013539_remove_event_type_from_webhooks_outgoing_events.rb +5 -0
  82. data/db/migrate/20211127013800_add_new_event_type_id_to_webhooks_outgoing_events.rb +5 -0
  83. data/db/migrate/20211127014001_migrate_event_types_on_webhooks_outgoing_events.rb +10 -0
  84. data/db/migrate/20211127015712_drop_webhooks_outgoing_endpoint_event_types.rb +9 -0
  85. data/db/migrate/20211127015713_drop_webhooks_outgoing_event_types.rb +9 -0
  86. data/lib/bullet_train/outgoing_webhooks/engine.rb +13 -0
  87. data/lib/bullet_train/outgoing_webhooks/version.rb +1 -3
  88. data/lib/bullet_train/outgoing_webhooks.rb +2 -17
  89. data/lib/tasks/bullet_train/outgoing_webhooks_tasks.rake +4 -0
  90. metadata +97 -60
  91. data/.standard.yml +0 -2
  92. data/CHANGELOG.md +0 -5
  93. data/CODE_OF_CONDUCT.md +0 -84
  94. data/Gemfile +0 -12
  95. data/Gemfile.lock +0 -193
  96. data/LICENSE.txt +0 -21
  97. data/bin/console +0 -15
  98. data/bin/setup +0 -8
  99. data/lib/models/concerns/webhooks/outgoing/has_uuid.rb +0 -21
  100. data/lib/models/webhooks.rb +0 -2
  101. data/sig/bullet_train/outgoing_webhooks.rbs +0 -6
@@ -0,0 +1,10 @@
1
+ json.extract! endpoint,
2
+ :id,
3
+ :team_id,
4
+ :name,
5
+ :url,
6
+ :event_type_ids,
7
+ # 🚅 super scaffolding will insert new fields above this line.
8
+ :created_at,
9
+ :updated_at
10
+ json.url account_webhooks_outgoing_endpoint_url(endpoint, format: :json)
@@ -0,0 +1,21 @@
1
+ <%= form_with model: endpoint, url: (endpoint.persisted? ? [:account, endpoint] : [:account, @team, :webhooks_outgoing_endpoints]), local: true, class: 'form' do |form| %>
2
+ <%= render 'account/shared/forms/errors', form: form %>
3
+
4
+ <% with_field_settings form: form do %>
5
+ <%= render 'shared/fields/text_field', method: :name, options: {autofocus: true} %>
6
+ <%= render 'shared/fields/text_field', method: :url %>
7
+ <%= render 'shared/fields/super_select', method: :event_type_ids, html_options: {multiple: true},
8
+ choices: @endpoint.valid_event_types.map { |event_type| [event_type.label_string, event_type.id] } %>
9
+ <%# 🚅 super scaffolding will insert new fields above this line. %>
10
+ <% end %>
11
+
12
+ <div class="buttons">
13
+ <%= form.submit (form.object.persisted? ? t('.buttons.update') : t('.buttons.create')), class: "button" %>
14
+ <% if form.object.persisted? %>
15
+ <%= link_to t('global.buttons.cancel'), [:account, endpoint], class: "button-secondary" %>
16
+ <% else %>
17
+ <%= link_to t('global.buttons.cancel'), [:account, @team, :webhooks_outgoing_endpoints], class: "button-secondary" %>
18
+ <% end %>
19
+ </div>
20
+
21
+ <% end %>
@@ -0,0 +1,62 @@
1
+ <% team = @team || @team %>
2
+ <% context ||= team %>
3
+ <% collection ||= :webhooks_outgoing_endpoints %>
4
+ <% hide_actions ||= false %>
5
+ <% hide_back ||= false %>
6
+
7
+ <%= render 'account/shared/box' do |p| %>
8
+ <% p.content_for :title, t(".contexts.#{context.class.name.underscore}.header") %>
9
+ <% p.content_for :description do %>
10
+ <%= t(".contexts.#{context.class.name.underscore}.description") %>
11
+ <% end %>
12
+
13
+ <% p.content_for :table do %>
14
+ <% if endpoints.any? %>
15
+ <table class="table">
16
+ <thead>
17
+ <tr>
18
+ <th><%= t('.fields.name.heading') %></th>
19
+ <th><%= t('.fields.url.heading') %></th>
20
+ <%# 🚅 super scaffolding will insert new field headers above this line. %>
21
+ <th class="text-right"></th>
22
+ </tr>
23
+ </thead>
24
+ <tbody>
25
+ <% endpoints.each do |endpoint| %>
26
+ <% with_attribute_settings object: endpoint do %>
27
+ <tr data-id="<%= endpoint.id %>">
28
+ <td><%= render 'shared/attributes/text', attribute: :name, url: [:account, endpoint] %></td>
29
+ <td><%= render 'shared/attributes/code', attribute: :url %></td>
30
+ <%# 🚅 super scaffolding will insert new fields above this line. %>
31
+ <td class="buttons">
32
+ <% unless hide_actions %>
33
+ <% if can? :edit, endpoint %>
34
+ <%= link_to t('.buttons.shorthand.edit'), [:edit, :account, endpoint], class: 'button-secondary button-smaller' %>
35
+ <% end %>
36
+ <% if can? :destroy, endpoint %>
37
+ <%= button_to t('.buttons.shorthand.destroy'), [:account, endpoint], method: :delete, data: { confirm: t('.buttons.confirmations.destroy', model_locales(endpoint)) }, class: 'button-secondary button-smaller' %>
38
+ <% end %>
39
+ <% end %>
40
+ </td>
41
+ </tr>
42
+ <% end %>
43
+ <% end %>
44
+ </tbody>
45
+ </table>
46
+ <% end %>
47
+ <% end %>
48
+
49
+ <% p.content_for :actions do %>
50
+ <% unless hide_actions %>
51
+ <% if context == team %>
52
+ <% if can? :create, Webhooks::Outgoing::Endpoint.new(team: team) %>
53
+ <%= link_to t('.buttons.new'), [:new, :account, team, :webhooks_outgoing_endpoint], class: "#{first_button_primary(:webhooks_outgoing_endpoint)} new" %>
54
+ <% end %>
55
+ <% end %>
56
+
57
+ <% unless hide_back %>
58
+ <%= link_to t('global.buttons.back'), [:account, context], class: "#{first_button_primary(:webhooks_outgoing_endpoint)} back" %>
59
+ <% end %>
60
+ <% end %>
61
+ <% end %>
62
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <% if can? :read, Webhooks::Outgoing::Endpoint.new(team: current_team) %>
2
+ <%= render 'account/shared/menu/item', {
3
+ url: main_app.polymorphic_path([:account, current_team, :webhooks_outgoing_endpoints]),
4
+ label: t('webhooks/outgoing/endpoints.navigation.label'),
5
+ } do |p| %>
6
+ <% p.content_for :icon do %>
7
+ <i class="<%= t('webhooks/outgoing/endpoints.navigation.icon') %>"></i>
8
+ <% end %>
9
+ <% end %>
10
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <%= render 'account/shared/page' do |p| %>
2
+ <% p.content_for :title, t('.section') %>
3
+ <% p.content_for :body do %>
4
+ <%= render 'account/shared/box', divider: true do |p| %>
5
+ <% p.content_for :title, t('.header') %>
6
+ <% p.content_for :description, t('.description') %>
7
+ <% p.content_for :body do %>
8
+ <%= render 'form', endpoint: @endpoint %>
9
+ <% end %>
10
+ <% end %>
11
+ <% end %>
12
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <%= render 'account/shared/page' do |p| %>
2
+ <% p.content_for :title, t('.section') %>
3
+ <% p.content_for :body do %>
4
+ <%= render 'index', endpoints: @endpoints %>
5
+ <% end %>
6
+ <% end %>
@@ -0,0 +1 @@
1
+ json.array! @endpoints, partial: "webhooks/outgoing/endpoints/endpoint", as: :endpoint
@@ -0,0 +1,12 @@
1
+ <%= render 'account/shared/page' do |p| %>
2
+ <% p.content_for :title, t('.section') %>
3
+ <% p.content_for :body do %>
4
+ <%= render 'account/shared/box', divider: true do |p| %>
5
+ <% p.content_for :title, t('.header') %>
6
+ <% p.content_for :description, t('.description') %>
7
+ <% p.content_for :body do %>
8
+ <%= render 'form', endpoint: @endpoint %>
9
+ <% end %>
10
+ <% end %>
11
+ <% end %>
12
+ <% end %>
@@ -0,0 +1,42 @@
1
+ <%= render 'account/shared/page' do |p| %>
2
+ <% p.content_for :title, t('.section') %>
3
+ <% p.content_for :body do %>
4
+ <%= render 'account/shared/box', divider: true do |p| %>
5
+ <% p.content_for :title, t('.header') %>
6
+ <% p.content_for :description do %>
7
+ <%= t('.description') %>
8
+ <%= t('.manage_description') if can? :manage, @endpoint %>
9
+ <% end %>
10
+
11
+ <% p.content_for :body do %>
12
+ <% with_attribute_settings object: @endpoint, strategy: :label do %>
13
+ <%= render 'shared/attributes/text', attribute: :name %>
14
+ <%= render 'shared/attributes/code', attribute: :url %>
15
+ <% # TODO We should make the `has_many` attribute partial configurable enough to handle this use case. %>
16
+ <%= render 'shared/attributes/attribute', attribute: :event_types do %>
17
+ <% if @endpoint.event_type_ids.any? %>
18
+ <% @endpoint.event_types.map do |event_type| %>
19
+ <% capture do %>
20
+ <code><%= event_type.name %></code>
21
+ <% end %>
22
+ <% end.map(&:strip).to_sentence.html_safe %>
23
+ <% else %>
24
+ <% # TODO It feels like a Nice Partials bug that we can't just do `t('.fields.event_types.all')` here. %>
25
+ <%= t('webhooks/outgoing/endpoints.fields.event_types.all') %>
26
+ <% end %>
27
+ <% end %>
28
+ <%# 🚅 super scaffolding will insert new fields above this line. %>
29
+ <% end %>
30
+ <% end %>
31
+
32
+ <% p.content_for :actions do %>
33
+ <%= link_to t('.buttons.edit'), [:edit, :account, @endpoint], class: first_button_primary if can? :edit, @endpoint %>
34
+ <%= button_to t('.buttons.destroy'), [:account, @endpoint], method: :delete, class: first_button_primary, data: { confirm: t('.buttons.confirmations.destroy', model_locales(@endpoint)) } if can? :destroy, @endpoint %>
35
+ <%= link_to t('global.buttons.back'), [:account, @team, :webhooks_outgoing_endpoints], class: first_button_primary %>
36
+ <% end %>
37
+ <% end %>
38
+
39
+ <%= render 'account/webhooks/outgoing/deliveries/index', deliveries: @endpoint.deliveries, hide_back: true %>
40
+ <%# 🚅 super scaffolding will insert new children above this line. %>
41
+ <% end %>
42
+ <% end %>
@@ -0,0 +1 @@
1
+ json.partial! "webhooks/outgoing/endpoints/endpoint", endpoint: @endpoint
@@ -0,0 +1,112 @@
1
+ en:
2
+ webhooks/outgoing/deliveries: &deliveries
3
+ label: &label Deliveries
4
+ breadcrumbs:
5
+ label: *label
6
+ navigation:
7
+ label: *label
8
+ icon: fal fa-puzzle-piece
9
+ buttons: &buttons
10
+ new: Add New Delivery
11
+ create: Create Delivery
12
+ edit: Edit Delivery
13
+ update: Update Delivery
14
+ destroy: Remove Delivery
15
+ shorthand:
16
+ show: Details
17
+ edit: Edit
18
+ destroy: Delete
19
+ confirmations:
20
+ # TODO customize for your use-case.
21
+ destroy: Are you sure you want to remove %{delivery_name}? This will also remove it's associated data. This can't be undone.
22
+ fields: &fields
23
+ id:
24
+ _: &id Delivery ID
25
+ label: *id
26
+ heading: *id
27
+
28
+ event_id: &event
29
+ _: &event_id Event
30
+ label: *event_id
31
+ heading: *event_id
32
+ placeholder: Select a Event
33
+ event: *event
34
+
35
+ endpoint_url:
36
+ _: &endpoint_url Endpoint URL
37
+ label: *endpoint_url
38
+ heading: *endpoint_url
39
+
40
+ delivered_at:
41
+ _: &delivered_at Delivered At
42
+ label: *delivered_at
43
+ heading: *delivered_at
44
+
45
+ status:
46
+ heading: Status
47
+
48
+ # 🚅 super scaffolding will insert new fields above this line.
49
+ created_at:
50
+ _: &created_at Issued At
51
+ label: *created_at
52
+ heading: *created_at
53
+ updated_at:
54
+ _: &updated_at Updated
55
+ label: *updated_at
56
+ heading: *updated_at
57
+ api:
58
+ endpoint_id: Absolutely Abstract Endpoint ID
59
+ collection_actions: "Collection Actions for Deliveries"
60
+ index: "List Deliveries"
61
+ create: "Add a New Delivery"
62
+ member_actions: "Actions for an Individual Delivery"
63
+ show: "Retrieve a Delivery"
64
+ update: "Update a Delivery"
65
+ destroy: "Delete a Delivery"
66
+ fields: *fields
67
+ index:
68
+ section: "%{endpoints_possessive} Deliveries"
69
+ contexts:
70
+ webhooks/outgoing/endpoint:
71
+ header: Deliveries
72
+ description: Below is a list of webhook deliveries that have been attempted for %{endpoint_name}.
73
+ description_empty: No Deliveries have been added for %{endpoint_name}.
74
+ fields: *fields
75
+ buttons: *buttons
76
+ show:
77
+ section: "Delivery of Event <code>%{delivery_name}</code> to %{endpoint_name}"
78
+ header: Webhook Delivery Details
79
+ description: Below are the available details for the event we've attempted to deliver.
80
+ manage_description: You'll also find options for updating these details or removing %{delivery_name} from %{endpoint_name} entirely.
81
+ fields: *fields
82
+ buttons: *buttons
83
+ form: &form
84
+ buttons: *buttons
85
+ fields: *fields
86
+ new:
87
+ section: "New Delivery for %{endpoint_name}"
88
+ header: New Delivery Details
89
+ description: Please provide the details of the new Delivery you'd like to add to %{endpoint_name}.
90
+ form: *form
91
+ edit:
92
+ section: "%{delivery_name}"
93
+ header: Edit Delivery Details
94
+ description: You can update the details or settings for %{delivery_name} below.
95
+ form: *form
96
+ notifications:
97
+ created: Delivery was successfully created.
98
+ updated: Delivery was successfully updated.
99
+ destroyed: Delivery was successfully destroyed.
100
+ account:
101
+ webhooks:
102
+ outgoing:
103
+ deliveries: *deliveries
104
+ activerecord:
105
+ attributes:
106
+ webhooks/outgoing/delivery:
107
+ event_id: *event_id
108
+ endpoint_url: *endpoint_url
109
+ delivered_at: *delivered_at
110
+ # 🚅 super scaffolding will insert new activerecord attributes above this line.
111
+ created_at: *created_at
112
+ updated_at: *updated_at
@@ -0,0 +1,122 @@
1
+ en:
2
+ webhooks/outgoing/delivery_attempts: &delivery_attempts
3
+ label: &label Delivery Attempts
4
+ breadcrumbs:
5
+ label: *label
6
+ navigation:
7
+ label: *label
8
+ icon: fal fa-puzzle-piece
9
+ buttons: &buttons
10
+ new: Add New Delivery Attempt
11
+ create: Create Delivery Attempt
12
+ edit: Edit Delivery Attempt
13
+ update: Update Delivery Attempt
14
+ destroy: Remove Delivery Attempt
15
+ shorthand:
16
+ show: Details
17
+ edit: Edit
18
+ destroy: Delete
19
+ confirmations:
20
+ # TODO customize for your use-case.
21
+ destroy: Are you sure you want to remove %{delivery_attempt_name}? This will also remove it's associated data. This can't be undone.
22
+ fields: &fields
23
+ id:
24
+ _: &id Delivery Attempt ID
25
+ label: *id
26
+ heading: *id
27
+
28
+ response_code:
29
+ _: &response_code Response Code
30
+ label: *response_code
31
+ heading: *response_code
32
+
33
+ response_body:
34
+ _: &response_body Response Body
35
+ label: *response_body
36
+ heading: *response_body
37
+
38
+ response_message:
39
+ _: &response_message Response Message
40
+ label: *response_message
41
+ heading: *response_message
42
+
43
+ error_message:
44
+ _: &error_message Error Message
45
+ label: *error_message
46
+ heading: *error_message
47
+
48
+ attempt_number:
49
+ _: &attempt_number Attempt Number
50
+ label: *attempt_number
51
+ heading: *attempt_number
52
+
53
+ status:
54
+ heading: Status
55
+
56
+ # 🚅 super scaffolding will insert new fields above this line.
57
+ created_at:
58
+ _: &created_at Attempted At
59
+ label: *created_at
60
+ heading: *created_at
61
+ updated_at:
62
+ _: &updated_at Updated
63
+ label: *updated_at
64
+ heading: *updated_at
65
+ api:
66
+ delivery_id: Absolutely Abstract Delivery ID
67
+ collection_actions: "Collection Actions for Delivery Attempts"
68
+ index: "List Delivery Attempts"
69
+ create: "Add a New Delivery Attempt"
70
+ member_actions: "Actions for an Individual Delivery Attempt"
71
+ show: "Retrieve a Delivery Attempt"
72
+ update: "Update a Delivery Attempt"
73
+ destroy: "Delete a Delivery Attempt"
74
+ fields: *fields
75
+ index:
76
+ section: "%{deliveries_possessive} Delivery Attempts"
77
+ contexts:
78
+ webhooks/outgoing/delivery:
79
+ header: Delivery Attempts
80
+ description: Below is an overview of individual attempts to deliver this event.
81
+ description_empty: We haven't attempted to deliver this event.
82
+ fields: *fields
83
+ buttons: *buttons
84
+ show:
85
+ section: "%{delivery_attempt_name} to Deliver <code>%{delivery_name}</code>"
86
+ header: Delivery Attempt Details
87
+ description: Below are the details we have for %{delivery_attempt_name}.
88
+ manage_description: You'll also find options for updating these details or removing %{delivery_attempt_name} from %{delivery_name} entirely.
89
+ fields: *fields
90
+ buttons: *buttons
91
+ form: &form
92
+ buttons: *buttons
93
+ fields: *fields
94
+ new:
95
+ section: "New Delivery Attempt for %{delivery_name}"
96
+ header: New Delivery Attempt Details
97
+ description: Please provide the details of the new Delivery Attempt you'd like to add to %{delivery_name}.
98
+ form: *form
99
+ edit:
100
+ section: "%{delivery_attempt_name}"
101
+ header: Edit Delivery Attempt Details
102
+ description: You can update the details or settings for %{delivery_attempt_name} below.
103
+ form: *form
104
+ notifications:
105
+ created: Delivery Attempt was successfully created.
106
+ updated: Delivery Attempt was successfully updated.
107
+ destroyed: Delivery Attempt was successfully destroyed.
108
+ account:
109
+ webhooks:
110
+ outgoing:
111
+ delivery_attempts: *delivery_attempts
112
+ activerecord:
113
+ attributes:
114
+ webhooks/outgoing/delivery_attempt:
115
+ response_code: *response_code
116
+ response_body: *response_body
117
+ response_message: *response_message
118
+ error_message: *error_message
119
+ attempt_number: *attempt_number
120
+ # 🚅 super scaffolding will insert new activerecord attributes above this line.
121
+ created_at: *created_at
122
+ updated_at: *updated_at
@@ -0,0 +1,108 @@
1
+ en:
2
+ webhooks/outgoing/endpoints: &endpoints
3
+ label: &label Webhooks
4
+ breadcrumbs:
5
+ label: *label
6
+ navigation:
7
+ label: *label
8
+ icon: fal fa-satellite-dish ti ti-bolt
9
+ buttons: &buttons
10
+ new: Add New Endpoint
11
+ create: Create Endpoint
12
+ edit: Edit Settings
13
+ update: Update Endpoint
14
+ destroy: Remove Endpoint
15
+ shorthand:
16
+ edit: Settings
17
+ destroy: Delete
18
+ confirmations:
19
+ # TODO customize for your use-case.
20
+ destroy: Are you sure you want to remove %{endpoint_name}? This will also remove it's associated data. This can't be undone.
21
+ fields: &fields
22
+ id:
23
+ _: &id Endpoint ID
24
+ label: *id
25
+ heading: *id
26
+
27
+ name:
28
+ _: &name Name
29
+ label: *name
30
+ heading: *name
31
+
32
+ url:
33
+ _: &url URL
34
+ label: *url
35
+ heading: *url
36
+
37
+ event_type_ids: &event_types
38
+ _: &event_type_ids Event Types
39
+ label: *event_type_ids
40
+ heading: *event_type_ids
41
+ all: All Events
42
+ event_types: *event_types
43
+
44
+ # 🚅 super scaffolding will insert new fields above this line.
45
+ created_at:
46
+ _: &created_at Added
47
+ label: *created_at
48
+ heading: *created_at
49
+ updated_at:
50
+ _: &updated_at Updated
51
+ label: *updated_at
52
+ heading: *updated_at
53
+ api:
54
+ team_id: Absolutely Abstract Team ID
55
+ collection_actions: "Collection Actions for Endpoints"
56
+ index: "List Endpoints"
57
+ create: "Add a New Endpoint"
58
+ member_actions: "Actions for an Individual Endpoint"
59
+ show: "Retrieve a Endpoint"
60
+ update: "Update a Endpoint"
61
+ destroy: "Delete a Endpoint"
62
+ fields: *fields
63
+ index:
64
+ section: "%{teams_possessive} Webhooks Endpoints"
65
+ contexts:
66
+ team:
67
+ header: Webhooks Endpoints
68
+ description: Below is a list of external endpoints we will try to deliver webhooks to based on %{teams_possessive} account activity.
69
+ description_empty: No Endpoints have been added for %{team_name}.
70
+ fields: *fields
71
+ buttons: *buttons
72
+ show:
73
+ section: "%{endpoint_name}"
74
+ header: Webhooks Endpoint Details
75
+ description: Below is the configuration for the %{endpoint_name} endpoint.
76
+ manage_description: You can update these settings or remove the endpoint.
77
+ fields: *fields
78
+ buttons: *buttons
79
+ form: &form
80
+ buttons: *buttons
81
+ fields: *fields
82
+ new:
83
+ section: "New Webhooks Endpoint for %{team_name}"
84
+ header: New Webhooks Endpoint Details
85
+ description: Please provide the details of the new Endpoint you'd like to add to %{team_name}.
86
+ form: *form
87
+ edit:
88
+ section: "%{endpoint_name}"
89
+ header: Edit Webhooks Endpoint Settings
90
+ description: You can update the settings for %{endpoint_name} below.
91
+ form: *form
92
+ notifications:
93
+ created: Endpoint was successfully created.
94
+ updated: Endpoint was successfully updated.
95
+ destroyed: Endpoint was successfully destroyed.
96
+ account:
97
+ webhooks:
98
+ outgoing:
99
+ endpoints: *endpoints
100
+ activerecord:
101
+ attributes:
102
+ webhooks/outgoing/endpoint:
103
+ name: *name
104
+ url: *url
105
+ event_type_ids: *event_type_ids
106
+ # 🚅 super scaffolding will insert new activerecord attributes above this line.
107
+ created_at: *created_at
108
+ updated_at: *updated_at
@@ -0,0 +1,10 @@
1
+ en:
2
+ webhooks/outgoing/events:
3
+ fields:
4
+ uuid: &uuid
5
+ heading: Event UUID
6
+ short_uuid: *uuid
7
+ event_type_name:
8
+ heading: Event Type
9
+ payload:
10
+ heading: JSON Payload
data/config/routes.rb ADDED
@@ -0,0 +1,18 @@
1
+ Rails.application.routes.draw do
2
+ namespace :account do
3
+ shallow do
4
+ resources :teams do
5
+ namespace :webhooks do
6
+ namespace :outgoing do
7
+ resources :events
8
+ resources :endpoints do
9
+ resources :deliveries, only: [:index, :show] do
10
+ resources :delivery_attempts, only: [:index, :show]
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ class CreateWebhooksOutgoingEndpoints < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :webhooks_outgoing_endpoints do |t|
4
+ t.references :team, foreign_key: true
5
+ t.text :url
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class CreateWebhooksOutgoingEndpointEventTypes < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :webhooks_outgoing_endpoint_event_types do |t|
4
+ t.integer :endpoint_id
5
+ t.integer :event_type_id
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ class CreateWebhooksOutgoingEventTypes < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :webhooks_outgoing_event_types do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ class CreateWebhooksOutgoingEvents < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :webhooks_outgoing_events do |t|
4
+ t.integer :event_type_id
5
+ t.integer :subject_id
6
+ t.string :subject_type
7
+ t.jsonb :body
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ class CreateWebhooksOutgoingDeliveries < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :webhooks_outgoing_deliveries do |t|
4
+ t.integer :endpoint_id
5
+ t.integer :event_id
6
+ t.text :endpoint_url
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ class AddTeamToWebhooksOutgoingEvents < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_reference :webhooks_outgoing_events, :team, foreign_key: true
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ class CreateWebhooksOutgoingDeliveryAttempts < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :webhooks_outgoing_delivery_attempts do |t|
4
+ t.integer :delivery_id
5
+ t.integer :response_code
6
+ t.text :response_body
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ class AddErrorMessageToWebhooksOutgoingDeliveryAttempt < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :webhooks_outgoing_delivery_attempts, :response_message, :text
4
+ add_column :webhooks_outgoing_delivery_attempts, :error_message, :text
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddNameToWebhooksOutgoingEndpoints < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :webhooks_outgoing_endpoints, :name, :string
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddDeliveredAtToWebhooksOutgoingDeliveries < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :webhooks_outgoing_deliveries, :delivered_at, :datetime
4
+ end
5
+ end