use_cases 1.1.3 → 1.1.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.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/README.md +2 -2
- data/lib/use_cases/module_optins/publishing.rb +3 -3
- data/lib/use_cases/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34892c434db7409635d2628aee340dc76f71f2386c3b28c591b958d3fd7b9581
|
4
|
+
data.tar.gz: 922c959f22bbf32c82de1913a6384d46058eec701274dcaaee8dd5cb63fc09df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d2da877b7f1e0ad6e9cc01a560126110b8e53e9e1364b1cea07943318380c766499890b0bec5b67d8c3687742489f902cade0f76761cf6da693942cf01cc9c7
|
7
|
+
data.tar.gz: db808f18bb859f6f9faa2ac6aac8c6f5dcee9e820235e35b74bf5074fe262f7b477e2aa344c9d14d815b6739c2b47f7b530f3fdb8c84bf61c8f6407e41c6e237
|
data/README.md
CHANGED
@@ -68,7 +68,7 @@ end
|
|
68
68
|
|---|---|
|
69
69
|
| `:authorized` | Adds an extra `authorize` step macro, used to check user permissions. |
|
70
70
|
| `:prepared` | Adds an extra `prepare` step macro, used to run some code before the use case runs. |
|
71
|
-
| `:publishing` | Adds extra extra `publish`
|
71
|
+
| `:publishing` | Adds extra extra `publish`, `event_data` and `event_metadata` options to all steps, which allows a step to broadcast an event after executing |
|
72
72
|
| `:transactional` | Calls `#transaction` on a given `transaction_handler` object around the use case execution |
|
73
73
|
| `:validated` | Adds all methods of `dry-transaction` to the use case DSL, which run validations on the received `params` object. |
|
74
74
|
|
@@ -122,7 +122,7 @@ class Users::DeleteAccount
|
|
122
122
|
|
123
123
|
authorize :user_owns_account?, failure_message: 'Cannot delete account'
|
124
124
|
try :load_account, catch: ActiveRecord::RecordNotFound, failure: :account_not_found, failure_message: 'Account not found'
|
125
|
-
map :delete_account, publish: :account_deleted
|
125
|
+
map :delete_account, publish: :account_deleted, event_data: proc { |account| { account_id: account.id } }, event_metadata: proc { { published_by: 'users.delete_account' } }
|
126
126
|
enqueue :send_farewell_email
|
127
127
|
|
128
128
|
private
|
@@ -42,10 +42,10 @@ module UseCases
|
|
42
42
|
private
|
43
43
|
|
44
44
|
def extract_payload(step_result, args)
|
45
|
+
value = step_result.value!
|
45
46
|
{
|
46
|
-
|
47
|
-
|
48
|
-
current_user: args[-1]
|
47
|
+
data: options[:event_data]&.call(value, args) || {},
|
48
|
+
metadata: options[:event_metadata]&.call(value, args) || {}
|
49
49
|
}
|
50
50
|
end
|
51
51
|
|
data/lib/use_cases/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: use_cases
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ring Twice
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -143,6 +143,7 @@ executables: []
|
|
143
143
|
extensions: []
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
|
+
- ".github/dependabot.yml"
|
146
147
|
- ".github/workflows/main.yml"
|
147
148
|
- ".gitignore"
|
148
149
|
- ".rspec"
|