bullet_train-outgoing_webhooks 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -0
- data/README.md +11 -26
- data/Rakefile +5 -11
- data/app/assets/config/bullet_train_outgoing_webhooks_web_manifest.js +0 -0
- data/app/controllers/account/webhooks/outgoing/deliveries_controller.rb +79 -0
- data/app/controllers/account/webhooks/outgoing/delivery_attempts_controller.rb +80 -0
- data/app/controllers/account/webhooks/outgoing/endpoints_controller.rb +79 -0
- data/app/views/account/webhooks/outgoing/deliveries/_breadcrumbs.html.erb +8 -0
- data/app/views/account/webhooks/outgoing/deliveries/_delivery.json.jbuilder +10 -0
- data/app/views/account/webhooks/outgoing/deliveries/_form.html.erb +21 -0
- data/app/views/account/webhooks/outgoing/deliveries/_index.html.erb +73 -0
- data/app/views/account/webhooks/outgoing/deliveries/_menu_item.html.erb +10 -0
- data/app/views/account/webhooks/outgoing/deliveries/_success_indicator.html.erb +7 -0
- data/app/views/account/webhooks/outgoing/deliveries/edit.html.erb +12 -0
- data/app/views/account/webhooks/outgoing/deliveries/index.html.erb +6 -0
- data/app/views/account/webhooks/outgoing/deliveries/index.json.jbuilder +1 -0
- data/app/views/account/webhooks/outgoing/deliveries/new.html.erb +12 -0
- data/app/views/account/webhooks/outgoing/deliveries/show.html.erb +37 -0
- data/app/views/account/webhooks/outgoing/deliveries/show.json.jbuilder +1 -0
- data/app/views/account/webhooks/outgoing/delivery_attempts/_breadcrumbs.html.erb +8 -0
- data/app/views/account/webhooks/outgoing/delivery_attempts/_delivery_attempt.json.jbuilder +12 -0
- data/app/views/account/webhooks/outgoing/delivery_attempts/_form.html.erb +22 -0
- data/app/views/account/webhooks/outgoing/delivery_attempts/_index.html.erb +69 -0
- data/app/views/account/webhooks/outgoing/delivery_attempts/_menu_item.html.erb +10 -0
- data/app/views/account/webhooks/outgoing/delivery_attempts/_success_indicator.html.erb +7 -0
- data/app/views/account/webhooks/outgoing/delivery_attempts/edit.html.erb +12 -0
- data/app/views/account/webhooks/outgoing/delivery_attempts/index.html.erb +6 -0
- data/app/views/account/webhooks/outgoing/delivery_attempts/index.json.jbuilder +1 -0
- data/app/views/account/webhooks/outgoing/delivery_attempts/new.html.erb +12 -0
- data/app/views/account/webhooks/outgoing/delivery_attempts/show.html.erb +32 -0
- data/app/views/account/webhooks/outgoing/delivery_attempts/show.json.jbuilder +1 -0
- data/app/views/account/webhooks/outgoing/endpoints/_breadcrumbs.html.erb +8 -0
- data/app/views/account/webhooks/outgoing/endpoints/_endpoint.json.jbuilder +10 -0
- data/app/views/account/webhooks/outgoing/endpoints/_form.html.erb +21 -0
- data/app/views/account/webhooks/outgoing/endpoints/_index.html.erb +62 -0
- data/app/views/account/webhooks/outgoing/endpoints/_menu_item.html.erb +10 -0
- data/app/views/account/webhooks/outgoing/endpoints/edit.html.erb +12 -0
- data/app/views/account/webhooks/outgoing/endpoints/index.html.erb +6 -0
- data/app/views/account/webhooks/outgoing/endpoints/index.json.jbuilder +1 -0
- data/app/views/account/webhooks/outgoing/endpoints/new.html.erb +12 -0
- data/app/views/account/webhooks/outgoing/endpoints/show.html.erb +42 -0
- data/app/views/account/webhooks/outgoing/endpoints/show.json.jbuilder +1 -0
- data/config/locales/en/webhooks/outgoing/deliveries.en.yml +112 -0
- data/config/locales/en/webhooks/outgoing/delivery_attempts.en.yml +122 -0
- data/config/locales/en/webhooks/outgoing/endpoints.en.yml +108 -0
- data/config/locales/en/webhooks/outgoing/events.en.yml +10 -0
- data/config/routes.rb +18 -0
- data/lib/bullet_train/outgoing_webhooks/engine.rb +6 -0
- data/lib/bullet_train/outgoing_webhooks/version.rb +1 -3
- data/lib/bullet_train/outgoing_webhooks.rb +2 -19
- data/lib/tasks/bullet_train/outgoing_webhooks_tasks.rake +4 -0
- metadata +58 -75
- data/.standard.yml +0 -2
- data/CHANGELOG.md +0 -5
- data/CODE_OF_CONDUCT.md +0 -84
- data/Gemfile +0 -12
- data/Gemfile.lock +0 -194
- data/LICENSE.txt +0 -21
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/lib/jobs/webhooks/outgoing/delivery_job.rb +0 -9
- data/lib/models/concerns/webhooks/outgoing/has_uuid.rb +0 -21
- data/lib/models/concerns/webhooks/outgoing/issuing_model.rb +0 -57
- data/lib/models/concerns/webhooks/outgoing/team_support.rb +0 -15
- data/lib/models/webhooks/outgoing/delivery.rb +0 -62
- data/lib/models/webhooks/outgoing/delivery_attempt.rb +0 -49
- data/lib/models/webhooks/outgoing/endpoint.rb +0 -22
- data/lib/models/webhooks/outgoing/event.rb +0 -41
- data/lib/models/webhooks/outgoing/event_type.rb +0 -15
- data/lib/models/webhooks/outgoing.rb +0 -11
- data/lib/models/webhooks.rb +0 -2
- data/sig/bullet_train/outgoing_webhooks.rbs +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79efb9fd4d7c770358101460461a724f999cedf19045814334dbe04493588ada
|
4
|
+
data.tar.gz: 60097da26f31a894bd041497b13920b0878ee8918f8972c1c3a3a78d87ef74b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94444641ef863656b88cda03600e52967bcac8c2e864969673d66e98a0d0dd7e562446fad3a192044dee7a9a29eef99590862635e6dae668279964726f9d58ef
|
7
|
+
data.tar.gz: db6681ef6aec68bffc61c5b476aa6fb2349b849062813cf70e6af0a70b492e7b12fb269d2a77f8ae89f5ba4379ee2c11c3265bcf2cf7649806f4cf080e823077
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2022 Andrew Culver
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,43 +1,28 @@
|
|
1
1
|
# BulletTrain::OutgoingWebhooks
|
2
|
+
Short description and motivation.
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
6
|
|
7
7
|
## Installation
|
8
|
-
|
9
8
|
Add this line to your application's Gemfile:
|
10
9
|
|
11
10
|
```ruby
|
12
|
-
gem
|
11
|
+
gem "bullet_train-outgoing_webhooks"
|
13
12
|
```
|
14
13
|
|
15
14
|
And then execute:
|
16
|
-
|
17
|
-
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
18
|
|
19
19
|
Or install it yourself as:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
20
|
+
```bash
|
21
|
+
$ gem install bullet_train-outgoing_webhooks
|
22
|
+
```
|
32
23
|
|
33
24
|
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bullet_train-outgoing_webhooks. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/bullet_train-outgoing_webhooks/blob/main/CODE_OF_CONDUCT.md).
|
25
|
+
Contribution directions go here.
|
36
26
|
|
37
27
|
## License
|
38
|
-
|
39
28
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
-
|
41
|
-
## Code of Conduct
|
42
|
-
|
43
|
-
Everyone interacting in the BulletTrain::OutgoingWebhooks project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/bullet_train-outgoing_webhooks/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
@@ -1,14 +1,8 @@
|
|
1
|
-
|
1
|
+
require "bundler/setup"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
Rake::TestTask.new(:test) do |t|
|
7
|
-
t.libs << "test"
|
8
|
-
t.libs << "lib"
|
9
|
-
t.test_files = FileList["test/**/test_*.rb"]
|
10
|
-
end
|
3
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
4
|
+
load "rails/tasks/engine.rake"
|
11
5
|
|
12
|
-
|
6
|
+
load "rails/tasks/statistics.rake"
|
13
7
|
|
14
|
-
|
8
|
+
require "bundler/gem_tasks"
|
File without changes
|
@@ -0,0 +1,79 @@
|
|
1
|
+
class Account::Webhooks::Outgoing::DeliveriesController < Account::ApplicationController
|
2
|
+
account_load_and_authorize_resource :delivery, through: :endpoint, through_association: :deliveries
|
3
|
+
|
4
|
+
# GET /account/webhooks/outgoing/endpoints/:endpoint_id/deliveries
|
5
|
+
# GET /account/webhooks/outgoing/endpoints/:endpoint_id/deliveries.json
|
6
|
+
def index
|
7
|
+
# if you only want these objects shown on their parent's show page, uncomment this:
|
8
|
+
redirect_to [:account, @endpoint]
|
9
|
+
end
|
10
|
+
|
11
|
+
# GET /account/webhooks/outgoing/deliveries/:id
|
12
|
+
# GET /account/webhooks/outgoing/deliveries/:id.json
|
13
|
+
def show
|
14
|
+
end
|
15
|
+
|
16
|
+
# GET /account/webhooks/outgoing/endpoints/:endpoint_id/deliveries/new
|
17
|
+
def new
|
18
|
+
end
|
19
|
+
|
20
|
+
# GET /account/webhooks/outgoing/deliveries/:id/edit
|
21
|
+
def edit
|
22
|
+
end
|
23
|
+
|
24
|
+
# POST /account/webhooks/outgoing/endpoints/:endpoint_id/deliveries
|
25
|
+
# POST /account/webhooks/outgoing/endpoints/:endpoint_id/deliveries.json
|
26
|
+
def create
|
27
|
+
respond_to do |format|
|
28
|
+
if @delivery.save
|
29
|
+
format.html { redirect_to [:account, @endpoint, :deliveries], notice: I18n.t("webhooks/outgoing/deliveries.notifications.created") }
|
30
|
+
format.json { render :show, status: :created, location: [:account, @delivery] }
|
31
|
+
else
|
32
|
+
format.html { render :new, status: :unprocessable_entity }
|
33
|
+
format.json { render json: @delivery.errors, status: :unprocessable_entity }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# PATCH/PUT /account/webhooks/outgoing/deliveries/:id
|
39
|
+
# PATCH/PUT /account/webhooks/outgoing/deliveries/:id.json
|
40
|
+
def update
|
41
|
+
respond_to do |format|
|
42
|
+
if @delivery.update(delivery_params)
|
43
|
+
format.html { redirect_to [:account, @delivery], notice: I18n.t("webhooks/outgoing/deliveries.notifications.updated") }
|
44
|
+
format.json { render :show, status: :ok, location: [:account, @delivery] }
|
45
|
+
else
|
46
|
+
format.html { render :edit, status: :unprocessable_entity }
|
47
|
+
format.json { render json: @delivery.errors, status: :unprocessable_entity }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# DELETE /account/webhooks/outgoing/deliveries/:id
|
53
|
+
# DELETE /account/webhooks/outgoing/deliveries/:id.json
|
54
|
+
def destroy
|
55
|
+
@delivery.destroy
|
56
|
+
respond_to do |format|
|
57
|
+
format.html { redirect_to [:account, @endpoint, :deliveries], notice: I18n.t("webhooks/outgoing/deliveries.notifications.destroyed") }
|
58
|
+
format.json { head :no_content }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
65
|
+
def delivery_params
|
66
|
+
strong_params = params.require(:webhooks_outgoing_delivery).permit(
|
67
|
+
:event_id,
|
68
|
+
:endpoint_url,
|
69
|
+
:delivered_at,
|
70
|
+
# 🚅 super scaffolding will insert new fields above this line.
|
71
|
+
# 🚅 super scaffolding will insert new arrays above this line.
|
72
|
+
)
|
73
|
+
|
74
|
+
assign_date_and_time(strong_params, :delivered_at)
|
75
|
+
# 🚅 super scaffolding will insert processing for new fields above this line.
|
76
|
+
|
77
|
+
strong_params
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
class Account::Webhooks::Outgoing::DeliveryAttemptsController < Account::ApplicationController
|
2
|
+
account_load_and_authorize_resource :delivery_attempt, through: :delivery, through_association: :delivery_attempts
|
3
|
+
|
4
|
+
# GET /account/webhooks/outgoing/deliveries/:delivery_id/delivery_attempts
|
5
|
+
# GET /account/webhooks/outgoing/deliveries/:delivery_id/delivery_attempts.json
|
6
|
+
def index
|
7
|
+
# if you only want these objects shown on their parent's show page, uncomment this:
|
8
|
+
redirect_to [:account, @delivery]
|
9
|
+
end
|
10
|
+
|
11
|
+
# GET /account/webhooks/outgoing/delivery_attempts/:id
|
12
|
+
# GET /account/webhooks/outgoing/delivery_attempts/:id.json
|
13
|
+
def show
|
14
|
+
end
|
15
|
+
|
16
|
+
# GET /account/webhooks/outgoing/deliveries/:delivery_id/delivery_attempts/new
|
17
|
+
def new
|
18
|
+
end
|
19
|
+
|
20
|
+
# GET /account/webhooks/outgoing/delivery_attempts/:id/edit
|
21
|
+
def edit
|
22
|
+
end
|
23
|
+
|
24
|
+
# POST /account/webhooks/outgoing/deliveries/:delivery_id/delivery_attempts
|
25
|
+
# POST /account/webhooks/outgoing/deliveries/:delivery_id/delivery_attempts.json
|
26
|
+
def create
|
27
|
+
respond_to do |format|
|
28
|
+
if @delivery_attempt.save
|
29
|
+
format.html { redirect_to [:account, @delivery, :delivery_attempts], notice: I18n.t("webhooks/outgoing/delivery_attempts.notifications.created") }
|
30
|
+
format.json { render :show, status: :created, location: [:account, @delivery_attempt] }
|
31
|
+
else
|
32
|
+
format.html { render :new, status: :unprocessable_entity }
|
33
|
+
format.json { render json: @delivery_attempt.errors, status: :unprocessable_entity }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# PATCH/PUT /account/webhooks/outgoing/delivery_attempts/:id
|
39
|
+
# PATCH/PUT /account/webhooks/outgoing/delivery_attempts/:id.json
|
40
|
+
def update
|
41
|
+
respond_to do |format|
|
42
|
+
if @delivery_attempt.update(delivery_attempt_params)
|
43
|
+
format.html { redirect_to [:account, @delivery_attempt], notice: I18n.t("webhooks/outgoing/delivery_attempts.notifications.updated") }
|
44
|
+
format.json { render :show, status: :ok, location: [:account, @delivery_attempt] }
|
45
|
+
else
|
46
|
+
format.html { render :edit, status: :unprocessable_entity }
|
47
|
+
format.json { render json: @delivery_attempt.errors, status: :unprocessable_entity }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# DELETE /account/webhooks/outgoing/delivery_attempts/:id
|
53
|
+
# DELETE /account/webhooks/outgoing/delivery_attempts/:id.json
|
54
|
+
def destroy
|
55
|
+
@delivery_attempt.destroy
|
56
|
+
respond_to do |format|
|
57
|
+
format.html { redirect_to [:account, @delivery, :delivery_attempts], notice: I18n.t("webhooks/outgoing/delivery_attempts.notifications.destroyed") }
|
58
|
+
format.json { head :no_content }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
65
|
+
def delivery_attempt_params
|
66
|
+
strong_params = params.require(:webhooks_outgoing_delivery_attempt).permit(
|
67
|
+
:response_code,
|
68
|
+
:response_body,
|
69
|
+
:response_message,
|
70
|
+
:error_message,
|
71
|
+
:attempt_number,
|
72
|
+
# 🚅 super scaffolding will insert new fields above this line.
|
73
|
+
# 🚅 super scaffolding will insert new arrays above this line.
|
74
|
+
)
|
75
|
+
|
76
|
+
# 🚅 super scaffolding will insert processing for new fields above this line.
|
77
|
+
|
78
|
+
strong_params
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
class Account::Webhooks::Outgoing::EndpointsController < Account::ApplicationController
|
2
|
+
account_load_and_authorize_resource :endpoint, through: :team, through_association: :webhooks_outgoing_endpoints
|
3
|
+
|
4
|
+
# GET /account/teams/:team_id/webhooks/outgoing/endpoints
|
5
|
+
# GET /account/teams/:team_id/webhooks/outgoing/endpoints.json
|
6
|
+
def index
|
7
|
+
# if you only want these objects shown on their parent's show page, uncomment this:
|
8
|
+
# redirect_to [:account, @team]
|
9
|
+
end
|
10
|
+
|
11
|
+
# GET /account/webhooks/outgoing/endpoints/:id
|
12
|
+
# GET /account/webhooks/outgoing/endpoints/:id.json
|
13
|
+
def show
|
14
|
+
end
|
15
|
+
|
16
|
+
# GET /account/teams/:team_id/webhooks/outgoing/endpoints/new
|
17
|
+
def new
|
18
|
+
end
|
19
|
+
|
20
|
+
# GET /account/webhooks/outgoing/endpoints/:id/edit
|
21
|
+
def edit
|
22
|
+
end
|
23
|
+
|
24
|
+
# POST /account/teams/:team_id/webhooks/outgoing/endpoints
|
25
|
+
# POST /account/teams/:team_id/webhooks/outgoing/endpoints.json
|
26
|
+
def create
|
27
|
+
respond_to do |format|
|
28
|
+
if @endpoint.save
|
29
|
+
format.html { redirect_to [:account, @team, :webhooks_outgoing_endpoints], notice: I18n.t("webhooks/outgoing/endpoints.notifications.created") }
|
30
|
+
format.json { render :show, status: :created, location: [:account, @endpoint] }
|
31
|
+
else
|
32
|
+
format.html { render :new, status: :unprocessable_entity }
|
33
|
+
format.json { render json: @endpoint.errors, status: :unprocessable_entity }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# PATCH/PUT /account/webhooks/outgoing/endpoints/:id
|
39
|
+
# PATCH/PUT /account/webhooks/outgoing/endpoints/:id.json
|
40
|
+
def update
|
41
|
+
respond_to do |format|
|
42
|
+
if @endpoint.update(endpoint_params)
|
43
|
+
format.html { redirect_to [:account, @endpoint], notice: I18n.t("webhooks/outgoing/endpoints.notifications.updated") }
|
44
|
+
format.json { render :show, status: :ok, location: [:account, @endpoint] }
|
45
|
+
else
|
46
|
+
format.html { render :edit, status: :unprocessable_entity }
|
47
|
+
format.json { render json: @endpoint.errors, status: :unprocessable_entity }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# DELETE /account/webhooks/outgoing/endpoints/:id
|
53
|
+
# DELETE /account/webhooks/outgoing/endpoints/:id.json
|
54
|
+
def destroy
|
55
|
+
@endpoint.destroy
|
56
|
+
respond_to do |format|
|
57
|
+
format.html { redirect_to [:account, @team, :webhooks_outgoing_endpoints], notice: I18n.t("webhooks/outgoing/endpoints.notifications.destroyed") }
|
58
|
+
format.json { head :no_content }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
65
|
+
def endpoint_params
|
66
|
+
strong_params = params.require(:webhooks_outgoing_endpoint).permit(
|
67
|
+
:name,
|
68
|
+
:url,
|
69
|
+
# 🚅 super scaffolding will insert new fields above this line.
|
70
|
+
event_type_ids: [],
|
71
|
+
# 🚅 super scaffolding will insert new arrays above this line.
|
72
|
+
)
|
73
|
+
|
74
|
+
assign_select_options(strong_params, :event_type_ids)
|
75
|
+
# 🚅 super scaffolding will insert processing for new fields above this line.
|
76
|
+
|
77
|
+
strong_params
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% delivery ||= @delivery %>
|
2
|
+
<% endpoint ||= @endpoint || delivery&.endpoint %>
|
3
|
+
<%= render 'account/webhooks/outgoing/endpoints/breadcrumbs', endpoint: endpoint %>
|
4
|
+
<%= render 'account/shared/breadcrumb', label: t('.label'), url: [:account, endpoint, :deliveries] %>
|
5
|
+
<% if delivery&.persisted? %>
|
6
|
+
<%= render 'account/shared/breadcrumb', label: delivery.label_string, url: [:account, delivery] %>
|
7
|
+
<% end %>
|
8
|
+
<%= render 'account/shared/breadcrumbs/actions', only_for: 'webhooks/outgoing/deliveries' %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
json.extract! delivery,
|
2
|
+
:id,
|
3
|
+
:endpoint_id,
|
4
|
+
:event_id,
|
5
|
+
:endpoint_url,
|
6
|
+
:delivered_at,
|
7
|
+
# 🚅 super scaffolding will insert new fields above this line.
|
8
|
+
:created_at,
|
9
|
+
:updated_at
|
10
|
+
json.url account_webhooks_outgoing_delivery_url(delivery, format: :json)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= form_with model: delivery, url: (delivery.persisted? ? [:account, delivery] : [:account, @endpoint, :deliveries]), 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/super_select', method: :event_id, options: {autofocus: true, include_blank: t('.fields.event_id.placeholder')},
|
6
|
+
choices: @delivery.valid_events.map { |event| [event.label_string, event.id] } %>
|
7
|
+
<%= render 'shared/fields/text_field', method: :endpoint_url %>
|
8
|
+
<%= render 'shared/fields/date_and_time_field', method: :delivered_at %>
|
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, delivery], class: "button-secondary" %>
|
16
|
+
<% else %>
|
17
|
+
<%= link_to t('global.buttons.cancel'), [:account, @endpoint, :deliveries], class: "button-secondary" %>
|
18
|
+
<% end %>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<% end %>
|
@@ -0,0 +1,73 @@
|
|
1
|
+
<% endpoint = @endpoint || @endpoint %>
|
2
|
+
<% context ||= endpoint %>
|
3
|
+
<% collection ||= :deliveries %>
|
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 deliveries.any? %>
|
15
|
+
<table class="table">
|
16
|
+
<thead>
|
17
|
+
<tr>
|
18
|
+
<th><%= t('webhooks/outgoing/events.fields.short_uuid.heading') %></th>
|
19
|
+
<th><%= t('webhooks/outgoing/events.fields.event_type_name.heading') %></th>
|
20
|
+
<th><%= t('.fields.endpoint_url.heading') %></th>
|
21
|
+
<th class="text-center"><%= t('.fields.delivered_at.heading') %></th>
|
22
|
+
<%# 🚅 super scaffolding will insert new field headers above this line. %>
|
23
|
+
<th><%= t('.fields.created_at.heading') %></th>
|
24
|
+
<th class="text-right"></th>
|
25
|
+
</tr>
|
26
|
+
</thead>
|
27
|
+
<tbody>
|
28
|
+
<% deliveries.each do |delivery| %>
|
29
|
+
<% with_attribute_settings object: delivery do %>
|
30
|
+
<tr data-id="<%= delivery.id %>">
|
31
|
+
<% with_attribute_settings object: delivery.event do %>
|
32
|
+
<td><%= render 'shared/attributes/code', attribute: :short_uuid, url: [:account, delivery] %></td>
|
33
|
+
<td><%= render 'shared/attributes/code', attribute: :event_type_name %></td>
|
34
|
+
<% end %>
|
35
|
+
<td><%= render 'shared/attributes/code', attribute: :endpoint_url %></td>
|
36
|
+
<td class="text-center"><%= render 'shared/attributes/attempt', attribute: :status, success_method: :delivered?, attempting_method: :still_attempting?, failure_method: :failed? %></td>
|
37
|
+
<%# 🚅 super scaffolding will insert new fields above this line. %>
|
38
|
+
<td><%= render 'shared/attributes/date_and_time', attribute: :created_at %></td>
|
39
|
+
<td class="buttons">
|
40
|
+
<% unless hide_actions %>
|
41
|
+
<% if can? :show, delivery %>
|
42
|
+
<%= link_to t('.buttons.shorthand.show'), [:account, delivery], class: 'button-secondary button-smaller' %>
|
43
|
+
<% end %>
|
44
|
+
<% if can? :edit, delivery %>
|
45
|
+
<%= link_to t('.buttons.shorthand.edit'), [:edit, :account, delivery], class: 'button-secondary button-smaller' %>
|
46
|
+
<% end %>
|
47
|
+
<% if can? :destroy, delivery %>
|
48
|
+
<%= button_to t('.buttons.shorthand.destroy'), [:account, delivery], method: :delete, data: { confirm: t('.buttons.confirmations.destroy', model_locales(delivery)) }, class: 'button-secondary button-smaller' %>
|
49
|
+
<% end %>
|
50
|
+
<% end %>
|
51
|
+
</td>
|
52
|
+
</tr>
|
53
|
+
<% end %>
|
54
|
+
<% end %>
|
55
|
+
</tbody>
|
56
|
+
</table>
|
57
|
+
<% end %>
|
58
|
+
<% end %>
|
59
|
+
|
60
|
+
<% p.content_for :actions do %>
|
61
|
+
<% unless hide_actions %>
|
62
|
+
<% if context == endpoint %>
|
63
|
+
<% if can? :create, Webhooks::Outgoing::Delivery.new(endpoint: endpoint) %>
|
64
|
+
<%= link_to t('.buttons.new'), [:new, :account, endpoint, :delivery], class: "#{first_button_primary(:delivery)} new" %>
|
65
|
+
<% end %>
|
66
|
+
<% end %>
|
67
|
+
|
68
|
+
<% unless hide_back %>
|
69
|
+
<%= link_to t('global.buttons.back'), [:account, context], class: "#{first_button_primary(:delivery)} back" %>
|
70
|
+
<% end %>
|
71
|
+
<% end %>
|
72
|
+
<% end %>
|
73
|
+
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% if can? :read, Webhooks::Outgoing::Delivery.new(team: current_team) %>
|
2
|
+
<%= render 'account/shared/menu/item', {
|
3
|
+
url: main_app.polymorphic_path([:account, current_team, :webhooks_outgoing_deliveries]),
|
4
|
+
label: t('webhooks/outgoing/deliveries.navigation.label'),
|
5
|
+
} do |p| %>
|
6
|
+
<% p.content_for :icon do %>
|
7
|
+
<i class="<%= t('webhooks/outgoing/deliveries.navigation.icon') %>"></i>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<% if delivery.delivered? %>
|
2
|
+
<div class="square-icon text-success"><i class="ti-check"></i></div>
|
3
|
+
<% elsif delivery.still_attempting? %>
|
4
|
+
<div class="square-icon"><i class="ti-reload rotating"></i></div>
|
5
|
+
<% else %>
|
6
|
+
<div class="square-icon text-danger"><i class="ti-close"></i></div>
|
7
|
+
<% 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', delivery: @delivery %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
json.array! @deliveries, partial: "webhooks/outgoing/deliveries/delivery", as: :delivery
|
@@ -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', delivery: @delivery %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<%= render 'account/shared/page' do |p| %>
|
2
|
+
<% p.content_for :title, t('.section').html_safe %>
|
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').html_safe %>
|
8
|
+
<%= t('.manage_description') if can? :manage, @delivery %>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<% p.content_for :body do %>
|
12
|
+
<% with_attribute_settings object: @delivery, strategy: :label do %>
|
13
|
+
<% with_attribute_settings object: @delivery.event do %>
|
14
|
+
<%= render 'shared/attributes/code', attribute: :uuid %>
|
15
|
+
<%= render 'shared/attributes/code', attribute: :event_type_name %>
|
16
|
+
<%= render 'shared/attributes/attribute', attribute: :payload do %>
|
17
|
+
<pre><%= JSON.pretty_generate(@delivery.event.payload) %></pre>
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
20
|
+
<%= render 'shared/attributes/attempt', attribute: :status, success_method: :delivered?, attempting_method: :still_attempting?, failure_method: :failed? %>
|
21
|
+
<%= render 'shared/attributes/code', attribute: :endpoint_url %>
|
22
|
+
<%= render 'shared/attributes/date_and_time', attribute: :delivered_at %>
|
23
|
+
<%# 🚅 super scaffolding will insert new fields above this line. %>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<% p.content_for :actions do %>
|
28
|
+
<%= link_to t('.buttons.edit'), [:edit, :account, @delivery], class: first_button_primary if can? :edit, @delivery %>
|
29
|
+
<%= button_to t('.buttons.destroy'), [:account, @delivery], method: :delete, class: first_button_primary, data: { confirm: t('.buttons.confirmations.destroy', model_locales(@delivery)) } if can? :destroy, @delivery %>
|
30
|
+
<%= link_to t('global.buttons.back'), [:account, @endpoint, :deliveries], class: first_button_primary %>
|
31
|
+
<% end %>
|
32
|
+
<% end %>
|
33
|
+
|
34
|
+
<%= render 'account/webhooks/outgoing/delivery_attempts/index', delivery_attempts: @delivery.delivery_attempts, hide_back: true %>
|
35
|
+
<%# 🚅 super scaffolding will insert new children above this line. %>
|
36
|
+
<% end %>
|
37
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
json.partial! "webhooks/outgoing/deliveries/delivery", delivery: @delivery
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% delivery_attempt ||= @delivery_attempt %>
|
2
|
+
<% delivery ||= @delivery || delivery_attempt&.delivery %>
|
3
|
+
<%= render 'account/webhooks/outgoing/deliveries/breadcrumbs', delivery: delivery %>
|
4
|
+
<%= render 'account/shared/breadcrumb', label: t('.label'), url: [:account, delivery, :delivery_attempts] %>
|
5
|
+
<% if delivery_attempt&.persisted? %>
|
6
|
+
<%= render 'account/shared/breadcrumb', label: delivery_attempt.label_string, url: [:account, delivery_attempt] %>
|
7
|
+
<% end %>
|
8
|
+
<%= render 'account/shared/breadcrumbs/actions', only_for: 'webhooks/outgoing/delivery_attempts' %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
json.extract! delivery_attempt,
|
2
|
+
:id,
|
3
|
+
:delivery_id,
|
4
|
+
:response_code,
|
5
|
+
:response_body,
|
6
|
+
:response_message,
|
7
|
+
:error_message,
|
8
|
+
:attempt_number,
|
9
|
+
# 🚅 super scaffolding will insert new fields above this line.
|
10
|
+
:created_at,
|
11
|
+
:updated_at
|
12
|
+
json.url account_webhooks_outgoing_delivery_attempt_url(delivery_attempt, format: :json)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%= form_with model: delivery_attempt, url: (delivery_attempt.persisted? ? [:account, delivery_attempt] : [:account, @delivery, :delivery_attempts]), 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: :response_code, options: {autofocus: true} %>
|
6
|
+
<%= render 'shared/fields/text_area', method: :response_body %>
|
7
|
+
<%= render 'shared/fields/text_area', method: :response_message %>
|
8
|
+
<%= render 'shared/fields/text_area', method: :error_message %>
|
9
|
+
<%= render 'shared/fields/text_field', method: :attempt_number %>
|
10
|
+
<%# 🚅 super scaffolding will insert new fields above this line. %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<div class="buttons">
|
14
|
+
<%= form.submit (form.object.persisted? ? t('.buttons.update') : t('.buttons.create')), class: "button" %>
|
15
|
+
<% if form.object.persisted? %>
|
16
|
+
<%= link_to t('global.buttons.cancel'), [:account, delivery_attempt], class: "button-secondary" %>
|
17
|
+
<% else %>
|
18
|
+
<%= link_to t('global.buttons.cancel'), [:account, @delivery, :delivery_attempts], class: "button-secondary" %>
|
19
|
+
<% end %>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<% end %>
|