em_apn_manager 0.1.2 → 0.1.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/VERSION +1 -1
- data/em_apn_manager.gemspec +1 -1
- data/lib/em_apn_manager/cli.rb +12 -8
- data/lib/em_apn_manager/connection.rb +6 -6
- data/lib/em_apn_manager/manager.rb +2 -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: 46c31285c09779e4c69814961cebc85cccf93bad
|
4
|
+
data.tar.gz: f13fc8e62de642c855c926c97e496499000d6962
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 152e8171fb3a3b686cea23db6e570655aa806ab72a06c68283011f87ef815fe5004a9e5af503cc8dedb607b18c8623823751d610117bd0b9038cf15740daac59
|
7
|
+
data.tar.gz: e941714c35469480b303670fc2bf1227e6225c865800606798d7049002d969631701b963478419a20f643cd116d9d1cc195bd5efdd6a9dafbaaae0dbd29b4c3b
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/em_apn_manager.gemspec
CHANGED
data/lib/em_apn_manager/cli.rb
CHANGED
@@ -64,14 +64,18 @@ module EventMachine
|
|
64
64
|
desc "push_test_message", "Push test messages to server."
|
65
65
|
# if message is DISCONNECT, mock apns will disconnect.
|
66
66
|
def push_test_message
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
67
|
+
EM::ApnManager.push_notification({
|
68
|
+
env: @environment,
|
69
|
+
cert: File.read(ENV["APN_CERT"]), # test cert
|
70
|
+
# iPhone5
|
71
|
+
# "D42A6795D0C6C0E5F3CC762F905C3654D2A07E72D64CDEC1E2F74AC43C4CC440"
|
72
|
+
# iPhone4
|
73
|
+
# "BACF565FB283E9F7378D5A0AEBCBCB49A4D7834AED8FAC7FE0CB28144D94E456"
|
74
|
+
# My iPhone4s
|
75
|
+
# "0F93C49EAAF3544B5218D2BAE893608C515F69B445279AB2B17511C37046C52B"
|
76
|
+
token: ["0F93C49EAAF3544B5218D2BAE893608C515F69B445279AB2B17511C37046C52B"].sample,
|
77
|
+
message: "Hahahaha I am going to spam you. #{rand * 100}"
|
78
|
+
})
|
75
79
|
end
|
76
80
|
|
77
81
|
desc "mock_apn_server", "Start a mock apple APNS Server."
|
@@ -27,12 +27,6 @@ module EventMachine
|
|
27
27
|
)
|
28
28
|
end
|
29
29
|
|
30
|
-
def connection_completed
|
31
|
-
EM::ApnManager.logger.info("Connection completed")
|
32
|
-
|
33
|
-
client.open_callback.call if client.open_callback
|
34
|
-
end
|
35
|
-
|
36
30
|
def receive_data(data)
|
37
31
|
data_array = data.unpack("ccN")
|
38
32
|
error_response = ErrorResponse.new(*data_array)
|
@@ -40,6 +34,12 @@ module EventMachine
|
|
40
34
|
client.error_callback.call(error_response) if client.error_callback
|
41
35
|
end
|
42
36
|
|
37
|
+
def connection_completed
|
38
|
+
EM::ApnManager.logger.info("Connection completed")
|
39
|
+
|
40
|
+
client.open_callback.call if client.open_callback
|
41
|
+
end
|
42
|
+
|
43
43
|
def unbind
|
44
44
|
EM::ApnManager.logger.info("Connection closed")
|
45
45
|
|
@@ -59,7 +59,8 @@ module EventMachine
|
|
59
59
|
# NOTICE should not put the 'certs' folder to a downloadable place.
|
60
60
|
def save_cert_to_file cert_content
|
61
61
|
FileUtils.mkdir_p "certs"
|
62
|
-
|
62
|
+
|
63
|
+
filename = Digest::SHA1.hexdigest(cert_content)
|
63
64
|
filename = File.join "certs", filename
|
64
65
|
return filename if File.exist?(filename)
|
65
66
|
|