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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d92d74d36896cc9c7f74b94c5c6de2df3affe13c5d22c05b8439c63b9fcb1286
4
- data.tar.gz: 454649b78977af6a74772417b904c4d3d9234ece970a36bff066fc02f470a608
3
+ metadata.gz: 21082bf6072b6a3048f4ea0ef918fc701916b10b6df591502d7c9644a9747875
4
+ data.tar.gz: b5c67abae5d0acf2c46e3abcb4f5b83280cf7881a360ef96fb612ddda51af069
5
5
  SHA512:
6
- metadata.gz: 90fd9e4f83a266bf188af0cacc9791a863f4fcb1caa3797b730f8bb8c21adc504c72b590ed6a3c0022ce9c58c6c7588cea0253d261d67be6d79a3ec5b9f3d843
7
- data.tar.gz: 6ef327d2057f1138628966fdafec6605b6aee17a9e5ac67fb323bccdccff948a88d2ba2a984a930129645db30e4eed4bd966e0921b4b9299ec80bf79e6d8c21a
6
+ metadata.gz: 8ac3c185b04463f2aa2dd7fd93db5ffca73f45a1471eb929ad6a7a0cdb275ff0313570150324f2a24f2e317d49c158ecf88bd8a441295671bd3ba5f0d035ac22
7
+ data.tar.gz: 45626f3783d0d68a3534fb090174e2371cbddc0b010db8409aaad559030e2dc3bd0f6e9995fda33acd0db653c0d2274d5d6dc6fe75fa6b5236beeb593de1a3d8
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- action_push (0.1.2)
4
+ action_push (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionPush
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aliaksandr Shylau