pntfr 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/pntfr/session/ios.rb +2 -2
- data/lib/pntfr/version.rb +5 -1
- data/test/pntfr/device.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 155bd001219b0ae71b13a93d84e11bd6dcc2fb4d
|
4
|
+
data.tar.gz: 60619eb1816e9f0296913de087e7a07465ec7161
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45e32abce7a6d7cf38ab4f5b1b2cd809263322ecffbbeb56f35ce0c555d8fef89367f9ebde6ebf46caa8ea9982b2f806a1e558874d4b1971aa1a7611a8bdc45b
|
7
|
+
data.tar.gz: 6b43d884c55d5d9d5705dfb9afa6eb6f15659f8f5675fc5d60f02188f2d821a219cca2f9d6aa44aa7fed115939965e7d20773b62de79dfe9ecedf8dd45fca35a
|
data/README.md
CHANGED
@@ -46,8 +46,8 @@ end
|
|
46
46
|
## Sending messages
|
47
47
|
Pntfr suposes you have device objects, or other kind of model, with `platform` and `push_id` attributes.
|
48
48
|
Also, and optionally, a `num_notifs` integer attribute will be automagically managed to
|
49
|
-
monitor Apple's badge in notifications (for device objects with an `increment
|
50
|
-
(like ActiveRecord;) will use `increment(:num_notifs)`, for non ActiveRecord like
|
49
|
+
monitor Apple's badge in notifications (for device objects with an `increment!` method
|
50
|
+
(like ActiveRecord;) will use `increment!(:num_notifs)`, for non ActiveRecord like
|
51
51
|
device objects `num_notifs+= 1` will be used).
|
52
52
|
|
53
53
|
In order to avoid having to create a different message for each platform Pntfr
|
data/lib/pntfr/session/ios.rb
CHANGED
@@ -19,8 +19,8 @@ module Pntfr
|
|
19
19
|
if !notification[:badge].nil?
|
20
20
|
device.num_notifs= notification[:badge]
|
21
21
|
else
|
22
|
-
if device.methods.include?(:increment)
|
23
|
-
device.increment(:num_notifs)
|
22
|
+
if device.methods.include?(:increment!)
|
23
|
+
device.increment!(:num_notifs)
|
24
24
|
else
|
25
25
|
device.num_notifs+= 1
|
26
26
|
end
|
data/lib/pntfr/version.rb
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
# Let's follow Semantic Versioning: http://semver.org/
|
3
3
|
#
|
4
4
|
module Pntfr
|
5
|
+
#
|
6
|
+
# PATCH v0.5.1
|
7
|
+
# - Use increment! instead of increment when incrementing badge on a device object
|
8
|
+
# that quacks like ActiveRecord.
|
5
9
|
#
|
6
10
|
# MINOR v0.5.0
|
7
11
|
# - Badge control now can use ActiveRecord's increment method.
|
@@ -18,5 +22,5 @@ module Pntfr
|
|
18
22
|
# - Allow overriding general configuration credentials when instantiating each
|
19
23
|
# Notifier (on both platforms).
|
20
24
|
# - Internal refactoring.
|
21
|
-
VERSION = '0.5.
|
25
|
+
VERSION = '0.5.1'
|
22
26
|
end
|
data/test/pntfr/device.rb
CHANGED
@@ -6,7 +6,7 @@ Pntfr::Device= Struct.new(:platform, :push_id)
|
|
6
6
|
Pntfr::IosDevice= Struct.new(:platform, :push_id, :num_notifs)
|
7
7
|
# A device class that quacks like ActiveRecord with num_notifs which will be autoincremented on each sent msg
|
8
8
|
class Pntfr::ArIosDevice < Pntfr::IosDevice
|
9
|
-
def increment(attr_name, by=1)
|
9
|
+
def increment!(attr_name, by=1)
|
10
10
|
self.send("#{attr_name}=", by)
|
11
11
|
end
|
12
12
|
end
|