apn_sender 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = apn_sender
2
2
 
3
- So you're building the server component of an iPhone application in Ruby. And you want to send background notifications through the Apple Push Notification servers, which doesn't seem too bad. But then you read in the {Apple Documentation}[https://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/WhatAreRemoteNotif/WhatAreRemoteNotif.html#//apple_ref/doc/uid/TP40008194-CH102-SW7] (<em>Apple Dev account required</em>) that the Apple's servers may treat non-persistent connections as a Denial of Service attack, and things started looking more complicated.
3
+ So you're building the server component of an iPhone application in Ruby. And you want to send background notifications through the Apple Push Notification servers, which doesn't seem too bad. But then you read in the {Apple Documentation}[https://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/WhatAreRemoteNotif/WhatAreRemoteNotif.html#//apple_ref/doc/uid/TP40008194-CH102-SW7] (<em>Apple Dev account required</em>) that Apple's servers may treat non-persistent connections as a Denial of Service attack, and things started looking more complicated.
4
4
 
5
5
  If this doesn't sound familiar, this gem probably isn't anything you need. If it does, though...
6
6
 
@@ -49,11 +49,16 @@ There's also an included sample <code>apn_sender.monitrc</code> file in the <cod
49
49
 
50
50
  APN is built on top of {Resque}[http://github.com/defunkt/resque] (an awesome {Redis}[http://code.google.com/p/redis/]-based background runner similar to {delayed_job}[http://github.com/collectiveidea/delayed_job]). Read through the {Resque README}[http://github.com/defunkt/resque#readme] to get a feel for what's going on, follow the installation instructions there, and then run:
51
51
 
52
- $ sudo gem install apple_push_notification
52
+ $ sudo gem install apn_sender
53
53
 
54
54
  In your Rails app, add
55
55
 
56
- config.gem 'apple_push_notification'
56
+ config.gem 'apn_sender', :lib => 'apn'
57
+
58
+ To add a few useful rake tasks for running workers, add the following line to your Rakefile:
59
+
60
+ require 'apn/tasks'
61
+
57
62
 
58
63
  == Copyright
59
64
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/apn_sender.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{apn_sender}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kali Donovan"]
data/lib/apn.rb CHANGED
@@ -1,6 +1,3 @@
1
- $:.unshift(File.dirname(__FILE__)) unless
2
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
-
4
1
  require 'resque'
5
2
  require 'resque/plugins/access_worker_from_job'
6
3
  require 'resque/hooks/before_unregister_worker'
data/lib/apn/sender.rb CHANGED
@@ -113,7 +113,7 @@ __END__
113
113
 
114
114
  ## To enqueue test job
115
115
  Resque.enqueue APN::NotificationJob, 'ceecdc18 ef17b2d0 745475e0 0a6cd5bf 54534184 ac2649eb 40873c81 ae76dbe8', {:alert => 'Resque Test'}
116
-
116
+ APN.notify 'ceecdc18 ef17b2d0 745475e0 0a6cd5bf 54534184 ac2649eb 40873c81 ae76dbe8', 'Resque Test'
117
117
 
118
118
  ## To run worker from rake task
119
119
  CERT_PATH=/Users/kali/Code/insurrection/certs/ ENVIRONMENT=production rake apn:work
data/lib/apn/tasks.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  # Slight modifications from the default Resque tasks
2
2
  namespace :apn do
3
3
  task :setup
4
- task :sender => :work
5
- task :senders => :workers
4
+ task :work => :sender
5
+ task :workers => :senders
6
6
 
7
7
  desc "Start an APN worker"
8
- task :work => :setup do
8
+ task :sender => :setup do
9
9
  require 'lib/apple_push_notification'
10
10
 
11
11
  worker = nil
@@ -25,7 +25,7 @@ namespace :apn do
25
25
  end
26
26
 
27
27
  desc "Start multiple APN workers. Should only be used in dev mode."
28
- task :workers do
28
+ task :senders do
29
29
  threads = []
30
30
 
31
31
  ENV['COUNT'].to_i.times do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apn_sender
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kali Donovan