push_kit-apns 1.0.0.pre.beta4 → 1.0.0.pre.beta5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/push_kit/apns/constants.rb +1 -1
- data/lib/push_kit/apns/notification.rb +7 -7
- data/spec/push_kit/apns/notification_spec.rb +10 -0
- 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: 79ebd1192da6f7767fab712f49c4014d69c43329ca764162933e36cec6845abb
|
4
|
+
data.tar.gz: 8df77e6fcff39ff6f40c1118ab3fc66532433413579e81da4e605c5590ad2b5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb154548f0c63ed21e79e99804287ada0ede333062aaebbe80eb5beacb3926ca66585f8a796a0e88ec11919465ab7ba6195b10a6a19366bd58a095a87a738c4d
|
7
|
+
data.tar.gz: 12832f719488ecd01e0581e04a26ffc97e95aa9a2185c03460b4f75eec3f152733b4e416828fa223b9beb9e747d06767b5affeaa4b72c8e9e428495183362e29
|
@@ -223,11 +223,11 @@ module PushKit
|
|
223
223
|
aps['alert'] = alert
|
224
224
|
end
|
225
225
|
|
226
|
-
aps['badge'] = badge
|
227
|
-
aps['sound'] = sound.to_s
|
228
|
-
aps['category'] = category
|
229
|
-
aps['content-available'] = 1
|
230
|
-
aps['mutable-content'] = 1
|
226
|
+
aps['badge'] = badge if badge.is_a?(Integer)
|
227
|
+
aps['sound'] = sound.to_s if sound.is_a?(String) || sound.is_a?(Symbol)
|
228
|
+
aps['category'] = category.to_s if category.is_a?(String) || category.is_a?(Symbol)
|
229
|
+
aps['content-available'] = 1 if content_available
|
230
|
+
aps['mutable-content'] = 1 if mutable_content
|
231
231
|
|
232
232
|
aps
|
233
233
|
end
|
@@ -247,8 +247,8 @@ module PushKit
|
|
247
247
|
end
|
248
248
|
end
|
249
249
|
|
250
|
-
alert['action-loc-key'] = action_key if action_key.is_a?(String)
|
251
|
-
alert['launch-image'] = launch_image
|
250
|
+
alert['action-loc-key'] = action_key.to_s if action_key.is_a?(String) || action_key.is_a?(Symbol)
|
251
|
+
alert['launch-image'] = launch_image if launch_image.is_a?(String)
|
252
252
|
|
253
253
|
alert
|
254
254
|
end
|
@@ -183,6 +183,11 @@ RSpec.describe PushKit::APNS::Notification, :unit do
|
|
183
183
|
expect(payload_aps).to include('category' => 'GENERAL')
|
184
184
|
end
|
185
185
|
|
186
|
+
it 'converts #category into a String given a Symbol' do
|
187
|
+
subject.category = :generic
|
188
|
+
expect(payload_aps).to include('category' => 'generic')
|
189
|
+
end
|
190
|
+
|
186
191
|
it 'includes #content_available when truthy' do
|
187
192
|
subject.content_available = true
|
188
193
|
expect(payload_aps).to include('content-available' => 1)
|
@@ -229,6 +234,11 @@ RSpec.describe PushKit::APNS::Notification, :unit do
|
|
229
234
|
expect(payload_alert).to include('action-loc-key' => 'ACTION_TITLE')
|
230
235
|
end
|
231
236
|
|
237
|
+
it 'converts #action_key into a String given a Symbol' do
|
238
|
+
subject.action_key = :ACTION_TITLE
|
239
|
+
expect(payload_alert).to include('action-loc-key' => 'ACTION_TITLE')
|
240
|
+
end
|
241
|
+
|
232
242
|
it 'includes #launch_image' do
|
233
243
|
subject.launch_image = 'launch.png'
|
234
244
|
expect(payload_alert).to include('launch-image' => 'launch.png')
|