gwong-apn_on_rails 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/.rspec +2 -0
  2. data/.specification +80 -0
  3. data/Gemfile +19 -0
  4. data/Gemfile.lock +47 -0
  5. data/LICENSE +21 -0
  6. data/README +179 -0
  7. data/README.textile +209 -0
  8. data/Rakefile +49 -0
  9. data/VERSION +1 -0
  10. data/apn_on_rails.gemspec +144 -0
  11. data/autotest/discover.rb +1 -0
  12. data/generators/apn_migrations_generator.rb +31 -0
  13. data/generators/templates/apn_migrations/001_create_apn_devices.rb +13 -0
  14. data/generators/templates/apn_migrations/002_create_apn_notifications.rb +23 -0
  15. data/generators/templates/apn_migrations/003_alter_apn_devices.rb +25 -0
  16. data/generators/templates/apn_migrations/004_create_apn_apps.rb +18 -0
  17. data/generators/templates/apn_migrations/005_create_groups.rb +23 -0
  18. data/generators/templates/apn_migrations/006_alter_apn_groups.rb +11 -0
  19. data/generators/templates/apn_migrations/007_create_device_groups.rb +27 -0
  20. data/generators/templates/apn_migrations/008_create_apn_group_notifications.rb +23 -0
  21. data/generators/templates/apn_migrations/009_create_pull_notifications.rb +16 -0
  22. data/generators/templates/apn_migrations/010_alter_apn_notifications.rb +21 -0
  23. data/generators/templates/apn_migrations/011_make_device_token_index_nonunique.rb +11 -0
  24. data/generators/templates/apn_migrations/012_add_launch_notification_to_apn_pull_notifications.rb +9 -0
  25. data/lib/apn_on_rails.rb +4 -0
  26. data/lib/apn_on_rails/apn_on_rails.rb +81 -0
  27. data/lib/apn_on_rails/app/models/apn/app.rb +150 -0
  28. data/lib/apn_on_rails/app/models/apn/base.rb +9 -0
  29. data/lib/apn_on_rails/app/models/apn/device.rb +49 -0
  30. data/lib/apn_on_rails/app/models/apn/device_grouping.rb +16 -0
  31. data/lib/apn_on_rails/app/models/apn/group.rb +12 -0
  32. data/lib/apn_on_rails/app/models/apn/group_notification.rb +79 -0
  33. data/lib/apn_on_rails/app/models/apn/notification.rb +93 -0
  34. data/lib/apn_on_rails/app/models/apn/pull_notification.rb +28 -0
  35. data/lib/apn_on_rails/libs/connection.rb +70 -0
  36. data/lib/apn_on_rails/libs/feedback.rb +39 -0
  37. data/lib/apn_on_rails/tasks/apn.rake +30 -0
  38. data/lib/apn_on_rails/tasks/db.rake +19 -0
  39. data/lib/apn_on_rails_tasks.rb +3 -0
  40. data/spec/active_record/setup_ar.rb +19 -0
  41. data/spec/apn_on_rails/app/models/apn/app_spec.rb +226 -0
  42. data/spec/apn_on_rails/app/models/apn/device_spec.rb +60 -0
  43. data/spec/apn_on_rails/app/models/apn/group_notification_spec.rb +66 -0
  44. data/spec/apn_on_rails/app/models/apn/notification_spec.rb +71 -0
  45. data/spec/apn_on_rails/app/models/apn/pull_notification_spec.rb +100 -0
  46. data/spec/apn_on_rails/libs/connection_spec.rb +40 -0
  47. data/spec/apn_on_rails/libs/feedback_spec.rb +43 -0
  48. data/spec/extensions/string.rb +10 -0
  49. data/spec/factories/app_factory.rb +27 -0
  50. data/spec/factories/device_factory.rb +29 -0
  51. data/spec/factories/device_grouping_factory.rb +22 -0
  52. data/spec/factories/group_factory.rb +27 -0
  53. data/spec/factories/group_notification_factory.rb +22 -0
  54. data/spec/factories/notification_factory.rb +22 -0
  55. data/spec/factories/pull_notification_factory.rb +22 -0
  56. data/spec/fixtures/hexa.bin +1 -0
  57. data/spec/fixtures/message_for_sending.bin +0 -0
  58. data/spec/rails_root/config/apple_push_notification_development.pem +19 -0
  59. data/spec/spec_helper.rb +55 -0
  60. metadata +282 -0
@@ -0,0 +1,22 @@
1
+ module GroupNotificationFactory
2
+
3
+ class << self
4
+
5
+ def new(options = {})
6
+ group = APN::Group.first
7
+ options = {:group_id => group.id, :sound => 'my_sound.aiff',
8
+ :badge => 5, :alert => 'Hello!', :custom_properties => {'typ' => 1}}.merge(options)
9
+ return APN::GroupNotification.new(options)
10
+ end
11
+
12
+ def create(options = {})
13
+ notification = GroupNotificationFactory.new(options)
14
+ notification.save
15
+ return notification
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+
22
+ GroupNotificationFactory.create
@@ -0,0 +1,22 @@
1
+ module NotificationFactory
2
+
3
+ class << self
4
+
5
+ def new(options = {})
6
+ device = APN::Device.first
7
+ options = {:device_id => device.id, :sound => 'my_sound.aiff',
8
+ :badge => 5, :alert => 'Hello!', :custom_properties => {'typ' => 1}}.merge(options)
9
+ return APN::Notification.new(options)
10
+ end
11
+
12
+ def create(options = {})
13
+ notification = NotificationFactory.new(options)
14
+ notification.save
15
+ return notification
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+
22
+ NotificationFactory.create
@@ -0,0 +1,22 @@
1
+ module PullNotificationFactory
2
+
3
+ class << self
4
+
5
+ def new(options = {})
6
+ app = APN::App.first
7
+ options = {:app_id => app.id, :title => 'Pull Notification Title',
8
+ :content => 'blah blah blah', :link => 'http://www.prx.org', :launch_notification => false}.merge(options)
9
+ return APN::PullNotification.new(options)
10
+ end
11
+
12
+ def create(options = {})
13
+ noty = PullNotificationFactory.new(options)
14
+ noty.save
15
+ return noty
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+
22
+ PullNotificationFactory.create
@@ -0,0 +1 @@
1
+ P�&cmVS��`�0tϬɵ]�GC�r-E�;�
@@ -0,0 +1,19 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDDDCCAfSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA8MQswCQYDVQQGEwJVUzEN
3
+ MAsGA1UECgwEaG9tZTERMA8GA1UECwwIbWFjYmF0ZXMxCzAJBgNVBAMMAkNBMB4X
4
+ DTA5MDIyMjE5MDUyOVoXDTEwMDIyMjE5MDUyOVowUzELMAkGA1UEBhMCVVMxDTAL
5
+ BgNVBAoMBGhvbWUxETAPBgNVBAsMCG1hY2JhdGVzMQswCQYDVQQLDAJDQTEVMBMG
6
+ A1UEAwwMaGVsbG8tc2VydmVyMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCr
7
+ LhTbcQc6hpYVeB8O94JzWnS41wZTaHReYe2mAxkIH9gF11Gm/Tejdfy7TboVsVtD
8
+ FZ+vrVYPFnnVZG2UNDUkfBvkbCBrFQ8glnAHGRYtDxdFjrLDxm0BOfC58wEtV2cM
9
+ hZhiLqjHFuSjHuAlAUshfCfWmKbEeDVtFSDxUMa6iQIDAQABo4GFMIGCMAwGA1Ud
10
+ EwEB/wQCMAAwMQYJYIZIAYb4QgENBCQWIlJ1YnkvT3BlblNTTCBHZW5lcmF0ZWQg
11
+ Q2VydGlmaWNhdGUwHQYDVR0OBBYEFEIBIEcdhFKPB+QILbsupdz3uD6YMAsGA1Ud
12
+ DwQEAwIFoDATBgNVHSUEDDAKBggrBgEFBQcDATANBgkqhkiG9w0BAQUFAAOCAQEA
13
+ dOKP/y/hsdnn2cbYpu2I6r8Lzql52XKa+jOaOT0TyPhmUAz0bFUgA53a202MDhbS
14
+ KDVhIkC88KTjyyRwVNnwsrS5JD/IOXIJw/vy9VX14aCymPkup0TQR6ZIicKrjcMS
15
+ yhmU5I0+fmsUN4PnayOuT/tJ0giy/x+1L/pgMicS47TvyNLB0vl34FplgmH6zlXv
16
+ nS/5phroEJm71DPyDNNzoohZo54YHpGmvEDqjLc6DB+Ihu6/sghmd5dlSPNqsubO
17
+ sBQeOyNuscbXo6MXI8uDYrZ/PqAtdzPXBjB7LXvVs69YT4KT7BaO3rqobgfJ0kNU
18
+ e7roqj04VUJGmU47qrMLBg==
19
+ -----END CERTIFICATE-----
@@ -0,0 +1,55 @@
1
+ require 'rspec'
2
+ require 'action_view'
3
+
4
+ Dir.glob(File.join(File.dirname(__FILE__), 'extensions', '*.rb')).sort.each do |f|
5
+ require f
6
+ end
7
+
8
+ require File.join(File.dirname(__FILE__), 'active_record', 'setup_ar.rb')
9
+
10
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'apn_on_rails')
11
+
12
+ Dir.glob(File.join(File.dirname(__FILE__), 'factories', '*.rb')).sort.each do |f|
13
+ require f
14
+ end
15
+
16
+ configatron.apn.cert = File.expand_path(File.join(File.dirname(__FILE__), 'rails_root', 'config', 'apple_push_notification_development.pem'))
17
+
18
+ RSpec.configure do |config|
19
+
20
+ config.before(:all) do
21
+
22
+ end
23
+
24
+ config.after(:all) do
25
+
26
+ end
27
+
28
+ config.before(:each) do
29
+
30
+ end
31
+
32
+ config.after(:each) do
33
+
34
+ end
35
+
36
+ end
37
+
38
+ def fixture_path(*name)
39
+ return File.join(File.dirname(__FILE__), 'fixtures', *name)
40
+ end
41
+
42
+ def fixture_value(*name)
43
+ return File.read(fixture_path(*name))
44
+ end
45
+
46
+ def write_fixture(name, value)
47
+ File.open(fixture_path(*name), 'w') {|f| f.write(value)}
48
+ end
49
+
50
+ def apn_cert
51
+ File.read(File.join(File.dirname(__FILE__), 'rails_root', 'config', 'apple_push_notification_development.pem'))
52
+ end
53
+
54
+ class BlockRan < StandardError
55
+ end
metadata ADDED
@@ -0,0 +1,282 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gwong-apn_on_rails
3
+ version: !ruby/object:Gem::Version
4
+ hash: 11
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 4
9
+ - 2
10
+ version: 0.4.2
11
+ platform: ruby
12
+ authors:
13
+ - markbates
14
+ - Rebecca Nesson
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2011-01-04 00:00:00 -08:00
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: configatron
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: autotest
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ type: :development
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: sqlite3-ruby
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ type: :development
63
+ version_requirements: *id003
64
+ - !ruby/object:Gem::Dependency
65
+ name: rspec
66
+ prerelease: false
67
+ requirement: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 15
73
+ segments:
74
+ - 2
75
+ - 0
76
+ - 0
77
+ version: 2.0.0
78
+ type: :development
79
+ version_requirements: *id004
80
+ - !ruby/object:Gem::Dependency
81
+ name: bundler
82
+ prerelease: false
83
+ requirement: &id005 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ hash: 23
89
+ segments:
90
+ - 1
91
+ - 0
92
+ - 0
93
+ version: 1.0.0
94
+ type: :development
95
+ version_requirements: *id005
96
+ - !ruby/object:Gem::Dependency
97
+ name: jeweler
98
+ prerelease: false
99
+ requirement: &id006 !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ~>
103
+ - !ruby/object:Gem::Version
104
+ hash: 3
105
+ segments:
106
+ - 1
107
+ - 5
108
+ - 0
109
+ version: 1.5.0
110
+ type: :development
111
+ version_requirements: *id006
112
+ - !ruby/object:Gem::Dependency
113
+ name: rcov
114
+ prerelease: false
115
+ requirement: &id007 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ hash: 3
121
+ segments:
122
+ - 0
123
+ version: "0"
124
+ type: :development
125
+ version_requirements: *id007
126
+ - !ruby/object:Gem::Dependency
127
+ name: actionpack
128
+ prerelease: false
129
+ requirement: &id008 !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ~>
133
+ - !ruby/object:Gem::Version
134
+ hash: 3
135
+ segments:
136
+ - 2
137
+ - 3
138
+ - 0
139
+ version: 2.3.0
140
+ type: :development
141
+ version_requirements: *id008
142
+ - !ruby/object:Gem::Dependency
143
+ name: activerecord
144
+ prerelease: false
145
+ requirement: &id009 !ruby/object:Gem::Requirement
146
+ none: false
147
+ requirements:
148
+ - - ~>
149
+ - !ruby/object:Gem::Version
150
+ hash: 3
151
+ segments:
152
+ - 2
153
+ - 3
154
+ - 0
155
+ version: 2.3.0
156
+ type: :development
157
+ version_requirements: *id009
158
+ description: |
159
+ APN on Rails is a Ruby on Rails gem that allows you to
160
+ easily add Apple Push Notification (iPhone) support to your Rails application.
161
+
162
+ email: tech-team@prx.org
163
+ executables: []
164
+
165
+ extensions: []
166
+
167
+ extra_rdoc_files:
168
+ - LICENSE
169
+ - README
170
+ - README.textile
171
+ files:
172
+ - .rspec
173
+ - .specification
174
+ - Gemfile
175
+ - Gemfile.lock
176
+ - LICENSE
177
+ - README
178
+ - README.textile
179
+ - Rakefile
180
+ - VERSION
181
+ - apn_on_rails.gemspec
182
+ - autotest/discover.rb
183
+ - generators/apn_migrations_generator.rb
184
+ - generators/templates/apn_migrations/001_create_apn_devices.rb
185
+ - generators/templates/apn_migrations/002_create_apn_notifications.rb
186
+ - generators/templates/apn_migrations/003_alter_apn_devices.rb
187
+ - generators/templates/apn_migrations/004_create_apn_apps.rb
188
+ - generators/templates/apn_migrations/005_create_groups.rb
189
+ - generators/templates/apn_migrations/006_alter_apn_groups.rb
190
+ - generators/templates/apn_migrations/007_create_device_groups.rb
191
+ - generators/templates/apn_migrations/008_create_apn_group_notifications.rb
192
+ - generators/templates/apn_migrations/009_create_pull_notifications.rb
193
+ - generators/templates/apn_migrations/010_alter_apn_notifications.rb
194
+ - generators/templates/apn_migrations/011_make_device_token_index_nonunique.rb
195
+ - generators/templates/apn_migrations/012_add_launch_notification_to_apn_pull_notifications.rb
196
+ - lib/apn_on_rails.rb
197
+ - lib/apn_on_rails/apn_on_rails.rb
198
+ - lib/apn_on_rails/app/models/apn/app.rb
199
+ - lib/apn_on_rails/app/models/apn/base.rb
200
+ - lib/apn_on_rails/app/models/apn/device.rb
201
+ - lib/apn_on_rails/app/models/apn/device_grouping.rb
202
+ - lib/apn_on_rails/app/models/apn/group.rb
203
+ - lib/apn_on_rails/app/models/apn/group_notification.rb
204
+ - lib/apn_on_rails/app/models/apn/notification.rb
205
+ - lib/apn_on_rails/app/models/apn/pull_notification.rb
206
+ - lib/apn_on_rails/libs/connection.rb
207
+ - lib/apn_on_rails/libs/feedback.rb
208
+ - lib/apn_on_rails/tasks/apn.rake
209
+ - lib/apn_on_rails/tasks/db.rake
210
+ - lib/apn_on_rails_tasks.rb
211
+ - spec/active_record/setup_ar.rb
212
+ - spec/apn_on_rails/app/models/apn/app_spec.rb
213
+ - spec/apn_on_rails/app/models/apn/device_spec.rb
214
+ - spec/apn_on_rails/app/models/apn/group_notification_spec.rb
215
+ - spec/apn_on_rails/app/models/apn/notification_spec.rb
216
+ - spec/apn_on_rails/app/models/apn/pull_notification_spec.rb
217
+ - spec/apn_on_rails/libs/connection_spec.rb
218
+ - spec/apn_on_rails/libs/feedback_spec.rb
219
+ - spec/extensions/string.rb
220
+ - spec/factories/app_factory.rb
221
+ - spec/factories/device_factory.rb
222
+ - spec/factories/device_grouping_factory.rb
223
+ - spec/factories/group_factory.rb
224
+ - spec/factories/group_notification_factory.rb
225
+ - spec/factories/notification_factory.rb
226
+ - spec/factories/pull_notification_factory.rb
227
+ - spec/fixtures/hexa.bin
228
+ - spec/fixtures/message_for_sending.bin
229
+ - spec/rails_root/config/apple_push_notification_development.pem
230
+ - spec/spec_helper.rb
231
+ has_rdoc: true
232
+ homepage: http://github.com/PRX/apn_on_rails
233
+ licenses: []
234
+
235
+ post_install_message:
236
+ rdoc_options: []
237
+
238
+ require_paths:
239
+ - lib
240
+ required_ruby_version: !ruby/object:Gem::Requirement
241
+ none: false
242
+ requirements:
243
+ - - ">="
244
+ - !ruby/object:Gem::Version
245
+ hash: 3
246
+ segments:
247
+ - 0
248
+ version: "0"
249
+ required_rubygems_version: !ruby/object:Gem::Requirement
250
+ none: false
251
+ requirements:
252
+ - - ">="
253
+ - !ruby/object:Gem::Version
254
+ hash: 3
255
+ segments:
256
+ - 0
257
+ version: "0"
258
+ requirements: []
259
+
260
+ rubyforge_project:
261
+ rubygems_version: 1.5.0
262
+ signing_key:
263
+ specification_version: 3
264
+ summary: Apple Push Notifications on Rails
265
+ test_files:
266
+ - spec/active_record/setup_ar.rb
267
+ - spec/apn_on_rails/app/models/apn/app_spec.rb
268
+ - spec/apn_on_rails/app/models/apn/device_spec.rb
269
+ - spec/apn_on_rails/app/models/apn/group_notification_spec.rb
270
+ - spec/apn_on_rails/app/models/apn/notification_spec.rb
271
+ - spec/apn_on_rails/app/models/apn/pull_notification_spec.rb
272
+ - spec/apn_on_rails/libs/connection_spec.rb
273
+ - spec/apn_on_rails/libs/feedback_spec.rb
274
+ - spec/extensions/string.rb
275
+ - spec/factories/app_factory.rb
276
+ - spec/factories/device_factory.rb
277
+ - spec/factories/device_grouping_factory.rb
278
+ - spec/factories/group_factory.rb
279
+ - spec/factories/group_notification_factory.rb
280
+ - spec/factories/notification_factory.rb
281
+ - spec/factories/pull_notification_factory.rb
282
+ - spec/spec_helper.rb