action_push 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/action_push.rb +1 -0
- data/lib/action_push/base.rb +4 -1
- data/lib/action_push/concerns/class_method_delivery.rb +6 -1
- data/lib/action_push/concerns/register_interceptor.rb +19 -0
- data/lib/action_push/envelope.rb +0 -8
- data/lib/action_push/provider/base.rb +1 -1
- data/lib/action_push/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d92d74d36896cc9c7f74b94c5c6de2df3affe13c5d22c05b8439c63b9fcb1286
|
4
|
+
data.tar.gz: 454649b78977af6a74772417b904c4d3d9234ece970a36bff066fc02f470a608
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90fd9e4f83a266bf188af0cacc9791a863f4fcb1caa3797b730f8bb8c21adc504c72b590ed6a3c0022ce9c58c6c7588cea0253d261d67be6d79a3ec5b9f3d843
|
7
|
+
data.tar.gz: 6ef327d2057f1138628966fdafec6605b6aee17a9e5ac67fb323bccdccff948a88d2ba2a984a930129645db30e4eed4bd966e0921b4b9299ec80bf79e6d8c21a
|
data/Gemfile.lock
CHANGED
data/lib/action_push.rb
CHANGED
@@ -13,6 +13,7 @@ module ActionPush
|
|
13
13
|
autoload :ClassMethodDelivery, 'action_push/concerns/class_method_delivery'
|
14
14
|
autoload :RegisterDefault, 'action_push/concerns/register_default'
|
15
15
|
autoload :RegisterDeliveryMethod, 'action_push/concerns/register_delivery_method'
|
16
|
+
autoload :RegisterInterceptor, 'action_push/concerns/register_interceptor'
|
16
17
|
end
|
17
18
|
|
18
19
|
module Delivery
|
data/lib/action_push/base.rb
CHANGED
@@ -5,6 +5,7 @@ module ActionPush
|
|
5
5
|
extend Concerns::ClassMethodDelivery
|
6
6
|
extend Concerns::RegisterDefault
|
7
7
|
extend Concerns::RegisterDeliveryMethod
|
8
|
+
extend Concerns::RegisterInterceptor
|
8
9
|
|
9
10
|
register_default :ios, Ios::Message.new
|
10
11
|
|
@@ -13,8 +14,10 @@ module ActionPush
|
|
13
14
|
def self.inherited(subclass)
|
14
15
|
super
|
15
16
|
|
17
|
+
subclass.register_interceptor(interceptor)
|
18
|
+
|
16
19
|
defaults.each do |name, placeholder|
|
17
|
-
subclass.register_default
|
20
|
+
subclass.register_default(name, placeholder.clone)
|
18
21
|
end
|
19
22
|
|
20
23
|
delivery_methods.each do |name, handler|
|
@@ -20,7 +20,12 @@ module ActionPush
|
|
20
20
|
|
21
21
|
instance = new(action_name: method)
|
22
22
|
instance.public_send(method, *argv, &block)
|
23
|
-
instance.envelope.
|
23
|
+
instance.envelope.pushes.each do |provider, push|
|
24
|
+
interceptor.call(instance, provider, push) do
|
25
|
+
push.deliver
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
24
29
|
instance.envelope
|
25
30
|
end
|
26
31
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActionPush
|
4
|
+
module Concerns
|
5
|
+
module RegisterInterceptor
|
6
|
+
DEFAULT_INTERCEPTOR = ->(_instance, _provider, _push, &block) do
|
7
|
+
block.call
|
8
|
+
end
|
9
|
+
|
10
|
+
def interceptor
|
11
|
+
@interceptor || DEFAULT_INTERCEPTOR
|
12
|
+
end
|
13
|
+
|
14
|
+
def register_interceptor(handler)
|
15
|
+
@interceptor = handler
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/action_push/envelope.rb
CHANGED
data/lib/action_push/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_push
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aliaksandr Shylau
|
@@ -154,6 +154,7 @@ files:
|
|
154
154
|
- lib/action_push/concerns/class_method_delivery.rb
|
155
155
|
- lib/action_push/concerns/register_default.rb
|
156
156
|
- lib/action_push/concerns/register_delivery_method.rb
|
157
|
+
- lib/action_push/concerns/register_interceptor.rb
|
157
158
|
- lib/action_push/delivery/explosion.rb
|
158
159
|
- lib/action_push/delivery/gorush.rb
|
159
160
|
- lib/action_push/delivery/memory.rb
|