mobile_notify 0.1 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile
CHANGED
@@ -22,7 +22,7 @@ spec = Gem::Specification.new do |s|
|
|
22
22
|
s.name = NAME
|
23
23
|
s.summary = s.description = SUMMARY
|
24
24
|
s.author = "Scott Bauer"
|
25
|
-
s.homepage = "http://
|
25
|
+
s.homepage = "http://github.com/Bauerpauer/mobile_notify"
|
26
26
|
s.version = GEM_VERSION
|
27
27
|
s.platform = Gem::Platform::RUBY
|
28
28
|
s.require_path = 'lib'
|
@@ -48,7 +48,7 @@ end
|
|
48
48
|
spec_file = ".gemspec"
|
49
49
|
desc "Create #{spec_file}"
|
50
50
|
task :gemspec do
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
File.open(spec_file, "w") do |file|
|
52
|
+
file.puts spec.to_ruby
|
53
|
+
end
|
54
54
|
end
|
@@ -73,18 +73,15 @@ module MobileNotify
|
|
73
73
|
|
74
74
|
def send(notification)
|
75
75
|
raise NotConnectedError.new(@uri) unless @ssl_socket
|
76
|
+
retry_timer ||= 0
|
76
77
|
|
77
|
-
unless defined?(retry_timer)
|
78
|
-
retry_timer = 0
|
79
|
-
end
|
80
|
-
|
81
78
|
@ssl_socket.write(notification.to_data)
|
82
79
|
self
|
83
80
|
rescue OpenSSL::SSL::SSLError, Errno::EPIPE
|
84
81
|
sleep(self.transmission_retry_delay)
|
85
82
|
retry_timer += self.transmission_retry_delay
|
86
83
|
retry if retry_timer < self.transmission_timeout
|
87
|
-
|
84
|
+
|
88
85
|
raise TransmissionTimeoutError.new(@uri, self.transmission_timeout, $!) if retry_timer >= self.transmission_timeout
|
89
86
|
end
|
90
87
|
|
@@ -98,9 +95,7 @@ module MobileNotify
|
|
98
95
|
protected
|
99
96
|
|
100
97
|
def establish_connection
|
101
|
-
|
102
|
-
retry_timer = 0
|
103
|
-
end
|
98
|
+
retry_timer ||= 0
|
104
99
|
|
105
100
|
# Wrap the TCP socket w/ SSL
|
106
101
|
ssl_socket = OpenSSL::SSL::SSLSocket.new(@tcp_socket, @ssl_context)
|
@@ -46,7 +46,7 @@ module MobileNotify
|
|
46
46
|
end
|
47
47
|
|
48
48
|
class BadgeNotification < Notification
|
49
|
-
def initialize(device_token,
|
49
|
+
def initialize(device_token, badge_value, sound = nil)
|
50
50
|
payload = { "aps" => {} }
|
51
51
|
payload["aps"]["badge"] = badge_value.to_i
|
52
52
|
payload["aps"]["sound"] = sound if sound
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobile_notify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 3
|
9
|
+
version: "0.3"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Scott Bauer
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-12-23 00:00:00 -06:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -47,7 +47,7 @@ files:
|
|
47
47
|
- lib/mobile_notify.rb
|
48
48
|
- bin/apns_ping
|
49
49
|
has_rdoc: true
|
50
|
-
homepage: http://
|
50
|
+
homepage: http://github.com/Bauerpauer/mobile_notify
|
51
51
|
licenses: []
|
52
52
|
|
53
53
|
post_install_message:
|