rpush 2.3.2 → 2.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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +1 -1
  4. data/lib/generators/rpush_migration_generator.rb +21 -6
  5. data/lib/generators/templates/rpush.rb +5 -5
  6. data/lib/generators/templates/rpush_2_0_0_updates.rb +24 -0
  7. data/lib/rpush/client/active_model/apns/notification.rb +1 -1
  8. data/lib/rpush/client/mongoid.rb +31 -0
  9. data/lib/rpush/client/mongoid/adm/app.rb +14 -0
  10. data/lib/rpush/client/mongoid/adm/notification.rb +11 -0
  11. data/lib/rpush/client/mongoid/apns/app.rb +11 -0
  12. data/lib/rpush/client/mongoid/apns/feedback.rb +21 -0
  13. data/lib/rpush/client/mongoid/apns/notification.rb +15 -0
  14. data/lib/rpush/client/mongoid/app.rb +23 -0
  15. data/lib/rpush/client/mongoid/gcm/app.rb +11 -0
  16. data/lib/rpush/client/mongoid/gcm/notification.rb +11 -0
  17. data/lib/rpush/client/mongoid/notification.rb +43 -0
  18. data/lib/rpush/client/mongoid/wpns/app.rb +11 -0
  19. data/lib/rpush/client/mongoid/wpns/notification.rb +11 -0
  20. data/lib/rpush/client/redis.rb +2 -2
  21. data/lib/rpush/configuration.rb +48 -29
  22. data/lib/rpush/daemon/adm/delivery.rb +1 -1
  23. data/lib/rpush/daemon/apns.rb +1 -1
  24. data/lib/rpush/daemon/apns/feedback_receiver.rb +2 -3
  25. data/lib/rpush/daemon/dispatcher/apns_tcp.rb +2 -1
  26. data/lib/rpush/daemon/feeder.rb +4 -7
  27. data/lib/rpush/daemon/gcm/delivery.rb +1 -1
  28. data/lib/rpush/daemon/interruptible_sleep.rb +5 -50
  29. data/lib/rpush/daemon/proc_title.rb +2 -1
  30. data/lib/rpush/daemon/store/active_record.rb +4 -0
  31. data/lib/rpush/daemon/store/interface.rb +1 -1
  32. data/lib/rpush/daemon/store/mongoid.rb +157 -0
  33. data/lib/rpush/daemon/store/redis.rb +6 -2
  34. data/lib/rpush/deprecatable.rb +1 -2
  35. data/lib/rpush/deprecation.rb +6 -0
  36. data/lib/rpush/embed.rb +5 -0
  37. data/lib/rpush/logger.rb +5 -8
  38. data/lib/rpush/push.rb +5 -0
  39. data/lib/rpush/version.rb +1 -1
  40. data/lib/tasks/quality.rake +1 -1
  41. data/lib/tasks/test.rake +9 -4
  42. data/spec/functional/apns_spec.rb +2 -1
  43. data/spec/functional_spec_helper.rb +2 -2
  44. data/spec/spec_helper.rb +18 -7
  45. data/spec/support/config/mongoid.yml +69 -0
  46. data/spec/support/mongoid_setup.rb +10 -0
  47. data/spec/unit/client/active_record/adm/app_spec.rb +1 -1
  48. data/spec/unit/client/active_record/adm/notification_spec.rb +1 -1
  49. data/spec/unit/client/active_record/apns/app_spec.rb +1 -1
  50. data/spec/unit/client/active_record/apns/feedback_spec.rb +1 -1
  51. data/spec/unit/client/active_record/apns/notification_spec.rb +11 -11
  52. data/spec/unit/client/active_record/app_spec.rb +1 -1
  53. data/spec/unit/client/active_record/gcm/notification_spec.rb +1 -1
  54. data/spec/unit/client/active_record/notification_spec.rb +1 -1
  55. data/spec/unit/client/active_record/wpns/notification_spec.rb +1 -1
  56. data/spec/unit/configuration_spec.rb +7 -0
  57. data/spec/unit/daemon/apns/feedback_receiver_spec.rb +5 -5
  58. data/spec/unit/daemon/feeder_spec.rb +2 -2
  59. data/spec/unit/daemon/proc_title_spec.rb +11 -0
  60. data/spec/unit/daemon/store/active_record/reconnectable_spec.rb +1 -1
  61. data/spec/unit/daemon/store/active_record_spec.rb +21 -12
  62. data/spec/unit/daemon/store/mongoid_spec.rb +339 -0
  63. data/spec/unit/daemon/store/redis_spec.rb +365 -0
  64. data/spec/unit/embed_spec.rb +4 -2
  65. data/spec/unit/logger_spec.rb +14 -5
  66. data/spec/unit/notification_shared.rb +1 -1
  67. data/spec/unit/push_spec.rb +4 -2
  68. data/spec/unit_spec_helper.rb +3 -3
  69. metadata +25 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 927abaa3a2c391f3d390a0075f5aeaf3ae12a9d0
4
- data.tar.gz: b272119c8cc1ba826dea17fd5e0bde2e261e12a5
3
+ metadata.gz: dcd5a386e63d453ba0a442b2636d17c9f5d1163d
4
+ data.tar.gz: 6bcf897de27d5f489e237ec004883e0d31685741
5
5
  SHA512:
6
- metadata.gz: f30b21a842cca1acfa350be012d2292bb0a2dcb85ab3a859d37f5e63836af026def22481aa6b2d09fe6bfb5527ba8964c3033e804c64274a9ce1119c058b74aa
7
- data.tar.gz: 559c85b0d96ae83c36c37ce62080a6d0f054fadaac6ec26d5b1035cef2f1c1fbcd33efa9da75737608335cf12cda30c463ce5a4b71304f7bc05a0b1858eb2036
6
+ metadata.gz: a35052dca2662df7e86819c6e74eb9ea31fd892da03701c771924dd2c9858bd7b5f36e330cb9e5093300df4809cf627617115e9548514af62a0a4bab1437367d
7
+ data.tar.gz: 1947d69afa9d7fd55688da01a0e5e25d62b4cde78b23c2b66a78b66a044c0fe05650851a2331108a2f2042a2a0133da96be22714484f7a965be15aea204c39dd
@@ -1,3 +1,16 @@
1
+ ## 2.4.0 (Fed 18, 2015)
2
+ Features:
3
+ * Support for MongoDB (using Mongoid).
4
+ * config.feedback_poll is now deprecated, use config.apns.feedback_receiver.frequency instead.
5
+ * Add config.apns.feedback_receiver.enabled to optionally enable the APNs feedback receiver (#129).
6
+ * Passing configuration options directly to Rpush.embed and Rpush.push is now deprecated.
7
+
8
+ Bug fixes:
9
+ * Fix setting the log level when using Rails 4+ or without Rails (#124).
10
+ * Fix the possibility for excessive error logging when using APNs (#128).
11
+ * Re-use timestamp when replacing a migration with the same name (#91).
12
+ * Ensure App/Notification type is updated during 2.0 upgrade migration (#102).
13
+
1
14
  ## 2.3.2 (Jan 30, 2015)
2
15
  Bug fixes:
3
16
  * Internal sleep mechanism would sometimes no wait for the full duration specified.
data/README.md CHANGED
@@ -19,7 +19,7 @@ Rpush aims to be the *de facto* gem for sending push notifications in Ruby. Its
19
19
 
20
20
  #### Feature Highlights
21
21
 
22
- * Use [**ActiveRecord**](https://github.com/rpush/rpush/wiki/Using-ActiveRecord) or [**Redis**](https://github.com/rpush/rpush/wiki/Using-Redis) for storage.
22
+ * Use [**ActiveRecord**](https://github.com/rpush/rpush/wiki/Using-ActiveRecord), [**Redis**](https://github.com/rpush/rpush/wiki/Using-Redis) or [**MongoDB**](https://github.com/rpush/rpush/wiki/Using-Mongodb) for storage.
23
23
  * Plugins for [**Bugsnag**](https://github.com/rpush/rpush-plugin-bugsnag),
24
24
  [**Sentry**](https://github.com/rpush/rpush-plugin-sentry), [**StatsD**](https://github.com/rpush/rpush-plugin-statsd).
25
25
  * Seamless integration with your projects, including **Rails**.
@@ -2,11 +2,25 @@ class RpushMigrationGenerator < Rails::Generators::Base
2
2
  include Rails::Generators::Migration
3
3
  source_root File.expand_path('../templates', __FILE__)
4
4
 
5
- def self.next_migration_number(path)
6
- @time ||= Time.now.utc
7
- @calls ||= -1
8
- @calls += 1
9
- (@time + @calls.seconds).strftime('%Y%m%d%H%M%S')
5
+ class << self
6
+ attr_accessor :next_template
7
+
8
+ def next_migration_number(path)
9
+ return new_migration_number unless next_template
10
+
11
+ if existing_migration = migration_exists?(File.expand_path('db/migrate'), next_template)
12
+ return File.basename(existing_migration).scan(/(\d+)_/).flatten.first
13
+ end
14
+
15
+ new_migration_number
16
+ end
17
+
18
+ def new_migration_number
19
+ @time ||= Time.now.utc
20
+ @calls ||= -1
21
+ @calls += 1
22
+ (@time + @calls.seconds).strftime('%Y%m%d%H%M%S')
23
+ end
10
24
  end
11
25
 
12
26
  def copy_migration
@@ -36,6 +50,7 @@ class RpushMigrationGenerator < Rails::Generators::Base
36
50
  end
37
51
 
38
52
  def add_rpush_migration(template)
39
- migration_template "#{template}.rb", "db/migrate/#{template}.rb"
53
+ self.class.next_template = template
54
+ migration_template "#{template}.rb", "db/migrate/#{template}.rb"
40
55
  end
41
56
  end
@@ -1,6 +1,6 @@
1
1
  Rpush.configure do |config|
2
2
 
3
- # Supported clients are :active_record and :redis.
3
+ # Supported clients are :active_record, :redis and :mongoid
4
4
  config.client = :active_record
5
5
 
6
6
  # Options passed to Redis.new
@@ -9,9 +9,6 @@ Rpush.configure do |config|
9
9
  # Frequency in seconds to check for new notifications.
10
10
  config.push_poll = 2
11
11
 
12
- # Frequency in seconds to check for feedback
13
- config.feedback_poll = 60
14
-
15
12
  # The maximum number of notifications to load from the store every `push_poll` seconds.
16
13
  # If some notifications are still enqueued internally, Rpush will load the batch_size less
17
14
  # the number enqueued. An exception to this is if the service is able to receive multiple
@@ -24,11 +21,14 @@ Rpush.configure do |config|
24
21
  # Path to log file. Relative to current directory unless absolute.
25
22
  config.log_file = 'log/rpush.log'
26
23
 
27
- config.log_level = (defined?(Rails) && Rails.logger) ? Rails.logger.level : ::Logger::Severity::INFO
24
+ config.log_level = (defined?(Rails) && Rails.logger) ? Rails.logger.level : ::Logger::Severity::DEBUG
28
25
 
29
26
  # Define a custom logger.
30
27
  # config.logger = MyLogger.new
31
28
 
29
+ # config.apns.feedback_receiver.enabled = true
30
+ # config.apns.feedback_receiver.frequency = 60
31
+
32
32
  end
33
33
 
34
34
  Rpush.reflect do |on|
@@ -1,4 +1,18 @@
1
1
  class Rpush200Updates < ActiveRecord::Migration
2
+ module Rpush
3
+ class App < ActiveRecord::Base
4
+ self.table_name = 'rpush_apps'
5
+ end
6
+
7
+ class Notification < ActiveRecord::Base
8
+ self.table_name = 'rpush_notifications'
9
+ end
10
+ end
11
+
12
+ def self.update_type(model, from, to)
13
+ model.where(type: from).update_all(type: to)
14
+ end
15
+
2
16
  def self.up
3
17
  add_column :rpush_notifications, :processing, :boolean, null: false, default: false
4
18
  add_column :rpush_notifications, :priority, :integer, null: true
@@ -16,9 +30,19 @@ class Rpush200Updates < ActiveRecord::Migration
16
30
  else
17
31
  change_column :rpush_feedback, :app_id, :integer
18
32
  end
33
+
34
+ [:Apns, :Gcm, :Wpns, :Adm].each do |service|
35
+ update_type(Rpush200Updates::Rpush::App, "Rpush::#{service}::App", "Rpush::Client::ActiveRecord::#{service}::App")
36
+ update_type(Rpush200Updates::Rpush::Notification, "Rpush::#{service}::Notification", "Rpush::Client::ActiveRecord::#{service}::Notification")
37
+ end
19
38
  end
20
39
 
21
40
  def self.down
41
+ [:Apns, :Gcm, :Wpns, :Adm].each do |service|
42
+ update_type(Rpush200Updates::Rpush::App, "Rpush::Client::ActiveRecord::#{service}::App", "Rpush::#{service}::App")
43
+ update_type(Rpush200Updates::Rpush::Notification, "Rpush::Client::ActiveRecord::#{service}::Notification", "Rpush::#{service}::Notification")
44
+ end
45
+
22
46
  change_column :rpush_feedback, :app_id, :string
23
47
  rename_column :rpush_feedback, :app_id, :app
24
48
 
@@ -66,7 +66,7 @@ module Rpush
66
66
 
67
67
  def to_binary(options = {}) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
68
68
  frame_payload = payload
69
- frame_id = options[:for_validation] ? 0 : id
69
+ frame_id = options[:for_validation] ? 0 : send(options.fetch(:id_attribute, :id))
70
70
  frame = ""
71
71
  frame << [1, 32, device_token].pack("cnH*")
72
72
  frame << [2, frame_payload.bytesize, frame_payload].pack("cna*")
@@ -0,0 +1,31 @@
1
+
2
+ # :nocov:
3
+ begin
4
+ require 'mongoid'
5
+ require 'autoinc'
6
+ rescue LoadError
7
+ puts
8
+ str = "* Please add 'rpush-mongoid' to your Gemfile to use the Mongoid client. *"
9
+ puts "*" * str.size
10
+ puts str
11
+ puts "*" * str.size
12
+ puts
13
+ end
14
+
15
+ require 'rpush/client/active_model'
16
+
17
+ require 'rpush/client/mongoid/notification'
18
+ require 'rpush/client/mongoid/app'
19
+
20
+ require 'rpush/client/mongoid/apns/notification'
21
+ require 'rpush/client/mongoid/apns/feedback'
22
+ require 'rpush/client/mongoid/apns/app'
23
+
24
+ require 'rpush/client/mongoid/gcm/notification'
25
+ require 'rpush/client/mongoid/gcm/app'
26
+
27
+ require 'rpush/client/mongoid/wpns/notification'
28
+ require 'rpush/client/mongoid/wpns/app'
29
+
30
+ require 'rpush/client/mongoid/adm/notification'
31
+ require 'rpush/client/mongoid/adm/app'
@@ -0,0 +1,14 @@
1
+ module Rpush
2
+ module Client
3
+ module Mongoid
4
+ module Adm
5
+ class App < Rpush::Client::Mongoid::App
6
+ include Rpush::Client::ActiveModel::Adm::App
7
+
8
+ field :access_token, type: String
9
+ field :access_token_expiration, type: Time
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ module Rpush
2
+ module Client
3
+ module Mongoid
4
+ module Adm
5
+ class Notification < Rpush::Client::Mongoid::Notification
6
+ include Rpush::Client::ActiveModel::Adm::Notification
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Rpush
2
+ module Client
3
+ module Mongoid
4
+ module Apns
5
+ class App < Rpush::Client::Mongoid::App
6
+ include Rpush::Client::ActiveModel::Apns::App
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,21 @@
1
+ module Rpush
2
+ module Client
3
+ module Mongoid
4
+ module Apns
5
+ class Feedback
6
+ include ::Mongoid::Document
7
+
8
+ field :device_token, type: String
9
+ field :failed_at, type: Time
10
+
11
+ belongs_to :app
12
+
13
+ validates :device_token, presence: true
14
+ validates :failed_at, presence: true
15
+
16
+ validates_with Rpush::Client::ActiveModel::Apns::DeviceTokenFormatValidator
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,15 @@
1
+ module Rpush
2
+ module Client
3
+ module Mongoid
4
+ module Apns
5
+ class Notification < Rpush::Client::Mongoid::Notification
6
+ include Rpush::Client::ActiveModel::Apns::Notification
7
+
8
+ def to_binary(options = {})
9
+ super(options.merge(id_attribute: :integer_id))
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,23 @@
1
+ module Rpush
2
+ module Client
3
+ module Mongoid
4
+ class App
5
+ include ::Mongoid::Document
6
+
7
+ field :name, type: String
8
+ field :environment, type: String
9
+ field :certificate, type: String
10
+ field :password, type: String
11
+ field :connections, type: Integer, default: 1
12
+ field :auth_key, type: String
13
+ field :client_id, type: String
14
+ field :client_secret, type: String
15
+
16
+ index name: 1
17
+
18
+ validates :name, presence: true
19
+ validates_numericality_of :connections, greater_than: 0, only_integer: true
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,11 @@
1
+ module Rpush
2
+ module Client
3
+ module Mongoid
4
+ module Gcm
5
+ class App < Rpush::Client::Mongoid::App
6
+ include Rpush::Client::ActiveModel::Gcm::App
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Rpush
2
+ module Client
3
+ module Mongoid
4
+ module Gcm
5
+ class Notification < Rpush::Client::Mongoid::Notification
6
+ include Rpush::Client::ActiveModel::Gcm::Notification
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,43 @@
1
+ module Rpush
2
+ module Client
3
+ module Mongoid
4
+ class Notification
5
+ include ::Mongoid::Document
6
+ include ::Mongoid::Autoinc
7
+ include Rpush::MultiJsonHelper
8
+ include Rpush::Client::ActiveModel::Notification
9
+
10
+ field :badge, type: Integer
11
+ field :device_token, type: String
12
+ field :sound, type: String, default: 'default'
13
+ field :alert, type: String
14
+ field :data, type: Hash
15
+ field :expiry, type: Integer, default: 1.day.to_i
16
+ field :delivered, type: Boolean, default: false
17
+ field :delivered_at, type: Time
18
+ field :processing, type: Boolean, default: false
19
+ field :failed, type: Boolean, default: false
20
+ field :failed_at, type: Time
21
+ field :fail_after, type: Time
22
+ field :retries, type: Integer, default: 0
23
+ field :error_code, type: Integer
24
+ field :error_description, type: String
25
+ field :deliver_after, type: Time
26
+ field :alert_is_json, type: Boolean
27
+ field :collapse_key, type: String
28
+ field :delay_while_idle, type: Boolean
29
+ field :registration_ids, type: Array
30
+ field :uri, type: String
31
+ field :priority, type: Integer
32
+ field :url_args, type: Array
33
+ field :category, type: String
34
+
35
+ field :integer_id, type: Integer
36
+ increments :integer_id, model_name: name
37
+ index integer_id: 1
38
+
39
+ belongs_to :app
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,11 @@
1
+ module Rpush
2
+ module Client
3
+ module Mongoid
4
+ module Wpns
5
+ class App < Rpush::Client::Mongoid::App
6
+ include Rpush::Client::ActiveModel::Wpns::App
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Rpush
2
+ module Client
3
+ module Mongoid
4
+ module Wpns
5
+ class Notification < Rpush::Client::Mongoid::Notification
6
+ include Rpush::Client::ActiveModel::Wpns::Notification
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,6 +1,8 @@
1
+
1
2
  # :nocov:
2
3
  begin
3
4
  require 'modis'
5
+ require 'redis'
4
6
  rescue LoadError
5
7
  puts
6
8
  str = "* Please add 'rpush-redis' to your Gemfile to use the Redis client. *"
@@ -10,8 +12,6 @@ rescue LoadError
10
12
  puts
11
13
  end
12
14
 
13
- require 'redis'
14
-
15
15
  require 'rpush/client/active_model'
16
16
 
17
17
  require 'rpush/client/redis/app'
@@ -1,35 +1,64 @@
1
1
  require 'pathname'
2
2
 
3
3
  module Rpush
4
- def self.config
5
- @config ||= Rpush::Configuration.new
6
- end
4
+ class << self
5
+ attr_writer :config
6
+
7
+ def config
8
+ @config ||= Rpush::Configuration.new
9
+ end
7
10
 
8
- def self.configure
9
- if block_given?
11
+ def configure
12
+ return unless block_given?
10
13
  yield config
11
14
  config.initialize_client
12
15
  end
13
16
  end
14
17
 
15
- CURRENT_ATTRS = [:push_poll, :feedback_poll, :embedded, :pid_file, :batch_size,
16
- :push, :client, :logger, :log_file, :foreground, :log_level, :plugin]
17
- DEPRECATED_ATTRS = [:log_dir]
18
+ CURRENT_ATTRS = [:push_poll, :embedded, :pid_file, :batch_size, :push, :client, :logger, :log_file, :foreground, :log_level, :plugin, :apns]
19
+ DEPRECATED_ATTRS = [:feedback_poll]
18
20
  CONFIG_ATTRS = CURRENT_ATTRS + DEPRECATED_ATTRS
19
21
 
20
22
  class ConfigurationError < StandardError; end
21
- class ConfigurationWithoutDefaults < Struct.new(*CONFIG_ATTRS); end
23
+ class ConfigurationWithoutDefaults < Struct.new(*CONFIG_ATTRS); end # rubocop:disable Style/StructInheritance
22
24
 
23
- class Configuration < Struct.new(*CONFIG_ATTRS)
24
- include Deprecatable
25
+ class ApnsFeedbackReceiverConfiguration < Struct.new(:frequency, :enabled) # rubocop:disable Style/StructInheritance
26
+ def initialize
27
+ super
28
+ self.enabled = true
29
+ self.frequency = 60
30
+ end
31
+ end
32
+
33
+ class ApnsConfiguration < Struct.new(:feedback_receiver) # rubocop:disable Style/StructInheritance
34
+ def initialize
35
+ super
36
+ self.feedback_receiver = ApnsFeedbackReceiverConfiguration.new
37
+ end
38
+ end
25
39
 
26
- deprecated(:log_dir=, '2.3.0', 'Please use log_file instead.')
40
+ class Configuration < Struct.new(*CONFIG_ATTRS) # rubocop:disable Style/StructInheritance
41
+ include Deprecatable
27
42
 
28
43
  delegate :redis_options, to: '::Modis'
29
44
 
30
45
  def initialize
31
46
  super
32
- set_defaults
47
+
48
+ self.push_poll = 2
49
+ self.batch_size = 100
50
+ self.logger = nil
51
+ self.log_file = 'log/rpush.log'
52
+ self.pid_file = 'tmp/rpush.pid'
53
+ self.log_level = (defined?(Rails) && Rails.logger) ? Rails.logger.level : ::Logger::Severity::DEBUG
54
+ self.plugin = OpenStruct.new
55
+ self.foreground = false
56
+
57
+ self.apns = ApnsConfiguration.new
58
+
59
+ # Internal options.
60
+ self.embedded = false
61
+ self.push = false
33
62
  end
34
63
 
35
64
  def update(other)
@@ -68,31 +97,21 @@ module Rpush
68
97
  Modis.redis_options = options if client == :redis
69
98
  end
70
99
 
71
- def set_defaults
72
- self.push_poll = 2
73
- self.feedback_poll = 60
74
- self.batch_size = 100
75
- self.logger = nil
76
- self.log_file = 'log/rpush.log'
77
- self.pid_file = 'tmp/rpush.pid'
78
- self.log_level = (defined?(Rails) && Rails.logger) ? Rails.logger.level : ::Logger::Severity::INFO
79
- self.plugin = OpenStruct.new
80
- self.foreground = false
81
-
82
- # Internal options.
83
- self.embedded = false
84
- self.push = false
100
+ def feedback_poll=(frequency)
101
+ apns.feedback_receiver.frequency = frequency
85
102
  end
103
+ deprecated(:feedback_poll=, '2.5.0', 'Please use apns.feedback_receiver.frequency= instead.')
86
104
 
87
105
  def initialize_client
88
106
  return if @client_initialized
89
107
  raise ConfigurationError, 'Rpush.config.client is not set.' unless client
90
108
  require "rpush/client/#{client}"
109
+
91
110
  client_module = Rpush::Client.const_get(client.to_s.camelize)
92
- Rpush.send(:include, client_module)
111
+ Rpush.send(:include, client_module) unless Rpush.ancestors.include?(client_module)
93
112
 
94
113
  [:Apns, :Gcm, :Wpns, :Adm].each do |service|
95
- Rpush.const_set(service, client_module.const_get(service))
114
+ Rpush.const_set(service, client_module.const_get(service)) unless Rpush.const_defined?(service)
96
115
  end
97
116
 
98
117
  @client_initialized = true