Module: Rpush
- Defined in:
- lib/rpush.rb,
lib/rpush.rb,
lib/rpush/cli.rb,
lib/rpush/push.rb,
lib/rpush/embed.rb,
lib/rpush/daemon.rb,
lib/rpush/logger.rb,
lib/rpush/version.rb,
lib/rpush/daemon/adm.rb,
lib/rpush/daemon/gcm.rb,
lib/rpush/reflection.rb,
lib/rpush/daemon/apns.rb,
lib/rpush/daemon/wpns.rb,
lib/rpush/deprecation.rb,
lib/rpush/daemon/batch.rb,
lib/rpush/deprecatable.rb,
lib/rpush/apns_feedback.rb,
lib/rpush/configuration.rb,
lib/rpush/daemon/errors.rb,
lib/rpush/daemon/feeder.rb,
lib/rpush/daemon/delivery.rb,
lib/rpush/daemon/loggable.rb,
lib/rpush/client/redis/app.rb,
lib/rpush/daemon/constants.rb,
lib/rpush/daemon/app_runner.rb,
lib/rpush/daemon/proc_title.rb,
lib/rpush/multi_json_helper.rb,
lib/rpush/daemon/reflectable.rb,
lib/rpush/daemon/ring_buffer.rb,
lib/rpush/daemon/store/redis.rb,
lib/rpush/daemon/adm/delivery.rb,
lib/rpush/daemon/gcm/delivery.rb,
lib/rpush/daemon/synchronizer.rb,
lib/rpush/client/redis/adm/app.rb,
lib/rpush/client/redis/gcm/app.rb,
lib/rpush/daemon/apns/delivery.rb,
lib/rpush/daemon/queue_payload.rb,
lib/rpush/daemon/wpns/delivery.rb,
lib/rpush/client/redis/apns/app.rb,
lib/rpush/client/redis/wpns/app.rb,
lib/rpush/daemon/delivery_error.rb,
lib/rpush/daemon/dispatcher/tcp.rb,
lib/rpush/daemon/signal_handler.rb,
lib/rpush/daemon/string_helpers.rb,
lib/rpush/daemon/tcp_connection.rb,
lib/rpush/daemon/dispatcher/http.rb,
lib/rpush/daemon/dispatcher_loop.rb,
lib/rpush/daemon/retryable_error.rb,
lib/rpush/daemon/store/interface.rb,
lib/rpush/client/active_record/app.rb,
lib/rpush/client/redis/notification.rb,
lib/rpush/client/redis/apns/feedback.rb,
lib/rpush/daemon/dispatcher/apns_tcp.rb,
lib/rpush/daemon/interruptible_sleep.rb,
lib/rpush/daemon/retry_header_parser.rb,
lib/rpush/daemon/store/active_record.rb,
lib/rpush/client/active_model/adm/app.rb,
lib/rpush/client/active_model/gcm/app.rb,
lib/rpush/client/active_model/apns/app.rb,
lib/rpush/client/active_model/wpns/app.rb,
lib/rpush/client/active_record/adm/app.rb,
lib/rpush/client/active_record/gcm/app.rb,
lib/rpush/client/active_record/apns/app.rb,
lib/rpush/client/active_record/wpns/app.rb,
lib/rpush/client/redis/adm/notification.rb,
lib/rpush/client/redis/gcm/notification.rb,
lib/rpush/daemon/apns/feedback_receiver.rb,
lib/rpush/daemon/service_config_methods.rb,
lib/rpush/client/redis/apns/notification.rb,
lib/rpush/client/redis/wpns/notification.rb,
lib/rpush/client/active_model/notification.rb,
lib/rpush/client/active_record/notification.rb,
lib/rpush/client/active_record/apns/feedback.rb,
lib/rpush/client/active_model/adm/notification.rb,
lib/rpush/client/active_model/gcm/notification.rb,
lib/rpush/client/active_model/apns/notification.rb,
lib/rpush/client/active_model/wpns/notification.rb,
lib/rpush/client/active_record/adm/notification.rb,
lib/rpush/client/active_record/gcm/notification.rb,
lib/rpush/client/active_model/adm/data_validator.rb,
lib/rpush/client/active_record/apns/notification.rb,
lib/rpush/client/active_record/wpns/notification.rb,
lib/rpush/daemon/store/active_record/reconnectable.rb,
lib/rpush/client/active_model/payload_data_size_validator.rb,
lib/rpush/client/active_model/registration_ids_count_validator.rb,
lib/rpush/client/active_model/apns/binary_notification_validator.rb,
lib/rpush/client/active_model/apns/device_token_format_validator.rb,
lib/rpush/client/active_model/gcm/expiry_collapse_key_mutual_inclusion_validator.rb
Defined Under Namespace
Modules: Client, Daemon, Deprecatable, MultiJsonHelper
Classes: CLI, CertificateExpiredError, Configuration, ConfigurationWithoutDefaults, DeliveryError, Deprecation, Logger, RateLimitError, Reflections, RetryableError
Constant Summary
collapse
- VERSION =
'2.1.0'
- CONFIG_ATTRS =
[:push_poll, :feedback_poll, :embedded, :pid_file, :batch_size,
:push, :client, :logger, :log_file, :foreground, :log_level,
:log_dir]
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.logger ⇒ Object
32
33
34
|
# File 'lib/rpush.rb', line 32
def self.logger
@logger ||= Logger.new
end
|
Class Method Details
.attr_accessible_available? ⇒ Boolean
6
7
8
9
10
11
12
|
# File 'lib/rpush.rb', line 6
def self.attr_accessible_available?
require 'rails'
rescue LoadError
false
else
::Rails::VERSION::STRING < '4' || defined?(::ActiveRecord::MassAssignmentSecurity)
end
|
.config ⇒ Object
2
3
4
|
# File 'lib/rpush/configuration.rb', line 2
def self.config
@config ||= Rpush::Configuration.new
end
|
6
7
8
9
10
11
|
# File 'lib/rpush/configuration.rb', line 6
def self.configure
if block_given?
yield config
initialize_client
end
end
|
.embed(options = {}) ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/rpush/embed.rb', line 2
def self.embed(options = {})
require 'rpush/daemon'
if @embed_thread
STDERR.puts 'Rpush.embed can only be run once inside this process.'
end
config = Rpush::ConfigurationWithoutDefaults.new
options.each { |k, v| config.send("#{k}=", v) }
config.embedded = true
Rpush.config.update(config)
Kernel.at_exit { shutdown }
@embed_thread = Thread.new { Rpush::Daemon.start }
end
|
.initialize_client ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/rpush/configuration.rb', line 13
def self.initialize_client
return if @client_initialized
require "rpush/client/#{config.client}"
client_module = Rpush::Client.const_get(config.client.to_s.camelize)
Rpush.send(:include, client_module)
[:Apns, :Gcm, :Wpns, :Adm].each do |service|
Rpush.const_set(service, client_module.const_get(service))
end
@client_initialized = true
end
|
.jruby? ⇒ Boolean
28
29
30
|
# File 'lib/rpush.rb', line 28
def self.jruby?
defined? JRUBY_VERSION
end
|
.push(options = {}) ⇒ Object
.reflect {|reflections| ... } ⇒ Object
2
3
4
|
# File 'lib/rpush/reflection.rb', line 2
def self.reflect
yield reflections if block_given?
end
|
.reflections ⇒ Object
6
7
8
|
# File 'lib/rpush/reflection.rb', line 6
def self.reflections
@reflections ||= Reflections.new
end
|
.root ⇒ Object
36
37
38
39
40
41
|
# File 'lib/rpush.rb', line 36
def self.root
require 'rails'
Rails.root || Dir.pwd
rescue LoadError
Dir.pwd
end
|
.shutdown ⇒ Object
17
18
19
20
21
22
|
# File 'lib/rpush/embed.rb', line 17
def self.shutdown
return unless Rpush.config.embedded
Rpush::Daemon.shutdown
@embed_thread.join if @embed_thread
@embed_thread = nil
end
|