apns_simple 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/apns_simple/client.rb +17 -2
- data/lib/apns_simple/version.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: 54dbbd173f8e1b261c87848e4ff13cf6e2d7bafc
|
4
|
+
data.tar.gz: b0b353941c8e2b80fc9c2c815d7a589b446d5341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3346fdb4e641301f1f0dcfdd2303f9b7cebafb86682813be9f581fe278fdfad6c83b47153d4fd132a0492b377d6daaab7b75e94b0b4ff1c72c41fd07adc3ff06
|
7
|
+
data.tar.gz: bde5768c3c3436d986182947ad0fe23f518b95583e89d69f7beeb57b4e94a1d5b9f15bed0c129122f18a05fa7c297fbef8dfa3dce29d0aee36b70059d1dcf7ed
|
data/lib/apns_simple/client.rb
CHANGED
@@ -6,6 +6,21 @@ module ApnsSimple
|
|
6
6
|
|
7
7
|
attr_reader :certificate, :passphrase, :host, :port
|
8
8
|
|
9
|
+
COMMAND = 8
|
10
|
+
CODES = {
|
11
|
+
0 => 'No errors encountered',
|
12
|
+
1 => 'Processing error',
|
13
|
+
2 => 'Missing device token',
|
14
|
+
3 => 'Missing topic',
|
15
|
+
4 => 'Missing payload',
|
16
|
+
5 => 'Invalid token size',
|
17
|
+
6 => 'Invalid topic size',
|
18
|
+
7 => 'Invalid payload size',
|
19
|
+
8 => 'Invalid token',
|
20
|
+
10 => 'Shutdown',
|
21
|
+
255 => 'Unknown error'
|
22
|
+
}
|
23
|
+
|
9
24
|
def initialize(options)
|
10
25
|
@certificate = options.fetch(:certificate)
|
11
26
|
@passphrase = options[:passphrase] || ''
|
@@ -26,8 +41,8 @@ module ApnsSimple
|
|
26
41
|
ssl.flush
|
27
42
|
|
28
43
|
if IO.select([ssl], nil, nil, 1) && error = ssl.read(6)
|
29
|
-
|
30
|
-
notification.error = status
|
44
|
+
command, status, _index = error.unpack("ccN")
|
45
|
+
notification.error = command == COMMAND ? "#{status}: #{CODES[status]}" : "Unknown command received from APNS server: #{command}"
|
31
46
|
end
|
32
47
|
ensure
|
33
48
|
ssl.close if ssl
|
data/lib/apns_simple/version.rb
CHANGED