outbox-rails 0.4.0 → 1.0.0
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 +5 -5
- data/.rubocop.yml +30 -0
- data/.travis.yml +16 -0
- data/Appraisals +15 -0
- data/Rakefile +1 -1
- data/gemfiles/rails_5.0.gemfile +7 -0
- data/gemfiles/rails_5.0.gemfile.lock +173 -0
- data/gemfiles/rails_5.1.gemfile +7 -0
- data/gemfiles/rails_5.1.gemfile.lock +173 -0
- data/gemfiles/rails_5.2.gemfile +7 -0
- data/gemfiles/rails_5.2.gemfile.lock +181 -0
- data/gemfiles/rails_6.0.gemfile +7 -0
- data/gemfiles/rails_6.0.gemfile.lock +197 -0
- data/lib/outbox-rails.rb +1 -0
- data/lib/outbox/notifier.rb +29 -16
- data/lib/outbox/rails/railtie.rb +4 -3
- data/lib/outbox/rails/version.rb +1 -1
- data/outbox-rails.gemspec +19 -18
- data/spec/internal/app/notifiers/base_notifier.rb +14 -1
- data/spec/internal/app/notifiers/customized_notifier.rb +1 -2
- data/spec/internal/app/views/base_notifier/only_sms_template.text+sms.erb +1 -0
- data/spec/internal/app/views/layouts/notification.text+email.erb +1 -0
- data/spec/internal/app/views/layouts/notification.text+sms.erb +1 -0
- data/spec/outbox/notifier_spec.rb +27 -15
- data/spec/outbox/rails_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +67 -51
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ..
|
|
3
|
+
specs:
|
|
4
|
+
outbox-rails (1.0.0)
|
|
5
|
+
outbox (~> 0.2.0)
|
|
6
|
+
rails (>= 5.0, < 7)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
actioncable (5.2.4.3)
|
|
12
|
+
actionpack (= 5.2.4.3)
|
|
13
|
+
nio4r (~> 2.0)
|
|
14
|
+
websocket-driver (>= 0.6.1)
|
|
15
|
+
actionmailer (5.2.4.3)
|
|
16
|
+
actionpack (= 5.2.4.3)
|
|
17
|
+
actionview (= 5.2.4.3)
|
|
18
|
+
activejob (= 5.2.4.3)
|
|
19
|
+
mail (~> 2.5, >= 2.5.4)
|
|
20
|
+
rails-dom-testing (~> 2.0)
|
|
21
|
+
actionpack (5.2.4.3)
|
|
22
|
+
actionview (= 5.2.4.3)
|
|
23
|
+
activesupport (= 5.2.4.3)
|
|
24
|
+
rack (~> 2.0, >= 2.0.8)
|
|
25
|
+
rack-test (>= 0.6.3)
|
|
26
|
+
rails-dom-testing (~> 2.0)
|
|
27
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
28
|
+
actionview (5.2.4.3)
|
|
29
|
+
activesupport (= 5.2.4.3)
|
|
30
|
+
builder (~> 3.1)
|
|
31
|
+
erubi (~> 1.4)
|
|
32
|
+
rails-dom-testing (~> 2.0)
|
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
34
|
+
activejob (5.2.4.3)
|
|
35
|
+
activesupport (= 5.2.4.3)
|
|
36
|
+
globalid (>= 0.3.6)
|
|
37
|
+
activemodel (5.2.4.3)
|
|
38
|
+
activesupport (= 5.2.4.3)
|
|
39
|
+
activerecord (5.2.4.3)
|
|
40
|
+
activemodel (= 5.2.4.3)
|
|
41
|
+
activesupport (= 5.2.4.3)
|
|
42
|
+
arel (>= 9.0)
|
|
43
|
+
activestorage (5.2.4.3)
|
|
44
|
+
actionpack (= 5.2.4.3)
|
|
45
|
+
activerecord (= 5.2.4.3)
|
|
46
|
+
marcel (~> 0.3.1)
|
|
47
|
+
activesupport (5.2.4.3)
|
|
48
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
49
|
+
i18n (>= 0.7, < 2)
|
|
50
|
+
minitest (~> 5.1)
|
|
51
|
+
tzinfo (~> 1.1)
|
|
52
|
+
appraisal (2.3.0)
|
|
53
|
+
bundler
|
|
54
|
+
rake
|
|
55
|
+
thor (>= 0.14.0)
|
|
56
|
+
arel (9.0.0)
|
|
57
|
+
ast (2.4.1)
|
|
58
|
+
builder (3.2.4)
|
|
59
|
+
combustion (1.3.0)
|
|
60
|
+
activesupport (>= 3.0.0)
|
|
61
|
+
railties (>= 3.0.0)
|
|
62
|
+
thor (>= 0.14.6)
|
|
63
|
+
concurrent-ruby (1.1.6)
|
|
64
|
+
crass (1.0.6)
|
|
65
|
+
diff-lcs (1.3)
|
|
66
|
+
erubi (1.9.0)
|
|
67
|
+
globalid (0.4.2)
|
|
68
|
+
activesupport (>= 4.2.0)
|
|
69
|
+
i18n (1.8.3)
|
|
70
|
+
concurrent-ruby (~> 1.0)
|
|
71
|
+
loofah (2.6.0)
|
|
72
|
+
crass (~> 1.0.2)
|
|
73
|
+
nokogiri (>= 1.5.9)
|
|
74
|
+
mail (2.7.1)
|
|
75
|
+
mini_mime (>= 0.1.1)
|
|
76
|
+
marcel (0.3.3)
|
|
77
|
+
mimemagic (~> 0.3.2)
|
|
78
|
+
method_source (1.0.0)
|
|
79
|
+
mimemagic (0.3.5)
|
|
80
|
+
mini_mime (1.0.2)
|
|
81
|
+
mini_portile2 (2.4.0)
|
|
82
|
+
minitest (5.14.1)
|
|
83
|
+
nio4r (2.5.2)
|
|
84
|
+
nokogiri (1.10.9)
|
|
85
|
+
mini_portile2 (~> 2.4.0)
|
|
86
|
+
outbox (0.2.1)
|
|
87
|
+
mail (~> 2.6)
|
|
88
|
+
parser (2.7.1.4)
|
|
89
|
+
ast (~> 2.4.1)
|
|
90
|
+
powerpack (0.1.2)
|
|
91
|
+
rack (2.2.3)
|
|
92
|
+
rack-test (1.1.0)
|
|
93
|
+
rack (>= 1.0, < 3)
|
|
94
|
+
rails (5.2.4.3)
|
|
95
|
+
actioncable (= 5.2.4.3)
|
|
96
|
+
actionmailer (= 5.2.4.3)
|
|
97
|
+
actionpack (= 5.2.4.3)
|
|
98
|
+
actionview (= 5.2.4.3)
|
|
99
|
+
activejob (= 5.2.4.3)
|
|
100
|
+
activemodel (= 5.2.4.3)
|
|
101
|
+
activerecord (= 5.2.4.3)
|
|
102
|
+
activestorage (= 5.2.4.3)
|
|
103
|
+
activesupport (= 5.2.4.3)
|
|
104
|
+
bundler (>= 1.3.0)
|
|
105
|
+
railties (= 5.2.4.3)
|
|
106
|
+
sprockets-rails (>= 2.0.0)
|
|
107
|
+
rails-dom-testing (2.0.3)
|
|
108
|
+
activesupport (>= 4.2.0)
|
|
109
|
+
nokogiri (>= 1.6)
|
|
110
|
+
rails-html-sanitizer (1.3.0)
|
|
111
|
+
loofah (~> 2.3)
|
|
112
|
+
railties (5.2.4.3)
|
|
113
|
+
actionpack (= 5.2.4.3)
|
|
114
|
+
activesupport (= 5.2.4.3)
|
|
115
|
+
method_source
|
|
116
|
+
rake (>= 0.8.7)
|
|
117
|
+
thor (>= 0.19.0, < 2.0)
|
|
118
|
+
rainbow (2.2.2)
|
|
119
|
+
rake
|
|
120
|
+
rake (13.0.1)
|
|
121
|
+
rspec (3.5.0)
|
|
122
|
+
rspec-core (~> 3.5.0)
|
|
123
|
+
rspec-expectations (~> 3.5.0)
|
|
124
|
+
rspec-mocks (~> 3.5.0)
|
|
125
|
+
rspec-core (3.5.4)
|
|
126
|
+
rspec-support (~> 3.5.0)
|
|
127
|
+
rspec-expectations (3.5.0)
|
|
128
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
129
|
+
rspec-support (~> 3.5.0)
|
|
130
|
+
rspec-mocks (3.5.0)
|
|
131
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
132
|
+
rspec-support (~> 3.5.0)
|
|
133
|
+
rspec-rails (3.5.2)
|
|
134
|
+
actionpack (>= 3.0)
|
|
135
|
+
activesupport (>= 3.0)
|
|
136
|
+
railties (>= 3.0)
|
|
137
|
+
rspec-core (~> 3.5.0)
|
|
138
|
+
rspec-expectations (~> 3.5.0)
|
|
139
|
+
rspec-mocks (~> 3.5.0)
|
|
140
|
+
rspec-support (~> 3.5.0)
|
|
141
|
+
rspec-support (3.5.0)
|
|
142
|
+
rubocop (0.48.1)
|
|
143
|
+
parser (>= 2.3.3.1, < 3.0)
|
|
144
|
+
powerpack (~> 0.1)
|
|
145
|
+
rainbow (>= 1.99.1, < 3.0)
|
|
146
|
+
ruby-progressbar (~> 1.7)
|
|
147
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
148
|
+
ruby-progressbar (1.10.1)
|
|
149
|
+
sprockets (4.0.2)
|
|
150
|
+
concurrent-ruby (~> 1.0)
|
|
151
|
+
rack (> 1, < 3)
|
|
152
|
+
sprockets-rails (3.2.1)
|
|
153
|
+
actionpack (>= 4.0)
|
|
154
|
+
activesupport (>= 4.0)
|
|
155
|
+
sprockets (>= 3.0.0)
|
|
156
|
+
sqlite3 (1.4.2)
|
|
157
|
+
thor (1.0.1)
|
|
158
|
+
thread_safe (0.3.6)
|
|
159
|
+
tzinfo (1.2.7)
|
|
160
|
+
thread_safe (~> 0.1)
|
|
161
|
+
unicode-display_width (1.7.0)
|
|
162
|
+
websocket-driver (0.7.2)
|
|
163
|
+
websocket-extensions (>= 0.1.0)
|
|
164
|
+
websocket-extensions (0.1.5)
|
|
165
|
+
|
|
166
|
+
PLATFORMS
|
|
167
|
+
ruby
|
|
168
|
+
|
|
169
|
+
DEPENDENCIES
|
|
170
|
+
appraisal (~> 2.3.0)
|
|
171
|
+
combustion (~> 1.1)
|
|
172
|
+
outbox-rails!
|
|
173
|
+
rails (~> 5.2.0)
|
|
174
|
+
rake (>= 12.3.3)
|
|
175
|
+
rspec (~> 3.5.0)
|
|
176
|
+
rspec-rails (~> 3.5.2)
|
|
177
|
+
rubocop (~> 0.48.1)
|
|
178
|
+
sqlite3
|
|
179
|
+
|
|
180
|
+
BUNDLED WITH
|
|
181
|
+
2.1.4
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ..
|
|
3
|
+
specs:
|
|
4
|
+
outbox-rails (1.0.0)
|
|
5
|
+
outbox (~> 0.2.0)
|
|
6
|
+
rails (>= 5.0, < 7)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
actioncable (6.0.3.2)
|
|
12
|
+
actionpack (= 6.0.3.2)
|
|
13
|
+
nio4r (~> 2.0)
|
|
14
|
+
websocket-driver (>= 0.6.1)
|
|
15
|
+
actionmailbox (6.0.3.2)
|
|
16
|
+
actionpack (= 6.0.3.2)
|
|
17
|
+
activejob (= 6.0.3.2)
|
|
18
|
+
activerecord (= 6.0.3.2)
|
|
19
|
+
activestorage (= 6.0.3.2)
|
|
20
|
+
activesupport (= 6.0.3.2)
|
|
21
|
+
mail (>= 2.7.1)
|
|
22
|
+
actionmailer (6.0.3.2)
|
|
23
|
+
actionpack (= 6.0.3.2)
|
|
24
|
+
actionview (= 6.0.3.2)
|
|
25
|
+
activejob (= 6.0.3.2)
|
|
26
|
+
mail (~> 2.5, >= 2.5.4)
|
|
27
|
+
rails-dom-testing (~> 2.0)
|
|
28
|
+
actionpack (6.0.3.2)
|
|
29
|
+
actionview (= 6.0.3.2)
|
|
30
|
+
activesupport (= 6.0.3.2)
|
|
31
|
+
rack (~> 2.0, >= 2.0.8)
|
|
32
|
+
rack-test (>= 0.6.3)
|
|
33
|
+
rails-dom-testing (~> 2.0)
|
|
34
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
|
35
|
+
actiontext (6.0.3.2)
|
|
36
|
+
actionpack (= 6.0.3.2)
|
|
37
|
+
activerecord (= 6.0.3.2)
|
|
38
|
+
activestorage (= 6.0.3.2)
|
|
39
|
+
activesupport (= 6.0.3.2)
|
|
40
|
+
nokogiri (>= 1.8.5)
|
|
41
|
+
actionview (6.0.3.2)
|
|
42
|
+
activesupport (= 6.0.3.2)
|
|
43
|
+
builder (~> 3.1)
|
|
44
|
+
erubi (~> 1.4)
|
|
45
|
+
rails-dom-testing (~> 2.0)
|
|
46
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
|
47
|
+
activejob (6.0.3.2)
|
|
48
|
+
activesupport (= 6.0.3.2)
|
|
49
|
+
globalid (>= 0.3.6)
|
|
50
|
+
activemodel (6.0.3.2)
|
|
51
|
+
activesupport (= 6.0.3.2)
|
|
52
|
+
activerecord (6.0.3.2)
|
|
53
|
+
activemodel (= 6.0.3.2)
|
|
54
|
+
activesupport (= 6.0.3.2)
|
|
55
|
+
activestorage (6.0.3.2)
|
|
56
|
+
actionpack (= 6.0.3.2)
|
|
57
|
+
activejob (= 6.0.3.2)
|
|
58
|
+
activerecord (= 6.0.3.2)
|
|
59
|
+
marcel (~> 0.3.1)
|
|
60
|
+
activesupport (6.0.3.2)
|
|
61
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
62
|
+
i18n (>= 0.7, < 2)
|
|
63
|
+
minitest (~> 5.1)
|
|
64
|
+
tzinfo (~> 1.1)
|
|
65
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
|
66
|
+
appraisal (2.3.0)
|
|
67
|
+
bundler
|
|
68
|
+
rake
|
|
69
|
+
thor (>= 0.14.0)
|
|
70
|
+
ast (2.4.1)
|
|
71
|
+
builder (3.2.4)
|
|
72
|
+
combustion (1.3.0)
|
|
73
|
+
activesupport (>= 3.0.0)
|
|
74
|
+
railties (>= 3.0.0)
|
|
75
|
+
thor (>= 0.14.6)
|
|
76
|
+
concurrent-ruby (1.1.6)
|
|
77
|
+
crass (1.0.6)
|
|
78
|
+
diff-lcs (1.3)
|
|
79
|
+
erubi (1.9.0)
|
|
80
|
+
globalid (0.4.2)
|
|
81
|
+
activesupport (>= 4.2.0)
|
|
82
|
+
i18n (1.8.3)
|
|
83
|
+
concurrent-ruby (~> 1.0)
|
|
84
|
+
loofah (2.6.0)
|
|
85
|
+
crass (~> 1.0.2)
|
|
86
|
+
nokogiri (>= 1.5.9)
|
|
87
|
+
mail (2.7.1)
|
|
88
|
+
mini_mime (>= 0.1.1)
|
|
89
|
+
marcel (0.3.3)
|
|
90
|
+
mimemagic (~> 0.3.2)
|
|
91
|
+
method_source (1.0.0)
|
|
92
|
+
mimemagic (0.3.5)
|
|
93
|
+
mini_mime (1.0.2)
|
|
94
|
+
mini_portile2 (2.4.0)
|
|
95
|
+
minitest (5.14.1)
|
|
96
|
+
nio4r (2.5.2)
|
|
97
|
+
nokogiri (1.10.9)
|
|
98
|
+
mini_portile2 (~> 2.4.0)
|
|
99
|
+
outbox (0.2.1)
|
|
100
|
+
mail (~> 2.6)
|
|
101
|
+
parser (2.7.1.4)
|
|
102
|
+
ast (~> 2.4.1)
|
|
103
|
+
powerpack (0.1.2)
|
|
104
|
+
rack (2.2.3)
|
|
105
|
+
rack-test (1.1.0)
|
|
106
|
+
rack (>= 1.0, < 3)
|
|
107
|
+
rails (6.0.3.2)
|
|
108
|
+
actioncable (= 6.0.3.2)
|
|
109
|
+
actionmailbox (= 6.0.3.2)
|
|
110
|
+
actionmailer (= 6.0.3.2)
|
|
111
|
+
actionpack (= 6.0.3.2)
|
|
112
|
+
actiontext (= 6.0.3.2)
|
|
113
|
+
actionview (= 6.0.3.2)
|
|
114
|
+
activejob (= 6.0.3.2)
|
|
115
|
+
activemodel (= 6.0.3.2)
|
|
116
|
+
activerecord (= 6.0.3.2)
|
|
117
|
+
activestorage (= 6.0.3.2)
|
|
118
|
+
activesupport (= 6.0.3.2)
|
|
119
|
+
bundler (>= 1.3.0)
|
|
120
|
+
railties (= 6.0.3.2)
|
|
121
|
+
sprockets-rails (>= 2.0.0)
|
|
122
|
+
rails-dom-testing (2.0.3)
|
|
123
|
+
activesupport (>= 4.2.0)
|
|
124
|
+
nokogiri (>= 1.6)
|
|
125
|
+
rails-html-sanitizer (1.3.0)
|
|
126
|
+
loofah (~> 2.3)
|
|
127
|
+
railties (6.0.3.2)
|
|
128
|
+
actionpack (= 6.0.3.2)
|
|
129
|
+
activesupport (= 6.0.3.2)
|
|
130
|
+
method_source
|
|
131
|
+
rake (>= 0.8.7)
|
|
132
|
+
thor (>= 0.20.3, < 2.0)
|
|
133
|
+
rainbow (2.2.2)
|
|
134
|
+
rake
|
|
135
|
+
rake (13.0.1)
|
|
136
|
+
rspec (3.5.0)
|
|
137
|
+
rspec-core (~> 3.5.0)
|
|
138
|
+
rspec-expectations (~> 3.5.0)
|
|
139
|
+
rspec-mocks (~> 3.5.0)
|
|
140
|
+
rspec-core (3.5.4)
|
|
141
|
+
rspec-support (~> 3.5.0)
|
|
142
|
+
rspec-expectations (3.5.0)
|
|
143
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
144
|
+
rspec-support (~> 3.5.0)
|
|
145
|
+
rspec-mocks (3.5.0)
|
|
146
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
147
|
+
rspec-support (~> 3.5.0)
|
|
148
|
+
rspec-rails (3.5.2)
|
|
149
|
+
actionpack (>= 3.0)
|
|
150
|
+
activesupport (>= 3.0)
|
|
151
|
+
railties (>= 3.0)
|
|
152
|
+
rspec-core (~> 3.5.0)
|
|
153
|
+
rspec-expectations (~> 3.5.0)
|
|
154
|
+
rspec-mocks (~> 3.5.0)
|
|
155
|
+
rspec-support (~> 3.5.0)
|
|
156
|
+
rspec-support (3.5.0)
|
|
157
|
+
rubocop (0.48.1)
|
|
158
|
+
parser (>= 2.3.3.1, < 3.0)
|
|
159
|
+
powerpack (~> 0.1)
|
|
160
|
+
rainbow (>= 1.99.1, < 3.0)
|
|
161
|
+
ruby-progressbar (~> 1.7)
|
|
162
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
163
|
+
ruby-progressbar (1.10.1)
|
|
164
|
+
sprockets (4.0.2)
|
|
165
|
+
concurrent-ruby (~> 1.0)
|
|
166
|
+
rack (> 1, < 3)
|
|
167
|
+
sprockets-rails (3.2.1)
|
|
168
|
+
actionpack (>= 4.0)
|
|
169
|
+
activesupport (>= 4.0)
|
|
170
|
+
sprockets (>= 3.0.0)
|
|
171
|
+
sqlite3 (1.4.2)
|
|
172
|
+
thor (1.0.1)
|
|
173
|
+
thread_safe (0.3.6)
|
|
174
|
+
tzinfo (1.2.7)
|
|
175
|
+
thread_safe (~> 0.1)
|
|
176
|
+
unicode-display_width (1.7.0)
|
|
177
|
+
websocket-driver (0.7.2)
|
|
178
|
+
websocket-extensions (>= 0.1.0)
|
|
179
|
+
websocket-extensions (0.1.5)
|
|
180
|
+
zeitwerk (2.3.0)
|
|
181
|
+
|
|
182
|
+
PLATFORMS
|
|
183
|
+
ruby
|
|
184
|
+
|
|
185
|
+
DEPENDENCIES
|
|
186
|
+
appraisal (~> 2.3.0)
|
|
187
|
+
combustion (~> 1.1)
|
|
188
|
+
outbox-rails!
|
|
189
|
+
rails (~> 6.0.0)
|
|
190
|
+
rake (>= 12.3.3)
|
|
191
|
+
rspec (~> 3.5.0)
|
|
192
|
+
rspec-rails (~> 3.5.2)
|
|
193
|
+
rubocop (~> 0.48.1)
|
|
194
|
+
sqlite3
|
|
195
|
+
|
|
196
|
+
BUNDLED WITH
|
|
197
|
+
2.1.4
|
data/lib/outbox-rails.rb
CHANGED
data/lib/outbox/notifier.rb
CHANGED
|
@@ -7,11 +7,11 @@ module Outbox
|
|
|
7
7
|
|
|
8
8
|
abstract!
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
alias _render_email mail
|
|
11
11
|
undef :mail
|
|
12
12
|
|
|
13
13
|
class << self
|
|
14
|
-
|
|
14
|
+
alias defaults default
|
|
15
15
|
|
|
16
16
|
# Returns the name of current notifier. This method is also being used
|
|
17
17
|
# as a path for a view lookup. If this is an anonymous notifier,
|
|
@@ -23,10 +23,11 @@ module Outbox
|
|
|
23
23
|
self.mailer_name = value
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
|
-
|
|
26
|
+
alias notifier_name= notifier_name
|
|
27
27
|
|
|
28
28
|
protected
|
|
29
29
|
|
|
30
|
+
# rubocop:disable Style/MethodMissing
|
|
30
31
|
def method_missing(method_name, *args) # :nodoc:
|
|
31
32
|
if respond_to?(method_name)
|
|
32
33
|
new(method_name, *args).message
|
|
@@ -91,7 +92,7 @@ module Outbox
|
|
|
91
92
|
protected
|
|
92
93
|
|
|
93
94
|
def details_for_lookup
|
|
94
|
-
{ variants:
|
|
95
|
+
{ variants: [:email] }
|
|
95
96
|
end
|
|
96
97
|
|
|
97
98
|
def build_message
|
|
@@ -103,10 +104,8 @@ module Outbox
|
|
|
103
104
|
end
|
|
104
105
|
|
|
105
106
|
def render_email(email, options, &block)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
:body, :template_name, :template_path
|
|
109
|
-
)
|
|
107
|
+
email_options_keys = %i[content_type charset parts_order body template_name template_path]
|
|
108
|
+
email_options = options.select { |key, _| email_options_keys.include? key }
|
|
110
109
|
email_options.merge!(options.delete(:email)) if options[:email]
|
|
111
110
|
# ActionMailer will use the default i18n subject
|
|
112
111
|
# unless we explicitly set it on this options hash.
|
|
@@ -123,9 +122,12 @@ module Outbox
|
|
|
123
122
|
def render_message_types(options)
|
|
124
123
|
templates = find_message_type_templates(options)
|
|
125
124
|
templates.each do |template|
|
|
126
|
-
variants = (template
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
variants = template_variants(template)
|
|
126
|
+
if variants.empty?
|
|
127
|
+
assign_body(render(template: template))
|
|
128
|
+
else
|
|
129
|
+
assign_body(render(template: template, variants: variants), variants)
|
|
130
|
+
end
|
|
129
131
|
end
|
|
130
132
|
end
|
|
131
133
|
|
|
@@ -140,11 +142,12 @@ module Outbox
|
|
|
140
142
|
end
|
|
141
143
|
|
|
142
144
|
def assign_body(body, only_message_types = nil)
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
only_message_types =
|
|
146
|
+
if only_message_types
|
|
147
|
+
only_message_types.map(&:to_sym)
|
|
148
|
+
else
|
|
149
|
+
message_types_without_email
|
|
150
|
+
end
|
|
148
151
|
@_message.each_message_type do |message_type, message|
|
|
149
152
|
if message && message.body.nil? && message_type.in?(only_message_types)
|
|
150
153
|
message.body = body
|
|
@@ -160,6 +163,16 @@ module Outbox
|
|
|
160
163
|
message_types - [:email]
|
|
161
164
|
end
|
|
162
165
|
|
|
166
|
+
def template_variants(template)
|
|
167
|
+
if template.respond_to?(:variant)
|
|
168
|
+
[template.variant].compact
|
|
169
|
+
elsif template.respond_to?(:variants)
|
|
170
|
+
template.variants.compact
|
|
171
|
+
else
|
|
172
|
+
[]
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
163
176
|
ActiveSupport.run_load_hooks(:outbox_notifier, self)
|
|
164
177
|
end
|
|
165
178
|
end
|