pushr-core 1.0.0.pre.3 → 1.0.0.pre.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85274765fb5539ffa61905eecaff1906c03e6d03
4
- data.tar.gz: 021a862b5e1398dfff9458feabd115aba12a4e2b
3
+ metadata.gz: c4013d245094a4659d51610f6448da91813c933e
4
+ data.tar.gz: dad963d156b9b3d0fda568a7fdbc2426d8ef8230
5
5
  SHA512:
6
- metadata.gz: 44b509c4f4229aa001e43800ceceed7718615ab03333ff6dbe6949389e8d48529f01e3976fa452a609db35203ab887857b6619ea898e940a6fe2a02fe0e0d26d
7
- data.tar.gz: 16525744b386b639176cfdb901c32977c7428735a3046c227614dc864e37f9c6a9cb4f7ec6b32c6f60566e2ee21ca7a1ca6abcd30fdd5f650f8a0bc9cd99dfdf
6
+ metadata.gz: 03bb413cee574cbe9c314fd52352e91ba0265d345afff11b2db1d811800eaede790823367d6c9ab96d33658b178172ba45637424429a34994b18c10947b4f60c
7
+ data.tar.gz: 568ff09d71fd0546c0c6508f29d0c5cf2579f80159cb763e75772338132530d36dd353969c3ef87c0c784c1f9f73beaf07f3845e7f7a634cc114a39e340d1912
data/README.md CHANGED
@@ -43,13 +43,21 @@ it will use that. The configuration is stored in Redis and you add the configura
43
43
  APNS ([see](https://github.com/9to5/pushr-core#generating-certificates)):
44
44
  ```ruby
45
45
  Pushr::ConfigurationApns.create(app: 'app_name', connections: 2, enabled: true,
46
- certificate: File.read('certificate.pem'), feedback_poll: 60, sandbox: false)
46
+ certificate: File.read('certificate.pem'), sandbox: false, skip_check_for_error: false)
47
47
  ```
48
48
 
49
- The `skip_check_for_error` parameter is optional and can be set to `true` or `false`. If set to `true` the APNS service
49
+ The `skip_check_for_error` parameter can be set to `true` or `false`. If set to `true` the APNS service
50
50
  will not check for errors when sending messages. This option should be used in a production environment and improves
51
51
  performance. In production the errors are reported and handled by the feedback service. Please note that if you use
52
- sandbox devices in your production environment you should not `skip_check_for_error`.
52
+ sandbox devices in your production environment you should not set `skip_check_for_error = true`.
53
+
54
+ APNS Feedback:
55
+ ```ruby
56
+ Pushr::ConfigurationApnsFeedback.create(app: 'app_name', connections: 1, enabled: true,
57
+ feedback_poll: 60)
58
+ ```
59
+
60
+ Use this configuration to let a thread check for feedback on all APNS Configurations. It checks every `feedback_poll` in seconds.
53
61
 
54
62
  GCM ([see](http://developer.android.com/guide/google/gcm/gs.html)):
55
63
  ```ruby
@@ -131,4 +139,5 @@ Push runs on Heroku with the following line in the `Procfile`.
131
139
 
132
140
  ## Prerequisites
133
141
 
134
- * Ruby 1.9.x
142
+ * Ruby 1.9.3, 2.0, 2.1
143
+ * Redis
@@ -9,7 +9,7 @@ module Pushr
9
9
 
10
10
  def initialize(attributes = {})
11
11
  attributes.each do |name, value|
12
- send("#{name}=", value)
12
+ send("#{name}=", value) if respond_to?("#{name}=")
13
13
  end
14
14
  end
15
15
 
@@ -1,27 +1,25 @@
1
1
  module Pushr
2
2
  module Daemon
3
3
  class App
4
- @apps = {}
4
+ @apps = []
5
5
 
6
6
  class << self
7
7
  attr_reader :apps
8
8
 
9
9
  def load
10
- Configuration.all.each do |config|
11
- @apps["#{config.app}:#{config.name}"] = App.new(config) if config.enabled == true
12
- end
10
+ @apps = Configuration.all.keep_if { |c| c.enabled == true }.map { |c| App.new(c) }
13
11
  end
14
12
 
15
13
  def total_connections
16
- @apps.values.map(&:connections).inject(0, :+)
14
+ @apps.map(&:connections).inject(0, :+)
17
15
  end
18
16
 
19
17
  def start
20
- @apps.values.map(&:start)
18
+ @apps.map(&:start)
21
19
  end
22
20
 
23
21
  def stop
24
- @apps.values.map(&:stop)
22
+ @apps.map(&:stop)
25
23
  end
26
24
  end
27
25
 
@@ -37,19 +35,10 @@ module Pushr
37
35
 
38
36
  def start
39
37
  @provider = load_provider(@config.name, @config)
40
-
41
- @config.connections.times do |i|
42
- connection = @provider.connectiontype.new(@config, i + 1)
43
- connection.connect
44
-
45
- handler = MessageHandler.new("pushr:#{@config.app}:#{@config.name}", connection, @config.app, i + 1)
46
- handler.start
47
- @handlers << handler
48
- end
38
+ @provider.start
49
39
  end
50
40
 
51
41
  def stop
52
- @handlers.map(&:stop)
53
42
  @provider.stop
54
43
  end
55
44
 
@@ -60,7 +49,7 @@ module Pushr
60
49
  middleware = Pushr::Daemon.const_get("#{klass}".camelize)
61
50
  rescue NameError
62
51
  message = "Could not find matching push provider for #{klass.inspect}. " \
63
- "You may need to install an additional gem (such as push-#{klass})."
52
+ "You may need to install an additional gem (such as pushr-#{klass})."
64
53
  raise LoadError, message
65
54
  end
66
55
 
@@ -1,7 +1,7 @@
1
1
  module Pushr
2
2
  module Daemon
3
3
  class DeliveryError < StandardError
4
- attr_reader :code, :message, :description, :source, :notify
4
+ attr_reader :code, :description, :source, :notify
5
5
 
6
6
  def initialize(code, message, description, source, notify = true)
7
7
  @code = code
@@ -1,7 +1,8 @@
1
1
  module Pushr
2
2
  module Daemon
3
3
  class Settings
4
- attr_accessor :foreground, :pid_file, :error_notification, :feedback_processor, :stats_processor
4
+ attr_reader :pid_file
5
+ attr_accessor :foreground, :error_notification, :feedback_processor, :stats_processor
5
6
 
6
7
  def initialize
7
8
  @foreground = false
@@ -8,7 +8,7 @@ module Pushr
8
8
 
9
9
  def initialize(attributes = {})
10
10
  attributes.each do |name, value|
11
- send("#{name}=", value)
11
+ send("#{name}=", value) if respond_to?("#{name}=")
12
12
  end
13
13
  end
14
14
 
data/lib/pushr/message.rb CHANGED
@@ -6,7 +6,7 @@ module Pushr
6
6
 
7
7
  def initialize(attributes = {})
8
8
  attributes.each do |name, value|
9
- send("#{name}=", value)
9
+ send("#{name}=", value) if respond_to?("#{name}=")
10
10
  end
11
11
  end
12
12
 
@@ -19,6 +19,11 @@ module Pushr
19
19
  end
20
20
  end
21
21
 
22
+ def save!
23
+ save || fail(RecordNotSaved)
24
+ # fail 'x' unless save
25
+ end
26
+
22
27
  def self.next(queue_name, timeout = 3)
23
28
  Pushr::Core.redis do |conn|
24
29
  message = conn.blpop(queue_name, timeout: timeout)
data/lib/pushr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pushr
2
- VERSION = '1.0.0.pre.3'
2
+ VERSION = '1.0.0.pre.4'
3
3
  end
@@ -1,16 +1,27 @@
1
1
  module Pushr
2
2
  module Daemon
3
3
  class Dummy
4
- attr_accessor :configuration
4
+ attr_accessor :configuration, :handlers
5
+
5
6
  def initialize(options)
6
- self.configuration = options
7
+ @configuration = options
8
+ @handlers = []
7
9
  end
8
10
 
9
- def connectiontype
10
- DummySupport::ConnectionDummy
11
+ def start
12
+ configuration.connections.times do |i|
13
+ connection = DummySupport::ConnectionDummy.new(configuration, i + 1)
14
+ connection.connect
15
+
16
+ handler = MessageHandler.new("pushr:#{configuration.app}:#{configuration.name}", connection, configuration.app, i + 1)
17
+ handler.start
18
+ @handlers << handler
19
+ end
11
20
  end
12
21
 
13
- def stop; end
22
+ def stop
23
+ @handlers.map(&:stop)
24
+ end
14
25
  end
15
26
  end
16
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pushr-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.3
4
+ version: 1.0.0.pre.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Pesman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-19 00:00:00.000000000 Z
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis