action_push 0.1.2 → 0.1.3
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/README.md +14 -0
- data/lib/action_push/delivery/gorush.rb +5 -3
- data/lib/action_push/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21082bf6072b6a3048f4ea0ef918fc701916b10b6df591502d7c9644a9747875
|
4
|
+
data.tar.gz: b5c67abae5d0acf2c46e3abcb4f5b83280cf7881a360ef96fb612ddda51af069
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ac3c185b04463f2aa2dd7fd93db5ffca73f45a1471eb929ad6a7a0cdb275ff0313570150324f2a24f2e317d49c158ecf88bd8a441295671bd3ba5f0d035ac22
|
7
|
+
data.tar.gz: 45626f3783d0d68a3534fb090174e2371cbddc0b010db8409aaad559030e2dc3bd0f6e9995fda33acd0db653c0d2274d5d6dc6fe75fa6b5236beeb593de1a3d8
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -137,6 +137,20 @@ RSpec.describe User do
|
|
137
137
|
end
|
138
138
|
```
|
139
139
|
|
140
|
+
## Interceptor
|
141
|
+
|
142
|
+
```ruby
|
143
|
+
# config/initializers/action_push.rb
|
144
|
+
|
145
|
+
ActionPush::Base.register_interceptor = ->(instance, provider, _push, &block) do
|
146
|
+
Logger.info <<~DOC
|
147
|
+
Sending a push "#{instance.class}.#{instance.action} to #{provider}"
|
148
|
+
DOC
|
149
|
+
|
150
|
+
block.call
|
151
|
+
end
|
152
|
+
```
|
153
|
+
|
140
154
|
## Реализация провайдера
|
141
155
|
|
142
156
|
Можно легко реализовать функционал нового провайдера для, скажем, отправки
|
@@ -41,9 +41,6 @@ module ActionPush
|
|
41
41
|
badge: push.badge,
|
42
42
|
category: push.category,
|
43
43
|
data: push.payload,
|
44
|
-
sound: {
|
45
|
-
name: push.sound
|
46
|
-
},
|
47
44
|
alert: {
|
48
45
|
title: alert.title,
|
49
46
|
body: alert.body,
|
@@ -56,6 +53,11 @@ module ActionPush
|
|
56
53
|
}
|
57
54
|
}
|
58
55
|
|
56
|
+
# #nil? check to be able tos specify: push.sound = false
|
57
|
+
unless (sound = push.sound).nil?
|
58
|
+
notification[:sound] = { name: sound }
|
59
|
+
end
|
60
|
+
|
59
61
|
response = post(notifications: [notification])
|
60
62
|
|
61
63
|
push.delivery_response = response
|
data/lib/action_push/version.rb
CHANGED