activeinteractor 2.0.0.alpha.2.0.0 → 2.0.0.alpha.2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_interactor/base.rb +18 -4
- data/lib/active_interactor.rb +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8353806528fdb9ad9625f469d16d400929d9ef3cae024490c85982354f4d9bad
|
4
|
+
data.tar.gz: af9cfad32cffe177d1b30fa7fb482f3305a6757152090d82482aef39f448a628
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45a07cd05ee5ad9e27fb23f2ebe1a99c5bc01cdeeda5987e35a501b22230ecb56ea49ccc36c233348a838a6c25cd2fa8b6945326bef13839d1f4541a0d3ac043
|
7
|
+
data.tar.gz: c11cbf40fa73910ce12a43a60db15f13983ec6174006627eae29eecd068002be2fcbd50b7062d4cd0d955736594a246611f66c570db59b152e889053c9b5128d
|
@@ -36,8 +36,10 @@ module ActiveInteractor
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def perform!
|
39
|
-
|
40
|
-
|
39
|
+
with_notification(:perform) do |payload|
|
40
|
+
interact
|
41
|
+
payload[:result] = Result.success(data: parse_output!)
|
42
|
+
end
|
41
43
|
end
|
42
44
|
|
43
45
|
def perform
|
@@ -56,8 +58,14 @@ module ActiveInteractor
|
|
56
58
|
attr_accessor :context
|
57
59
|
|
58
60
|
def fail!(errors = {})
|
59
|
-
|
60
|
-
|
61
|
+
result = nil
|
62
|
+
with_notification(:rollback) do |payload|
|
63
|
+
rollback
|
64
|
+
result = Result.failure(data: parse_output!, errors: errors)
|
65
|
+
payload[:result] = result
|
66
|
+
end
|
67
|
+
|
68
|
+
raise Error, result
|
61
69
|
end
|
62
70
|
|
63
71
|
def parse_input!
|
@@ -91,5 +99,11 @@ module ActiveInteractor
|
|
91
99
|
errors[attribute_name] << :blank
|
92
100
|
errors
|
93
101
|
end
|
102
|
+
|
103
|
+
def with_notification(action)
|
104
|
+
ActiveSupport::Notifications.instrument("#{self.class.name}::#{action.to_s.classify}") do |payload|
|
105
|
+
yield payload if block_given?
|
106
|
+
end
|
107
|
+
end
|
94
108
|
end
|
95
109
|
end
|
data/lib/active_interactor.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeinteractor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.alpha.2.
|
4
|
+
version: 2.0.0.alpha.2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Allen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -72,9 +72,9 @@ licenses:
|
|
72
72
|
- MIT
|
73
73
|
metadata:
|
74
74
|
bug_tracker_uri: https://github.com/activeinteractor/activeinteractor/issues
|
75
|
-
changelog_uri: https://github.com/activeinteractor/activeinteractor/blob/v2.0.0-alpha.2.
|
75
|
+
changelog_uri: https://github.com/activeinteractor/activeinteractor/blob/v2.0.0-alpha.2.1.0/CHANGELOG.md
|
76
76
|
homepage_uri: https://github.com/activeinteractor/activeinteractor
|
77
|
-
source_code_uri: https://github.com/activeinteractor/activeinteractor/tree/v2.0.0-alpha.2.
|
77
|
+
source_code_uri: https://github.com/activeinteractor/activeinteractor/tree/v2.0.0-alpha.2.1.0
|
78
78
|
wiki_uri: https://github.com/activeinteractor/activeinteractor/wiki
|
79
79
|
rubygems_mfa_required: 'true'
|
80
80
|
post_install_message:
|