em_apn_manager 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22a2d78ae92c5bcc1203c78f879a0d288a7839dd
4
- data.tar.gz: ca280d0f6bf0635a5a484bf03008e09645d66ca3
3
+ metadata.gz: 46c31285c09779e4c69814961cebc85cccf93bad
4
+ data.tar.gz: f13fc8e62de642c855c926c97e496499000d6962
5
5
  SHA512:
6
- metadata.gz: 6485873de80a8434fff09065a9330769f2645fa42b1eeed444d5e28ee219d89584a9ffeba6fe06542ed89b4b4293d1741d0695bcb059da188ac949a0d032bec4
7
- data.tar.gz: ef740e88117264f454b6b98c82a69f8626fc0d159cd743d9d9dfd7e492968453050b6ade226b756e9bde8b80d46afba44d59f759caeae308e086433bd09907cf
6
+ metadata.gz: 152e8171fb3a3b686cea23db6e570655aa806ab72a06c68283011f87ef815fe5004a9e5af503cc8dedb607b18c8623823751d610117bd0b9038cf15740daac59
7
+ data.tar.gz: e941714c35469480b303670fc2bf1227e6225c865800606798d7049002d969631701b963478419a20f643cd116d9d1cc195bd5efdd6a9dafbaaae0dbd29b4c3b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "em_apn_manager"
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael He"]
@@ -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
- 10.times do |i|
68
- EM::ApnManager.push_notification({
69
- env: @environment,
70
- cert: File.read(ENV["APN_CERT"]), # test cert
71
- token: ["0F93C49EAAF3544B5218D2BAE893608C515F69B445279AB2B17511C37046C52B", "D42A6795D0C6C0E5F3CC762F905C3654D2A07E72D64CDEC1E2F74AC43C4CC440"].sample,
72
- message: "Hahahaha I am going to spam you. #{i}-#{rand * 100}"
73
- })
74
- end
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
- filename = Base64.encode64(cert_content)[0..50]
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em_apn_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael He