noticed 1.2.17 → 1.2.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/noticed/base.rb +9 -4
- data/lib/noticed/delivery_methods/base.rb +3 -0
- data/lib/noticed/delivery_methods/email.rb +1 -1
- data/lib/noticed/delivery_methods/vonage.rb +2 -0
- data/lib/noticed/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: deee1f4f64ac8d04fafc5b9a6fb0c25811361fa650a4a337e4e134159ff82a23
|
4
|
+
data.tar.gz: dae9d38da48b00c508460b7ccf3a797df8a69cea372f2738a374321bb9d6a033
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a690b58c36dbf4651734192b59242f4c18cc9bbafeaed95c5570ed4991b48f49610b351f636fb2ca3d64120263b0780c8a15fd7ee9c4f8a7cc7099ab8e959c2
|
7
|
+
data.tar.gz: f6f765115f53b1e9ec03ecef10da432ce0794a11a6cc8cac444fe724db1ecdb6c4ce967edff8aa86d5f5edfef424f0b9e605939e0de8cf68b4b89bfb6ad2b207
|
data/README.md
CHANGED
@@ -106,6 +106,7 @@ end
|
|
106
106
|
|
107
107
|
* `if: :method_name` - Calls `method_name`and cancels delivery method if `false` is returned
|
108
108
|
* `unless: :method_name` - Calls `method_name`and cancels delivery method if `true` is returned
|
109
|
+
* `delay: ActiveSupport::Duration` - Delays the delivery for the given duration of time
|
109
110
|
|
110
111
|
##### Helper Methods
|
111
112
|
|
@@ -521,7 +522,7 @@ class Post < ApplicationRecord
|
|
521
522
|
end
|
522
523
|
```
|
523
524
|
|
524
|
-
##### Polymorphic
|
525
|
+
##### Polymorphic Association
|
525
526
|
|
526
527
|
If your notification is only associated with one model or you're using a `text` column for your params column , then a polymorphic association is what you'll want to use.
|
527
528
|
|
data/lib/noticed/base.rb
CHANGED
@@ -85,9 +85,6 @@ module Noticed
|
|
85
85
|
|
86
86
|
# Actually runs an individual delivery
|
87
87
|
def run_delivery_method(delivery_method, recipient:, enqueue:)
|
88
|
-
return if (delivery_method_name = delivery_method.dig(:options, :if)) && !send(delivery_method_name)
|
89
|
-
return if (delivery_method_name = delivery_method.dig(:options, :unless)) && send(delivery_method_name)
|
90
|
-
|
91
88
|
args = {
|
92
89
|
notification_class: self.class.name,
|
93
90
|
options: delivery_method[:options],
|
@@ -98,7 +95,15 @@ module Noticed
|
|
98
95
|
|
99
96
|
run_callbacks delivery_method[:name] do
|
100
97
|
method = delivery_method_for(delivery_method[:name], delivery_method[:options])
|
101
|
-
|
98
|
+
|
99
|
+
# Always perfrom later if a delay is present
|
100
|
+
if (delay = delivery_method.dig(:options, :delay))
|
101
|
+
method.set(wait: delay).perform_later(args)
|
102
|
+
elsif enqueue
|
103
|
+
method.perform_later(args)
|
104
|
+
else
|
105
|
+
method.perform_now(args)
|
106
|
+
end
|
102
107
|
end
|
103
108
|
end
|
104
109
|
|
@@ -40,6 +40,9 @@ module Noticed
|
|
40
40
|
@notification.record = args[:record]
|
41
41
|
@notification.recipient = args[:recipient]
|
42
42
|
|
43
|
+
return if (condition = @options[:if]) && !@notification.send(condition)
|
44
|
+
return if (condition = @options[:unless]) && @notification.send(condition)
|
45
|
+
|
43
46
|
run_callbacks :deliver do
|
44
47
|
deliver
|
45
48
|
end
|
data/lib/noticed/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noticed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Oliver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10
|
11
|
+
date: 2020-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: webmock
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|