Module: Rapns
- Defined in:
- lib/rapns/app.rb,
lib/rapns/push.rb,
lib/rapns/embed.rb,
lib/rapns/daemon.rb,
lib/rapns/logger.rb,
lib/rapns/gcm/app.rb,
lib/rapns/version.rb,
lib/rapns_rails_2.rb,
lib/rapns_rails_2.rb,
lib/rapns/apns/app.rb,
lib/rapns/notifier.rb,
lib/rapns/upgraded.rb,
lib/rapns/reflection.rb,
lib/rapns/deprecation.rb,
lib/rapns/daemon/batch.rb,
lib/rapns/deprecatable.rb,
lib/rapns/notification.rb,
lib/rapns/apns/feedback.rb,
lib/rapns/apns_feedback.rb,
lib/rapns/configuration.rb,
lib/rapns/daemon/feeder.rb,
lib/rapns/daemon/delivery.rb,
lib/rapns/gcm/notification.rb,
lib/rapns/apns/notification.rb,
lib/rapns/daemon/app_runner.rb,
lib/rapns/multi_json_helper.rb,
lib/rapns/daemon/reflectable.rb,
lib/rapns/daemon/gcm/delivery.rb,
lib/rapns/daemon/apns/delivery.rb,
lib/rapns/daemon/delivery_error.rb,
lib/rapns/daemon/gcm/app_runner.rb,
lib/rapns/daemon/apns/app_runner.rb,
lib/rapns/daemon/apns/connection.rb,
lib/rapns/daemon/delivery_handler.rb,
lib/rapns/daemon/interruptible_sleep.rb,
lib/rapns/daemon/store/active_record.rb,
lib/rapns/daemon/gcm/delivery_handler.rb,
lib/rapns/daemon/apns/delivery_handler.rb,
lib/rapns/daemon/apns/feedback_receiver.rb,
lib/rapns/daemon/apns/disconnection_error.rb,
lib/rapns/gcm/payload_data_size_validator.rb,
lib/rapns/apns/binary_notification_validator.rb,
lib/rapns/apns/device_token_format_validator.rb,
lib/rapns/daemon/delivery_handler_collection.rb,
lib/rapns/gcm/registration_ids_count_validator.rb,
lib/rapns/daemon/apns/certificate_expired_error.rb,
lib/rapns/daemon/store/active_record/reconnectable.rb,
lib/rapns/gcm/expiry_collapse_key_mutual_inclusion_validator.rb
Defined Under Namespace
Modules: Apns, Daemon, Deprecatable, Gcm, MultiJsonHelper, Upgraded
Classes: App, Configuration, ConfigurationWithoutDefaults, DeliveryError, Deprecation, Logger, Notification, Notifier, Reflections
Constant Summary
collapse
- VERSION =
'3.5.1'
- CONFIG_ATTRS =
[:foreground, :push_poll, :feedback_poll, :embedded,
:airbrake_notify, :check_for_errors, :pid_file, :batch_size,
:push, :store, :logger, :batch_storage_updates, :wakeup]
Class Method Summary
collapse
Class Method Details
.attr_accessible_available? ⇒ Boolean
17
18
19
|
# File 'lib/rapns_rails_2.rb', line 17
def self.attr_accessible_available?
is_rails2_or_3?
end
|
.config ⇒ Object
2
3
4
|
# File 'lib/rapns/configuration.rb', line 2
def self.config
@config ||= Rapns::Configuration.new
end
|
6
7
8
|
# File 'lib/rapns/configuration.rb', line 6
def self.configure
yield config if block_given?
end
|
.embed(options = {}) ⇒ Object
.is_rails2? ⇒ Boolean
6
7
8
9
10
11
|
# File 'lib/rapns_rails_2.rb', line 6
def self.is_rails2?
require 'rails'
false
rescue MissingSourceFile
true
end
|
.is_rails2_or_3? ⇒ Boolean
13
14
15
|
# File 'lib/rapns_rails_2.rb', line 13
def self.is_rails2_or_3?
is_rails2? || ::Rails::VERSION::STRING < '4'
end
|
.jruby? ⇒ Boolean
52
53
54
|
# File 'lib/rapns_rails_2.rb', line 52
def self.jruby?
defined? JRUBY_VERSION
end
|
.logger ⇒ Object
60
61
62
63
|
# File 'lib/rapns_rails_2.rb', line 60
def self.logger
@logger ||= Logger.new(:foreground => Rapns.config.foreground,
:airbrake_notify => Rapns.config.airbrake_notify)
end
|
.logger=(logger) ⇒ Object
65
66
67
|
# File 'lib/rapns_rails_2.rb', line 65
def self.logger=(logger)
@logger = logger
end
|
.notifier ⇒ Object
Default notifier instance. This uses the :connect, :port values in Rapns.config.wakeup to connect to the wakeup socket in the Rapns Daemon. It will fall back to :host, :port if :connect is not specified.
.push(options = {}) ⇒ Object
.reflect {|reflections| ... } ⇒ Object
2
3
4
|
# File 'lib/rapns/reflection.rb', line 2
def self.reflect
yield reflections if block_given?
end
|
.reflections ⇒ Object
6
7
8
|
# File 'lib/rapns/reflection.rb', line 6
def self.reflections
@reflections ||= Reflections.new
end
|
.require_for_daemon ⇒ Object
56
57
58
|
# File 'lib/rapns_rails_2.rb', line 56
def self.require_for_daemon
require 'rapns/daemon'
end
|
.wakeup ⇒ Object
Call this from a client application after saving a Notification to the database to wakeup the Rapns Daemon to deliver the notification immediately.
38
39
40
|
# File 'lib/rapns/notifier.rb', line 38
def self.wakeup
notifier.notify
end
|