notification-pusher 1.0.0.beta9 → 1.0.0.beta10
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 +4 -4
- data/README.md +4 -6
- data/lib/notification_pusher/notification_library.rb +5 -11
- data/lib/notification_pusher/pusher.rb +10 -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: 85507c35f9a208143b6c60d0619a2451ee338ff647bf387d6a35d68d710013df
|
4
|
+
data.tar.gz: 10a5c1cf5effbc81e8307afcc28d18f32e453a1a6bf644e8c6efcd9bac7d3d1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9948eff2f69db1e4062c83e526d058a50b01b79e91e1e927873078228ac52885eb079e9cbf352283333ce980c043e9cfbb083091bbcec3c29dadc1fd0093fe4a
|
7
|
+
data.tar.gz: b74d4e8fac75032fd8ebccc9ae37f1dcadb870a8ef3aef7c4618d12d471b00a93d77964fd1f16f5d635deea342bf65be45bbf2dc0c9de360c0e6da59d4a67871
|
data/README.md
CHANGED
@@ -102,14 +102,12 @@ notification.push [name_one, name_two], name_one: custom_options, name_two: cust
|
|
102
102
|
Writing custom pushers is fairly simple. Just add a new subclass to `NotificationPusher`:
|
103
103
|
|
104
104
|
```ruby
|
105
|
-
|
106
|
-
class CustomPusher
|
107
|
-
|
108
|
-
def initialize notification, options = {}
|
109
|
-
# ...
|
110
|
-
end
|
105
|
+
class NotificationPusher::CustomPusher
|
111
106
|
|
107
|
+
def initialize notification, options = {}
|
108
|
+
# ...
|
112
109
|
end
|
110
|
+
|
113
111
|
end
|
114
112
|
```
|
115
113
|
|
@@ -24,20 +24,14 @@ module NotificationPusher
|
|
24
24
|
|
25
25
|
def initialize_pusher
|
26
26
|
unless self.push.nil?
|
27
|
-
if self.push.kind_of(Array)
|
27
|
+
if self.push.kind_of?(Array)
|
28
28
|
self.push.each do |class_name|
|
29
|
-
pusher = NotificationPusher::Pusher.find_by_name(class_name).
|
30
|
-
|
31
|
-
options = pusher.options.merge! self.push_options[class_name.to_sym]
|
32
|
-
pusher.instances << NotificationPusher.const_get(pusher.name).new self, options
|
33
|
-
end
|
29
|
+
pusher = NotificationPusher::Pusher.find_by_name(class_name).first
|
30
|
+
pusher.push(self, self.push_options[class_name.to_sym])
|
34
31
|
end
|
35
32
|
else
|
36
|
-
pusher = NotificationPusher::Pusher.find_by_name(self.push).
|
37
|
-
|
38
|
-
options = pusher.options.merge! self.push_options
|
39
|
-
pusher.instances << NotificationPusher.const_get(pusher.name).new self, options
|
40
|
-
end
|
33
|
+
pusher = NotificationPusher::Pusher.find_by_name(self.push).first
|
34
|
+
pusher.push(self, self.push_options)
|
41
35
|
end
|
42
36
|
end
|
43
37
|
end
|
@@ -11,7 +11,16 @@ module NotificationPusher
|
|
11
11
|
@options = options
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
14
|
+
def push notification, options = {}
|
15
|
+
default_options = self.options
|
16
|
+
options = default_options.merge! options
|
17
|
+
if defined?(NotificationPusher.const_get(pusher.name))
|
18
|
+
instance = NotificationPusher.const_get(self.name).new notification, options
|
19
|
+
self.instances << instance
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.find_by_name name
|
15
24
|
ObjectSpace.each_object(NotificationPusher::Pusher).select { |pusher| pusher.name == name }
|
16
25
|
end
|
17
26
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notification-pusher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Hübotter
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0.0.
|
19
|
+
version: 1.0.0.beta10
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.0.0.
|
26
|
+
version: 1.0.0.beta10
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|