noticed 2.3.3 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/noticed/deliverable.rb +17 -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: 6c98658561b5afec24269bdf1f1a8217b000dcf4db2abb5007319833141edbd9
|
4
|
+
data.tar.gz: 99503d35717b87ae0cdad18d475bba9715ecaa4b84fbec49ee3be94237388c45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a85e749ddd781f5296cee3a891ed7a928e2c2051c80b44375509e4d39741e3e251a3a23665e623070f8f4a1beae9340cf696f9be1f1f1f6bc97363825ad2ed7
|
7
|
+
data.tar.gz: 71ed6f70d6770bc47f733ff290cdf0aecdae8083438707f018d6a0f215ec2fa104d97382e9f8faefe51db3662158da675f0c74ee11c188aad0e4c5380d83938e
|
@@ -6,6 +6,7 @@ module Noticed
|
|
6
6
|
class_attribute :bulk_delivery_methods, instance_writer: false, default: {}
|
7
7
|
class_attribute :delivery_methods, instance_writer: false, default: {}
|
8
8
|
class_attribute :required_param_names, instance_writer: false, default: []
|
9
|
+
class_attribute :_recipients, instance_writer: false
|
9
10
|
end
|
10
11
|
|
11
12
|
class_methods do
|
@@ -39,6 +40,10 @@ module Noticed
|
|
39
40
|
delivery_methods[name] = DeliverBy.new(name, config)
|
40
41
|
end
|
41
42
|
|
43
|
+
def recipients(option = nil, &block)
|
44
|
+
self._recipients = block || option
|
45
|
+
end
|
46
|
+
|
42
47
|
def required_params(*names)
|
43
48
|
required_param_names.concat names
|
44
49
|
end
|
@@ -79,6 +84,8 @@ module Noticed
|
|
79
84
|
# CommentNotifier.deliver(User.all, wait: 5.minutes)
|
80
85
|
# CommentNotifier.deliver(User.all, wait_until: 1.hour.from_now)
|
81
86
|
def deliver(recipients = nil, enqueue_job: true, **options)
|
87
|
+
recipients ||= evaluate_recipients
|
88
|
+
|
82
89
|
validate!
|
83
90
|
|
84
91
|
transaction do
|
@@ -108,6 +115,16 @@ module Noticed
|
|
108
115
|
end
|
109
116
|
alias_method :deliver_later, :deliver
|
110
117
|
|
118
|
+
def evaluate_recipients
|
119
|
+
return unless _recipients
|
120
|
+
|
121
|
+
if _recipients.respond_to?(:call)
|
122
|
+
instance_exec(&_recipients)
|
123
|
+
elsif _recipients.is_a?(Symbol) && respond_to?(_recipients)
|
124
|
+
send(_recipients)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
111
128
|
def recipient_attributes_for(recipient)
|
112
129
|
{
|
113
130
|
type: "#{self.class.name}::Notification",
|
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: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Oliver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
|
-
rubygems_version: 3.5.
|
103
|
+
rubygems_version: 3.5.14
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: Notifications for Ruby on Rails applications
|