wireframe-apn_on_rails 0.3.0.20110210134602 → 0.3.0.20110214171409
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.
@@ -79,15 +79,17 @@ class APN::Notification < APN::Base
|
|
79
79
|
# This can be run from the following Rake task:
|
80
80
|
# $ rake apn:notifications:deliver
|
81
81
|
def send_notifications(notifications = APN::Notification.all(:conditions => {:sent_at => nil}))
|
82
|
-
|
83
|
-
|
82
|
+
return if notifications.nil? || notifications.empty?
|
83
|
+
sent_ids = []
|
84
|
+
begin
|
84
85
|
APN::Connection.open_for_delivery do |conn, sock|
|
85
86
|
notifications.each do |noty|
|
87
|
+
sent_ids << noty.id
|
86
88
|
conn.write(noty.message_for_sending)
|
87
89
|
end
|
88
90
|
end
|
89
|
-
|
90
|
-
APN::Notification.update_all
|
91
|
+
ensure
|
92
|
+
APN::Notification.update_all(['sent_at = ?', Time.now.utc], ['id in (?)', sent_ids]) if sent_ids.any?
|
91
93
|
end
|
92
94
|
end
|
93
95
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wireframe-apn_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 40220428342901
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 0.3.0.
|
10
|
+
- 20110214171409
|
11
|
+
version: 0.3.0.20110214171409
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- ryan
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-02-
|
19
|
+
date: 2011-02-14 00:00:00 -06:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
requirements: []
|
105
105
|
|
106
106
|
rubyforge_project: magrathea
|
107
|
-
rubygems_version: 1.5.
|
107
|
+
rubygems_version: 1.5.2
|
108
108
|
signing_key:
|
109
109
|
specification_version: 3
|
110
110
|
summary: apn_on_rails
|