pushr-apns 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/pushr-apns/version.rb +1 -1
- data/lib/pushr/daemon/apns_support/connection_apns.rb +11 -3
- data/lib/pushr/message_apns.rb +7 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27c667b7eb5e0fd2435fd8e5405c1886832642ce
|
4
|
+
data.tar.gz: 338a2dfd2d22a2bacceceb790e1c7d2771908c2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 115003a2d0d957bce597a0153a8d11596def1d02eeb00b552d343e75e24640545d0ad594b82ef669528733ba9737cf2bd1affdc027e86e7caf3ce1c3f5400817
|
7
|
+
data.tar.gz: d70001a56f5d2463a4d5f1747408489499473ec1a9243712bb93c19fed5716a03248e5b1821e481889c21325d73172ac54a7e32ff83babd62a675c4b7404228b
|
data/lib/pushr-apns/version.rb
CHANGED
@@ -18,8 +18,9 @@ module Pushr
|
|
18
18
|
6 => 'Missing topic size',
|
19
19
|
7 => 'Missing payload size',
|
20
20
|
8 => 'Invalid token',
|
21
|
+
10 => 'Shutdown (APNS is in maintenance)',
|
21
22
|
255 => 'None (unknown error)'
|
22
|
-
}
|
23
|
+
} # https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW3
|
23
24
|
|
24
25
|
def initialize(configuration, i = nil)
|
25
26
|
@configuration = configuration
|
@@ -97,8 +98,15 @@ module Pushr
|
|
97
98
|
if tuple = read(ERROR_TUPLE_BYTES)
|
98
99
|
_, code, notification_id = tuple.unpack('ccN')
|
99
100
|
|
100
|
-
|
101
|
-
|
101
|
+
if code.to_i == 8
|
102
|
+
Pushr::FeedbackApns.create(app: @configuration.app, device: notification.device, follow_up: 'delete',
|
103
|
+
failed_at: Time.now)
|
104
|
+
Pushr::Daemon.logger.info("[#{@name}] Invalid device (error 8), feedback sent, message delivery failed"\
|
105
|
+
" to #{notification.to_json}")
|
106
|
+
else
|
107
|
+
description = APN_ERRORS[code.to_i] || 'Unknown error. Possible push bug?'
|
108
|
+
error = Pushr::Daemon::DeliveryError.new(code, notification, description, 'APNS')
|
109
|
+
end
|
102
110
|
else
|
103
111
|
error = DisconnectionError.new
|
104
112
|
end
|
data/lib/pushr/message_apns.rb
CHANGED
@@ -2,7 +2,7 @@ module Pushr
|
|
2
2
|
class MessageApns < Pushr::Message
|
3
3
|
POSTFIX = 'apns'
|
4
4
|
|
5
|
-
attr_accessor :device, :badge, :sound, :expiry, :attributes_for_device, :content_available, :priority
|
5
|
+
attr_accessor :device, :badge, :sound, :category, :expiry, :attributes_for_device, :content_available, :priority
|
6
6
|
validates :badge, numericality: true, allow_nil: true
|
7
7
|
validates :expiry, numericality: true, presence: true
|
8
8
|
validates :device, format: { with: /\A[a-z0-9]{64}\z/ }
|
@@ -49,9 +49,9 @@ module Pushr
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def to_hash
|
52
|
-
hsh = { type: self.class.to_s, app: app, device: device, alert: alert, badge: badge,
|
53
|
-
|
54
|
-
content_available: content_available
|
52
|
+
hsh = { type: self.class.to_s, app: app, device: device, alert: alert, badge: badge, sound: sound, expiry: expiry,
|
53
|
+
category: category, attributes_for_device: attributes_for_device, priority: priority,
|
54
|
+
content_available: content_available }
|
55
55
|
hsh[Pushr::Core.external_id_tag] = external_id if external_id
|
56
56
|
hsh
|
57
57
|
end
|
@@ -64,14 +64,15 @@ module Pushr
|
|
64
64
|
json['aps']['alert'] = alert if alert
|
65
65
|
json['aps']['badge'] = badge if badge
|
66
66
|
json['aps']['sound'] = sound if sound
|
67
|
+
json['aps']['category'] = category if category
|
67
68
|
json['aps']['content-available'] = content_available if content_available
|
68
69
|
attributes_for_device.each { |k, v| json[k.to_s] = v.to_s } if attributes_for_device
|
69
70
|
json
|
70
71
|
end
|
71
72
|
|
72
73
|
def max_payload_size
|
73
|
-
if payload_size >
|
74
|
-
errors.add(:payload, 'APN notification cannot be larger than
|
74
|
+
if payload_size > 2048
|
75
|
+
errors.add(:payload, 'APN notification cannot be larger than 2048 bytes. Try condensing your alert and attributes.')
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pushr-apns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Pesman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -216,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
216
|
version: '0'
|
217
217
|
requirements: []
|
218
218
|
rubyforge_project:
|
219
|
-
rubygems_version: 2.
|
219
|
+
rubygems_version: 2.4.6
|
220
220
|
signing_key:
|
221
221
|
specification_version: 4
|
222
222
|
summary: APNS (iOS/Apple) part of the modular push daemon.
|