apn_on_rails 0.3.1 → 0.4.0

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.
Files changed (48) hide show
  1. data/.gitignore +16 -0
  2. data/.rspec +2 -0
  3. data/.specification +80 -0
  4. data/Gemfile +18 -0
  5. data/Gemfile.lock +45 -0
  6. data/README +51 -9
  7. data/README.textile +198 -0
  8. data/Rakefile +49 -0
  9. data/VERSION +1 -0
  10. data/apn_on_rails.gemspec +110 -0
  11. data/generators/templates/apn_migrations/004_create_apn_apps.rb +18 -0
  12. data/generators/templates/apn_migrations/005_create_groups.rb +23 -0
  13. data/generators/templates/apn_migrations/006_alter_apn_groups.rb +11 -0
  14. data/generators/templates/apn_migrations/007_create_device_groups.rb +27 -0
  15. data/generators/templates/apn_migrations/008_create_apn_group_notifications.rb +23 -0
  16. data/generators/templates/apn_migrations/009_create_pull_notifications.rb +16 -0
  17. data/lib/apn_on_rails/apn_on_rails.rb +22 -3
  18. data/lib/apn_on_rails/app/models/apn/app.rb +115 -0
  19. data/lib/apn_on_rails/app/models/apn/device.rb +3 -1
  20. data/lib/apn_on_rails/app/models/apn/device_grouping.rb +16 -0
  21. data/lib/apn_on_rails/app/models/apn/group.rb +12 -0
  22. data/lib/apn_on_rails/app/models/apn/group_notification.rb +79 -0
  23. data/lib/apn_on_rails/app/models/apn/notification.rb +6 -30
  24. data/lib/apn_on_rails/app/models/apn/pull_notification.rb +15 -0
  25. data/lib/apn_on_rails/libs/connection.rb +2 -1
  26. data/lib/apn_on_rails/libs/feedback.rb +6 -18
  27. data/lib/apn_on_rails/tasks/apn.rake +13 -4
  28. data/spec/active_record/setup_ar.rb +19 -0
  29. data/spec/apn_on_rails/app/models/apn/app_spec.rb +178 -0
  30. data/spec/apn_on_rails/app/models/apn/device_spec.rb +60 -0
  31. data/spec/apn_on_rails/app/models/apn/group_notification_spec.rb +66 -0
  32. data/spec/apn_on_rails/app/models/apn/notification_spec.rb +71 -0
  33. data/spec/apn_on_rails/app/models/apn/pull_notification_spec.rb +37 -0
  34. data/spec/apn_on_rails/libs/connection_spec.rb +40 -0
  35. data/spec/apn_on_rails/libs/feedback_spec.rb +45 -0
  36. data/spec/extensions/string.rb +10 -0
  37. data/spec/factories/app_factory.rb +27 -0
  38. data/spec/factories/device_factory.rb +29 -0
  39. data/spec/factories/device_grouping_factory.rb +22 -0
  40. data/spec/factories/group_factory.rb +27 -0
  41. data/spec/factories/group_notification_factory.rb +22 -0
  42. data/spec/factories/notification_factory.rb +22 -0
  43. data/spec/factories/pull_notification_factory.rb +22 -0
  44. data/spec/fixtures/hexa.bin +1 -0
  45. data/spec/fixtures/message_for_sending.bin +0 -0
  46. data/spec/rails_root/config/apple_push_notification_development.pem +19 -0
  47. data/spec/spec_helper.rb +55 -0
  48. metadata +214 -24
@@ -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'}.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 CHANGED
@@ -1,55 +1,223 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apn_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ hash: 15
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - markbates
14
+ - Rebecca Nesson
8
15
  autorequire:
9
16
  bindir: bin
10
17
  cert_chain: []
11
18
 
12
- date: 2010-01-26 00:00:00 -05:00
19
+ date: 2010-10-07 00:00:00 -04:00
13
20
  default_executable:
14
21
  dependencies:
15
22
  - !ruby/object:Gem::Dependency
16
- name: configatron
17
23
  type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
24
+ prerelease: false
25
+ name: configatron
26
+ version_requirements: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 3
32
+ segments:
33
+ - 0
34
+ version: "0"
35
+ requirement: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ type: :development
38
+ prerelease: false
39
+ name: sqlite3-ruby
40
+ version_requirements: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ requirement: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ type: :development
52
+ prerelease: false
53
+ name: rspec
54
+ version_requirements: &id003 !ruby/object:Gem::Requirement
55
+ none: false
20
56
  requirements:
21
57
  - - ">="
22
58
  - !ruby/object:Gem::Version
59
+ hash: 62196421
60
+ segments:
61
+ - 2
62
+ - 0
63
+ - 0
64
+ - beta
65
+ - 19
66
+ version: 2.0.0.beta.19
67
+ requirement: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ type: :development
70
+ prerelease: false
71
+ name: bundler
72
+ version_requirements: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 15424063
78
+ segments:
79
+ - 1
80
+ - 0
81
+ - 0
82
+ - rc
83
+ - 5
84
+ version: 1.0.0.rc.5
85
+ requirement: *id004
86
+ - !ruby/object:Gem::Dependency
87
+ type: :development
88
+ prerelease: false
89
+ name: jeweler
90
+ version_requirements: &id005 !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ hash: -1876988199
96
+ segments:
97
+ - 1
98
+ - 5
99
+ - 0
100
+ - pre2
101
+ version: 1.5.0.pre2
102
+ requirement: *id005
103
+ - !ruby/object:Gem::Dependency
104
+ type: :development
105
+ prerelease: false
106
+ name: rcov
107
+ version_requirements: &id006 !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ hash: 3
113
+ segments:
114
+ - 0
23
115
  version: "0"
24
- version:
25
- description: "apn_on_rails was developed by: markbates"
26
- email: mark@markbates.com
116
+ requirement: *id006
117
+ - !ruby/object:Gem::Dependency
118
+ type: :development
119
+ prerelease: false
120
+ name: actionpack
121
+ version_requirements: &id007 !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ~>
125
+ - !ruby/object:Gem::Version
126
+ hash: 19
127
+ segments:
128
+ - 2
129
+ - 3
130
+ - 8
131
+ version: 2.3.8
132
+ requirement: *id007
133
+ - !ruby/object:Gem::Dependency
134
+ type: :development
135
+ prerelease: false
136
+ name: activerecord
137
+ version_requirements: &id008 !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ~>
141
+ - !ruby/object:Gem::Version
142
+ hash: 19
143
+ segments:
144
+ - 2
145
+ - 3
146
+ - 8
147
+ version: 2.3.8
148
+ requirement: *id008
149
+ description: |
150
+ APN on Rails is a Ruby on Rails gem that allows you to
151
+ easily add Apple Push Notification (iPhone) support to your Rails application.
152
+
153
+ email: tech-team@prx.org
27
154
  executables: []
28
155
 
29
156
  extensions: []
30
157
 
31
158
  extra_rdoc_files:
32
- - README
33
159
  - LICENSE
160
+ - README
161
+ - README.textile
34
162
  files:
163
+ - .gitignore
164
+ - .rspec
165
+ - .specification
166
+ - Gemfile
167
+ - Gemfile.lock
168
+ - LICENSE
169
+ - README
170
+ - README.textile
171
+ - Rakefile
172
+ - VERSION
173
+ - apn_on_rails.gemspec
174
+ - generators/apn_migrations_generator.rb
175
+ - generators/templates/apn_migrations/001_create_apn_devices.rb
176
+ - generators/templates/apn_migrations/002_create_apn_notifications.rb
177
+ - generators/templates/apn_migrations/003_alter_apn_devices.rb
178
+ - generators/templates/apn_migrations/004_create_apn_apps.rb
179
+ - generators/templates/apn_migrations/005_create_groups.rb
180
+ - generators/templates/apn_migrations/006_alter_apn_groups.rb
181
+ - generators/templates/apn_migrations/007_create_device_groups.rb
182
+ - generators/templates/apn_migrations/008_create_apn_group_notifications.rb
183
+ - generators/templates/apn_migrations/009_create_pull_notifications.rb
184
+ - lib/apn_on_rails.rb
35
185
  - lib/apn_on_rails/apn_on_rails.rb
186
+ - lib/apn_on_rails/app/models/apn/app.rb
36
187
  - lib/apn_on_rails/app/models/apn/base.rb
37
188
  - lib/apn_on_rails/app/models/apn/device.rb
189
+ - lib/apn_on_rails/app/models/apn/device_grouping.rb
190
+ - lib/apn_on_rails/app/models/apn/group.rb
191
+ - lib/apn_on_rails/app/models/apn/group_notification.rb
38
192
  - lib/apn_on_rails/app/models/apn/notification.rb
193
+ - lib/apn_on_rails/app/models/apn/pull_notification.rb
39
194
  - lib/apn_on_rails/libs/connection.rb
40
195
  - lib/apn_on_rails/libs/feedback.rb
41
196
  - lib/apn_on_rails/tasks/apn.rake
42
197
  - lib/apn_on_rails/tasks/db.rake
43
- - lib/apn_on_rails.rb
44
198
  - lib/apn_on_rails_tasks.rb
45
- - README
46
- - LICENSE
47
- - generators/apn_migrations_generator.rb
48
- - generators/templates/apn_migrations/001_create_apn_devices.rb
49
- - generators/templates/apn_migrations/002_create_apn_notifications.rb
50
- - generators/templates/apn_migrations/003_alter_apn_devices.rb
199
+ - spec/active_record/setup_ar.rb
200
+ - spec/apn_on_rails/app/models/apn/app_spec.rb
201
+ - spec/apn_on_rails/app/models/apn/device_spec.rb
202
+ - spec/apn_on_rails/app/models/apn/group_notification_spec.rb
203
+ - spec/apn_on_rails/app/models/apn/notification_spec.rb
204
+ - spec/apn_on_rails/app/models/apn/pull_notification_spec.rb
205
+ - spec/apn_on_rails/libs/connection_spec.rb
206
+ - spec/apn_on_rails/libs/feedback_spec.rb
207
+ - spec/extensions/string.rb
208
+ - spec/factories/app_factory.rb
209
+ - spec/factories/device_factory.rb
210
+ - spec/factories/device_grouping_factory.rb
211
+ - spec/factories/group_factory.rb
212
+ - spec/factories/group_notification_factory.rb
213
+ - spec/factories/notification_factory.rb
214
+ - spec/factories/pull_notification_factory.rb
215
+ - spec/fixtures/hexa.bin
216
+ - spec/fixtures/message_for_sending.bin
217
+ - spec/rails_root/config/apple_push_notification_development.pem
218
+ - spec/spec_helper.rb
51
219
  has_rdoc: true
52
- homepage: http://www.metabates.com
220
+ homepage: http://github.com/PRX/apn_on_rails
53
221
  licenses: []
54
222
 
55
223
  post_install_message:
@@ -58,23 +226,45 @@ rdoc_options: []
58
226
  require_paths:
59
227
  - lib
60
228
  required_ruby_version: !ruby/object:Gem::Requirement
229
+ none: false
61
230
  requirements:
62
231
  - - ">="
63
232
  - !ruby/object:Gem::Version
233
+ hash: 3
234
+ segments:
235
+ - 0
64
236
  version: "0"
65
- version:
66
237
  required_rubygems_version: !ruby/object:Gem::Requirement
238
+ none: false
67
239
  requirements:
68
240
  - - ">="
69
241
  - !ruby/object:Gem::Version
242
+ hash: 3
243
+ segments:
244
+ - 0
70
245
  version: "0"
71
- version:
72
246
  requirements: []
73
247
 
74
- rubyforge_project: magrathea
75
- rubygems_version: 1.3.5
248
+ rubyforge_project:
249
+ rubygems_version: 1.3.7
76
250
  signing_key:
77
251
  specification_version: 3
78
- summary: apn_on_rails
79
- test_files: []
80
-
252
+ summary: Apple Push Notifications on Rails
253
+ test_files:
254
+ - spec/active_record/setup_ar.rb
255
+ - spec/apn_on_rails/app/models/apn/app_spec.rb
256
+ - spec/apn_on_rails/app/models/apn/device_spec.rb
257
+ - spec/apn_on_rails/app/models/apn/group_notification_spec.rb
258
+ - spec/apn_on_rails/app/models/apn/notification_spec.rb
259
+ - spec/apn_on_rails/app/models/apn/pull_notification_spec.rb
260
+ - spec/apn_on_rails/libs/connection_spec.rb
261
+ - spec/apn_on_rails/libs/feedback_spec.rb
262
+ - spec/extensions/string.rb
263
+ - spec/factories/app_factory.rb
264
+ - spec/factories/device_factory.rb
265
+ - spec/factories/device_grouping_factory.rb
266
+ - spec/factories/group_factory.rb
267
+ - spec/factories/group_notification_factory.rb
268
+ - spec/factories/notification_factory.rb
269
+ - spec/factories/pull_notification_factory.rb
270
+ - spec/spec_helper.rb