mameapns 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -25,3 +25,5 @@ vendor
25
25
  .\#*
26
26
 
27
27
  UTF-8
28
+
29
+ TAGS
@@ -89,6 +89,22 @@ module Mameapns
89
89
  @on_delivery_error = block
90
90
  end
91
91
 
92
+ # To attempt to connect to apns server and close actually
93
+ # it used to check ssl cert files and ohter configurations.
94
+ def attempt_to_connect?
95
+ can_connect = true
96
+
97
+ begin
98
+ @deliver_session.connect?
99
+ rescue ConnectionError => e
100
+ can_connect = false
101
+ ensure
102
+ @deliver_session.close
103
+ end
104
+
105
+ can_connect
106
+ end
107
+
92
108
  [:feedback, :sent, :delivery_error, :exception].each do |event|
93
109
  event_name = "on_#{event}"
94
110
  define_method(event_name) do |&block|
@@ -21,7 +21,11 @@ module Mameapns
21
21
  connect
22
22
 
23
23
  while notification = queue.pop
24
- deliver(notification)
24
+ begin
25
+ deliver(notification)
26
+ rescue ConnectionError => e
27
+ handle_error(notification, e)
28
+ end
25
29
  end
26
30
 
27
31
  close
@@ -1,3 +1,3 @@
1
1
  module Mameapns
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mameapns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-18 00:00:00.000000000 Z
12
+ date: 2012-12-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor