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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '040658ce42b3542dc655d8102ebbaae334243a3e56a3854810c29b55e24e442d'
4
- data.tar.gz: 9e9087416c8d4805dbb55d0fcff1f59628d8ec18b564099004bde75dbaa80142
3
+ metadata.gz: 34892c434db7409635d2628aee340dc76f71f2386c3b28c591b958d3fd7b9581
4
+ data.tar.gz: 922c959f22bbf32c82de1913a6384d46058eec701274dcaaee8dd5cb63fc09df
5
5
  SHA512:
6
- metadata.gz: 7f841052453fd910636c9a3c3fb073349cba385dc6faebc8af42b5c7dfce6ecf2202d29491b714590ce6d2f03a90b6940ca348ce1648b69c67db5ad92fc1a5c5
7
- data.tar.gz: fb9e3a7b3b6e91e76121281519fade25f2e7cee12801696b5197e98b14630c1fe7ffac8c240a0de1aba5e290668631587cfa57e2297369454f5e0a4333e755e9
6
+ metadata.gz: 8d2da877b7f1e0ad6e9cc01a560126110b8e53e9e1364b1cea07943318380c766499890b0bec5b67d8c3687742489f902cade0f76761cf6da693942cf01cc9c7
7
+ data.tar.gz: db808f18bb859f6f9faa2ac6aac8c6f5dcee9e820235e35b74bf5074fe262f7b477e2aa344c9d14d815b6739c2b47f7b530f3fdb8c84bf61c8f6407e41c6e237
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: 'bundler'
4
+ directory: '/'
5
+ schedule:
6
+ interval: 'monthly'
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` option to all steps, which allows a step to broadcast an event after executing |
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
- return_value: step_result.value!,
47
- params: args[-2],
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UseCases
4
- VERSION = "1.1.3"
4
+ VERSION = "1.1.4"
5
5
  end
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.3
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-03-08 00:00:00.000000000 Z
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"