rpush 1.0.0-java → 2.0.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +37 -22
- data/bin/rpush +13 -4
- data/lib/generators/rpush_generator.rb +2 -0
- data/lib/generators/templates/add_adm.rb +5 -5
- data/lib/generators/templates/add_alert_is_json_to_rapns_notifications.rb +1 -1
- data/lib/generators/templates/add_app_to_rapns.rb +2 -2
- data/lib/generators/templates/add_fail_after_to_rpush_notifications.rb +1 -1
- data/lib/generators/templates/add_gcm.rb +32 -32
- data/lib/generators/templates/add_rpush.rb +67 -67
- data/lib/generators/templates/add_wpns.rb +2 -2
- data/lib/generators/templates/create_rapns_apps.rb +5 -5
- data/lib/generators/templates/create_rapns_feedback.rb +2 -2
- data/lib/generators/templates/create_rapns_notifications.rb +15 -15
- data/lib/generators/templates/rpush.rb +28 -7
- data/lib/generators/templates/rpush_2_0_0_updates.rb +42 -0
- data/lib/rpush/client/active_model/adm/app.rb +23 -0
- data/lib/rpush/client/active_model/adm/data_validator.rb +14 -0
- data/lib/rpush/client/active_model/adm/notification.rb +28 -0
- data/lib/rpush/client/active_model/apns/app.rb +37 -0
- data/lib/rpush/client/active_model/apns/binary_notification_validator.rb +16 -0
- data/lib/rpush/client/active_model/apns/device_token_format_validator.rb +14 -0
- data/lib/rpush/client/active_model/apns/notification.rb +90 -0
- data/lib/rpush/client/active_model/gcm/app.rb +19 -0
- data/lib/rpush/client/active_model/gcm/expiry_collapse_key_mutual_inclusion_validator.rb +14 -0
- data/lib/rpush/client/active_model/gcm/notification.rb +31 -0
- data/lib/rpush/client/active_model/notification.rb +26 -0
- data/lib/rpush/client/active_model/payload_data_size_validator.rb +13 -0
- data/lib/rpush/client/active_model/registration_ids_count_validator.rb +13 -0
- data/lib/rpush/client/active_model/wpns/app.rb +13 -0
- data/lib/rpush/client/active_model/wpns/notification.rb +17 -0
- data/lib/rpush/client/active_model.rb +21 -0
- data/lib/rpush/client/active_record/adm/app.rb +11 -0
- data/lib/rpush/client/active_record/adm/notification.rb +11 -0
- data/lib/rpush/client/active_record/apns/app.rb +11 -0
- data/lib/rpush/client/active_record/apns/feedback.rb +22 -0
- data/lib/rpush/client/active_record/apns/notification.rb +46 -0
- data/lib/rpush/client/active_record/app.rb +17 -0
- data/lib/rpush/client/active_record/gcm/app.rb +11 -0
- data/lib/rpush/client/active_record/gcm/notification.rb +11 -0
- data/lib/rpush/client/active_record/notification.rb +38 -0
- data/lib/rpush/client/active_record/wpns/app.rb +11 -0
- data/lib/rpush/client/active_record/wpns/notification.rb +11 -0
- data/lib/rpush/client/active_record.rb +19 -0
- data/lib/rpush/client/redis/adm/app.rb +14 -0
- data/lib/rpush/client/redis/adm/notification.rb +11 -0
- data/lib/rpush/client/redis/apns/app.rb +11 -0
- data/lib/rpush/client/redis/apns/feedback.rb +20 -0
- data/lib/rpush/client/redis/apns/notification.rb +11 -0
- data/lib/rpush/client/redis/app.rb +24 -0
- data/lib/rpush/client/redis/gcm/app.rb +11 -0
- data/lib/rpush/client/redis/gcm/notification.rb +11 -0
- data/lib/rpush/client/redis/notification.rb +68 -0
- data/lib/rpush/client/redis/wpns/app.rb +11 -0
- data/lib/rpush/client/redis/wpns/notification.rb +11 -0
- data/lib/rpush/client/redis.rb +35 -0
- data/lib/rpush/configuration.rb +27 -6
- data/lib/rpush/daemon/adm/delivery.rb +56 -55
- data/lib/rpush/daemon/apns/delivery.rb +20 -44
- data/lib/rpush/daemon/apns/feedback_receiver.rb +11 -8
- data/lib/rpush/daemon/apns.rb +6 -5
- data/lib/rpush/daemon/app_runner.rb +103 -99
- data/lib/rpush/daemon/batch.rb +54 -40
- data/lib/rpush/daemon/delivery.rb +13 -3
- data/lib/rpush/daemon/delivery_error.rb +10 -2
- data/lib/rpush/daemon/dispatcher/apns_tcp.rb +114 -0
- data/lib/rpush/daemon/dispatcher/http.rb +3 -3
- data/lib/rpush/daemon/dispatcher/tcp.rb +3 -3
- data/lib/rpush/daemon/dispatcher_loop.rb +37 -23
- data/lib/rpush/daemon/errors.rb +18 -0
- data/lib/rpush/daemon/feeder.rb +28 -39
- data/lib/rpush/daemon/gcm/delivery.rb +19 -20
- data/lib/rpush/daemon/interruptible_sleep.rb +26 -45
- data/lib/rpush/daemon/loggable.rb +2 -4
- data/lib/rpush/daemon/proc_title.rb +16 -0
- data/lib/rpush/daemon/queue_payload.rb +12 -0
- data/lib/rpush/daemon/reflectable.rb +3 -5
- data/lib/rpush/daemon/retry_header_parser.rb +6 -6
- data/lib/rpush/daemon/retryable_error.rb +2 -0
- data/lib/rpush/daemon/ring_buffer.rb +16 -0
- data/lib/rpush/daemon/service_config_methods.rb +23 -7
- data/lib/rpush/daemon/signal_handler.rb +56 -0
- data/lib/rpush/daemon/store/active_record/reconnectable.rb +21 -17
- data/lib/rpush/daemon/store/active_record.rb +71 -38
- data/lib/rpush/daemon/store/interface.rb +19 -0
- data/lib/rpush/daemon/store/redis.rb +149 -0
- data/lib/rpush/daemon/string_helpers.rb +15 -0
- data/lib/rpush/daemon/synchronizer.rb +60 -0
- data/lib/rpush/daemon/tcp_connection.rb +6 -11
- data/lib/rpush/daemon/wpns/delivery.rb +21 -30
- data/lib/rpush/daemon.rb +40 -60
- data/lib/rpush/deprecatable.rb +4 -3
- data/lib/rpush/deprecation.rb +7 -10
- data/lib/rpush/embed.rb +8 -3
- data/lib/rpush/logger.rb +11 -15
- data/lib/rpush/push.rb +1 -2
- data/lib/rpush/reflection.rb +8 -12
- data/lib/rpush/version.rb +1 -1
- data/lib/rpush.rb +5 -29
- data/lib/tasks/quality.rake +35 -0
- data/lib/tasks/test.rake +1 -5
- data/spec/.rubocop.yml +4 -0
- data/spec/functional/adm_spec.rb +3 -6
- data/spec/functional/apns_spec.rb +117 -24
- data/spec/functional/embed_spec.rb +20 -20
- data/spec/functional/gcm_spec.rb +4 -7
- data/spec/functional/new_app_spec.rb +59 -0
- data/spec/functional/retry_spec.rb +46 -0
- data/spec/functional/synchronization_spec.rb +68 -0
- data/spec/functional/wpns_spec.rb +3 -6
- data/spec/functional_spec_helper.rb +26 -0
- data/spec/integration/rpush_spec.rb +13 -0
- data/spec/integration/support/gcm_success_response.json +1 -0
- data/spec/spec_helper.rb +60 -0
- data/spec/support/active_record_setup.rb +48 -0
- data/{config → spec/support/config}/database.yml +0 -0
- data/spec/support/install.sh +43 -7
- data/spec/support/simplecov_helper.rb +9 -5
- data/spec/support/simplecov_quality_formatter.rb +10 -6
- data/spec/unit/apns_feedback_spec.rb +3 -3
- data/spec/unit/{adm → client/active_record/adm}/app_spec.rb +3 -3
- data/spec/unit/{adm → client/active_record/adm}/notification_spec.rb +5 -7
- data/spec/unit/client/active_record/apns/app_spec.rb +29 -0
- data/spec/unit/client/active_record/apns/feedback_spec.rb +9 -0
- data/spec/unit/client/active_record/apns/notification_spec.rb +231 -0
- data/spec/unit/client/active_record/app_spec.rb +30 -0
- data/spec/unit/client/active_record/gcm/app_spec.rb +4 -0
- data/spec/unit/{gcm → client/active_record/gcm}/notification_spec.rb +5 -7
- data/spec/unit/client/active_record/notification_spec.rb +21 -0
- data/spec/unit/client/active_record/wpns/app_spec.rb +4 -0
- data/spec/unit/client/active_record/wpns/notification_spec.rb +21 -0
- data/spec/unit/configuration_spec.rb +12 -5
- data/spec/unit/daemon/adm/delivery_spec.rb +66 -55
- data/spec/unit/daemon/apns/certificate_expired_error_spec.rb +3 -3
- data/spec/unit/daemon/apns/delivery_spec.rb +90 -83
- data/spec/unit/daemon/apns/feedback_receiver_spec.rb +22 -17
- data/spec/unit/daemon/app_runner_spec.rb +78 -186
- data/spec/unit/daemon/batch_spec.rb +52 -115
- data/spec/unit/daemon/delivery_spec.rb +15 -1
- data/spec/unit/daemon/dispatcher/http_spec.rb +3 -2
- data/spec/unit/daemon/dispatcher/tcp_spec.rb +10 -9
- data/spec/unit/daemon/dispatcher_loop_spec.rb +6 -24
- data/spec/unit/daemon/feeder_spec.rb +38 -39
- data/spec/unit/daemon/gcm/delivery_spec.rb +122 -101
- data/spec/unit/daemon/reflectable_spec.rb +2 -2
- data/spec/unit/daemon/retryable_error_spec.rb +1 -1
- data/spec/unit/daemon/service_config_methods_spec.rb +6 -3
- data/spec/unit/daemon/signal_handler_spec.rb +95 -0
- data/spec/unit/daemon/store/active_record/reconnectable_spec.rb +48 -27
- data/spec/unit/daemon/store/active_record_spec.rb +38 -47
- data/spec/unit/daemon/tcp_connection_spec.rb +22 -34
- data/spec/unit/daemon/wpns/delivery_spec.rb +58 -50
- data/spec/unit/daemon_spec.rb +48 -82
- data/spec/unit/embed_spec.rb +6 -4
- data/spec/unit/logger_spec.rb +35 -43
- data/spec/unit/notification_shared.rb +9 -79
- data/spec/unit/push_spec.rb +6 -10
- data/spec/unit/reflection_spec.rb +25 -25
- data/spec/unit/rpush_spec.rb +1 -2
- data/spec/unit_spec_helper.rb +33 -88
- metadata +126 -76
- data/lib/rpush/TODO +0 -3
- data/lib/rpush/adm/app.rb +0 -15
- data/lib/rpush/adm/data_validator.rb +0 -11
- data/lib/rpush/adm/notification.rb +0 -29
- data/lib/rpush/apns/app.rb +0 -29
- data/lib/rpush/apns/binary_notification_validator.rb +0 -12
- data/lib/rpush/apns/device_token_format_validator.rb +0 -12
- data/lib/rpush/apns/feedback.rb +0 -16
- data/lib/rpush/apns/notification.rb +0 -84
- data/lib/rpush/app.rb +0 -18
- data/lib/rpush/daemon/apns/certificate_expired_error.rb +0 -20
- data/lib/rpush/daemon/apns/disconnection_error.rb +0 -20
- data/lib/rpush/daemon/dispatcher_loop_collection.rb +0 -33
- data/lib/rpush/daemon/too_many_requests_error.rb +0 -20
- data/lib/rpush/gcm/app.rb +0 -11
- data/lib/rpush/gcm/expiry_collapse_key_mutual_inclusion_validator.rb +0 -11
- data/lib/rpush/gcm/notification.rb +0 -30
- data/lib/rpush/notification.rb +0 -69
- data/lib/rpush/notifier.rb +0 -52
- data/lib/rpush/payload_data_size_validator.rb +0 -10
- data/lib/rpush/railtie.rb +0 -11
- data/lib/rpush/registration_ids_count_validator.rb +0 -10
- data/lib/rpush/wpns/app.rb +0 -9
- data/lib/rpush/wpns/notification.rb +0 -26
- data/lib/tasks/cane.rake +0 -18
- data/lib/tasks/rpush.rake +0 -16
- data/spec/unit/apns/app_spec.rb +0 -29
- data/spec/unit/apns/feedback_spec.rb +0 -9
- data/spec/unit/apns/notification_spec.rb +0 -208
- data/spec/unit/app_spec.rb +0 -30
- data/spec/unit/daemon/apns/disconnection_error_spec.rb +0 -18
- data/spec/unit/daemon/dispatcher_loop_collection_spec.rb +0 -37
- data/spec/unit/daemon/interruptible_sleep_spec.rb +0 -68
- data/spec/unit/daemon/too_many_requests_error_spec.rb +0 -14
- data/spec/unit/gcm/app_spec.rb +0 -4
- data/spec/unit/notification_spec.rb +0 -15
- data/spec/unit/notifier_spec.rb +0 -49
- data/spec/unit/wpns/app_spec.rb +0 -4
- data/spec/unit/wpns/notification_spec.rb +0 -30
data/spec/unit_spec_helper.rb
CHANGED
@@ -1,101 +1,46 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rails'
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
require 'active_record'
|
7
|
-
|
8
|
-
unless ENV['TRAVIS'] && ENV['QUALITY'] == 'false'
|
9
|
-
begin
|
10
|
-
require './spec/support/simplecov_helper'
|
11
|
-
include SimpleCovHelper
|
12
|
-
start_simple_cov("unit-#{RUBY_VERSION}")
|
13
|
-
rescue LoadError
|
14
|
-
puts "Coverage disabled."
|
15
|
-
end
|
4
|
+
def unit_example?(example)
|
5
|
+
path = example.metadata[:example_group][:file_path]
|
6
|
+
path =~ /spec\/unit/
|
16
7
|
end
|
17
8
|
|
18
|
-
|
19
|
-
|
20
|
-
$adapter = ENV['ADAPTER'] || 'postgresql'
|
21
|
-
$adapter = 'jdbc' + $adapter if jruby
|
22
|
-
|
23
|
-
DATABASE_CONFIG = YAML.load_file(File.expand_path("../config/database.yml", File.dirname(__FILE__)))
|
24
|
-
|
25
|
-
if DATABASE_CONFIG[$adapter].nil?
|
26
|
-
puts "No such adapter '#{$adapter}'. Valid adapters are #{DATABASE_CONFIG.keys.join(', ')}."
|
27
|
-
exit 1
|
28
|
-
end
|
29
|
-
|
30
|
-
if ENV['TRAVIS']
|
31
|
-
DATABASE_CONFIG[$adapter]['username'] = 'postgres'
|
32
|
-
else
|
33
|
-
require 'etc'
|
34
|
-
username = $adapter =~ /mysql/ ? 'root' : Etc.getlogin
|
35
|
-
DATABASE_CONFIG[$adapter]['username'] = username
|
36
|
-
end
|
37
|
-
|
38
|
-
puts "Using #{$adapter} adapter."
|
39
|
-
|
40
|
-
ActiveRecord::Base.configurations = {"test" => DATABASE_CONFIG[$adapter]}
|
41
|
-
ActiveRecord::Base.establish_connection(DATABASE_CONFIG[$adapter])
|
42
|
-
|
43
|
-
require 'generators/templates/add_rpush'
|
44
|
-
|
45
|
-
migrations = [AddRpush]
|
46
|
-
|
47
|
-
migrations.reverse.each do |m|
|
48
|
-
begin
|
49
|
-
m.down
|
50
|
-
rescue ActiveRecord::StatementInvalid => e
|
51
|
-
p e
|
52
|
-
end
|
9
|
+
def rails4?
|
10
|
+
::Rails::VERSION::STRING >= '4'
|
53
11
|
end
|
54
12
|
|
55
|
-
migrations.each(&:up)
|
56
|
-
|
57
|
-
require 'database_cleaner'
|
58
|
-
DatabaseCleaner.strategy = :truncation
|
59
|
-
|
60
|
-
require 'rpush'
|
61
|
-
require 'rpush/daemon'
|
62
|
-
|
63
|
-
Rpush::Daemon.initialize_store
|
64
|
-
Rpush::Notification.reset_column_information
|
65
|
-
Rpush::App.reset_column_information
|
66
|
-
Rpush::Apns::Feedback.reset_column_information
|
67
|
-
|
68
13
|
RSpec.configure do |config|
|
69
|
-
# config.before :suite do
|
70
|
-
# PerfTools::CpuProfiler.start('/tmp/rpush_profile')
|
71
|
-
# end
|
72
|
-
# config.after :suite do
|
73
|
-
# PerfTools::CpuProfiler.stop
|
74
|
-
# end
|
75
|
-
|
76
14
|
config.before(:each) do
|
77
|
-
|
15
|
+
Modis.with_connection do |redis|
|
16
|
+
redis.keys('rpush:*').each { |key| redis.del(key) }
|
17
|
+
end
|
18
|
+
|
19
|
+
if unit_example?(example)
|
20
|
+
connection = ActiveRecord::Base.connection
|
21
|
+
|
22
|
+
if rails4?
|
23
|
+
connection.begin_transaction joinable: false
|
24
|
+
else
|
25
|
+
connection.increment_open_transactions
|
26
|
+
connection.transaction_joinable = false
|
27
|
+
connection.begin_db_transaction
|
28
|
+
end
|
29
|
+
end
|
78
30
|
end
|
79
31
|
|
80
32
|
config.after(:each) do
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
33
|
+
if unit_example?(example)
|
34
|
+
connection = ActiveRecord::Base.connection
|
35
|
+
|
36
|
+
if rails4?
|
37
|
+
connection.rollback_transaction if connection.transaction_open?
|
38
|
+
else
|
39
|
+
if connection.open_transactions != 0
|
40
|
+
connection.rollback_db_transaction
|
41
|
+
connection.decrement_open_transactions
|
42
|
+
end
|
43
|
+
end
|
85
44
|
end
|
86
45
|
end
|
87
46
|
end
|
88
|
-
|
89
|
-
# a test certificate that contains both an X509 certificate and
|
90
|
-
# a private key, similar to those used for connecting to Apple
|
91
|
-
# push notification servers.
|
92
|
-
#
|
93
|
-
# Note that we cannot validate the certificate and private key
|
94
|
-
# because we are missing the certificate chain used to validate
|
95
|
-
# the certificate, and this is private to Apple. So if the app
|
96
|
-
# has a certificate and a private key in it, the only way to find
|
97
|
-
# out if it really is valid is to connect to Apple's servers.
|
98
|
-
|
99
|
-
path = File.join(File.dirname(__FILE__), 'support')
|
100
|
-
TEST_CERT = File.read(File.join(path, 'cert_without_password.pem'))
|
101
|
-
TEST_CERT_WITH_PASSWORD = File.read(File.join(path, 'cert_with_password.pem'))
|
metadata
CHANGED
@@ -1,72 +1,86 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rpush
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Ian Leitch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: multi_json
|
14
15
|
version_requirements: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
17
|
- - ~>
|
17
18
|
- !ruby/object:Gem::Version
|
18
19
|
version: '1.0'
|
19
|
-
type: :runtime
|
20
|
-
prerelease: false
|
21
|
-
name: multi_json
|
22
20
|
requirement: !ruby/object:Gem::Requirement
|
23
21
|
requirements:
|
24
22
|
- - ~>
|
25
23
|
- !ruby/object:Gem::Version
|
26
24
|
version: '1.0'
|
25
|
+
prerelease: false
|
26
|
+
type: :runtime
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: net-http-persistent
|
28
29
|
version_requirements: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - '>='
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '0'
|
33
|
-
type: :runtime
|
34
|
-
prerelease: false
|
35
|
-
name: net-http-persistent
|
36
34
|
requirement: !ruby/object:Gem::Requirement
|
37
35
|
requirements:
|
38
36
|
- - '>='
|
39
37
|
- !ruby/object:Gem::Version
|
40
38
|
version: '0'
|
39
|
+
prerelease: false
|
40
|
+
type: :runtime
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
+
name: activesupport
|
42
43
|
version_requirements: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
45
|
- - '>='
|
45
46
|
- !ruby/object:Gem::Version
|
46
47
|
version: '0'
|
47
|
-
type: :runtime
|
48
|
-
prerelease: false
|
49
|
-
name: jruby-openssl
|
50
48
|
requirement: !ruby/object:Gem::Requirement
|
51
49
|
requirements:
|
52
50
|
- - '>='
|
53
51
|
- !ruby/object:Gem::Version
|
54
52
|
version: '0'
|
53
|
+
prerelease: false
|
54
|
+
type: :runtime
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
+
name: jruby-openssl
|
56
57
|
version_requirements: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
59
|
- - '>='
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: '0'
|
61
|
-
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
62
67
|
prerelease: false
|
68
|
+
type: :runtime
|
69
|
+
- !ruby/object:Gem::Dependency
|
63
70
|
name: activerecord-jdbc-adapter
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
64
76
|
requirement: !ruby/object:Gem::Requirement
|
65
77
|
requirements:
|
66
78
|
- - '>='
|
67
79
|
- !ruby/object:Gem::Version
|
68
80
|
version: '0'
|
69
|
-
|
81
|
+
prerelease: false
|
82
|
+
type: :runtime
|
83
|
+
description: The push notification service for Ruby.
|
70
84
|
email:
|
71
85
|
- port001@gmail.com
|
72
86
|
executables:
|
@@ -77,8 +91,6 @@ files:
|
|
77
91
|
- CHANGELOG.md
|
78
92
|
- LICENSE
|
79
93
|
- README.md
|
80
|
-
- bin/rpush
|
81
|
-
- config/database.yml
|
82
94
|
- lib/generators/rpush_generator.rb
|
83
95
|
- lib/generators/templates/add_adm.rb
|
84
96
|
- lib/generators/templates/add_alert_is_json_to_rapns_notifications.rb
|
@@ -92,95 +104,135 @@ files:
|
|
92
104
|
- lib/generators/templates/create_rapns_notifications.rb
|
93
105
|
- lib/generators/templates/rename_rapns_to_rpush.rb
|
94
106
|
- lib/generators/templates/rpush.rb
|
107
|
+
- lib/generators/templates/rpush_2_0_0_updates.rb
|
95
108
|
- lib/rpush.rb
|
96
|
-
- lib/rpush/TODO
|
97
|
-
- lib/rpush/adm/app.rb
|
98
|
-
- lib/rpush/adm/data_validator.rb
|
99
|
-
- lib/rpush/adm/notification.rb
|
100
|
-
- lib/rpush/apns/app.rb
|
101
|
-
- lib/rpush/apns/binary_notification_validator.rb
|
102
|
-
- lib/rpush/apns/device_token_format_validator.rb
|
103
|
-
- lib/rpush/apns/feedback.rb
|
104
|
-
- lib/rpush/apns/notification.rb
|
105
109
|
- lib/rpush/apns_feedback.rb
|
106
|
-
- lib/rpush/
|
110
|
+
- lib/rpush/client/active_model.rb
|
111
|
+
- lib/rpush/client/active_model/adm/app.rb
|
112
|
+
- lib/rpush/client/active_model/adm/data_validator.rb
|
113
|
+
- lib/rpush/client/active_model/adm/notification.rb
|
114
|
+
- lib/rpush/client/active_model/apns/app.rb
|
115
|
+
- lib/rpush/client/active_model/apns/binary_notification_validator.rb
|
116
|
+
- lib/rpush/client/active_model/apns/device_token_format_validator.rb
|
117
|
+
- lib/rpush/client/active_model/apns/notification.rb
|
118
|
+
- lib/rpush/client/active_model/gcm/app.rb
|
119
|
+
- lib/rpush/client/active_model/gcm/expiry_collapse_key_mutual_inclusion_validator.rb
|
120
|
+
- lib/rpush/client/active_model/gcm/notification.rb
|
121
|
+
- lib/rpush/client/active_model/notification.rb
|
122
|
+
- lib/rpush/client/active_model/payload_data_size_validator.rb
|
123
|
+
- lib/rpush/client/active_model/registration_ids_count_validator.rb
|
124
|
+
- lib/rpush/client/active_model/wpns/app.rb
|
125
|
+
- lib/rpush/client/active_model/wpns/notification.rb
|
126
|
+
- lib/rpush/client/active_record.rb
|
127
|
+
- lib/rpush/client/active_record/adm/app.rb
|
128
|
+
- lib/rpush/client/active_record/adm/notification.rb
|
129
|
+
- lib/rpush/client/active_record/apns/app.rb
|
130
|
+
- lib/rpush/client/active_record/apns/feedback.rb
|
131
|
+
- lib/rpush/client/active_record/apns/notification.rb
|
132
|
+
- lib/rpush/client/active_record/app.rb
|
133
|
+
- lib/rpush/client/active_record/gcm/app.rb
|
134
|
+
- lib/rpush/client/active_record/gcm/notification.rb
|
135
|
+
- lib/rpush/client/active_record/notification.rb
|
136
|
+
- lib/rpush/client/active_record/wpns/app.rb
|
137
|
+
- lib/rpush/client/active_record/wpns/notification.rb
|
138
|
+
- lib/rpush/client/redis.rb
|
139
|
+
- lib/rpush/client/redis/adm/app.rb
|
140
|
+
- lib/rpush/client/redis/adm/notification.rb
|
141
|
+
- lib/rpush/client/redis/apns/app.rb
|
142
|
+
- lib/rpush/client/redis/apns/feedback.rb
|
143
|
+
- lib/rpush/client/redis/apns/notification.rb
|
144
|
+
- lib/rpush/client/redis/app.rb
|
145
|
+
- lib/rpush/client/redis/gcm/app.rb
|
146
|
+
- lib/rpush/client/redis/gcm/notification.rb
|
147
|
+
- lib/rpush/client/redis/notification.rb
|
148
|
+
- lib/rpush/client/redis/wpns/app.rb
|
149
|
+
- lib/rpush/client/redis/wpns/notification.rb
|
107
150
|
- lib/rpush/configuration.rb
|
108
151
|
- lib/rpush/daemon.rb
|
109
152
|
- lib/rpush/daemon/adm.rb
|
110
153
|
- lib/rpush/daemon/adm/delivery.rb
|
111
154
|
- lib/rpush/daemon/apns.rb
|
112
|
-
- lib/rpush/daemon/apns/certificate_expired_error.rb
|
113
155
|
- lib/rpush/daemon/apns/delivery.rb
|
114
|
-
- lib/rpush/daemon/apns/disconnection_error.rb
|
115
156
|
- lib/rpush/daemon/apns/feedback_receiver.rb
|
116
157
|
- lib/rpush/daemon/app_runner.rb
|
117
158
|
- lib/rpush/daemon/batch.rb
|
118
159
|
- lib/rpush/daemon/constants.rb
|
119
160
|
- lib/rpush/daemon/delivery.rb
|
120
161
|
- lib/rpush/daemon/delivery_error.rb
|
162
|
+
- lib/rpush/daemon/dispatcher/apns_tcp.rb
|
121
163
|
- lib/rpush/daemon/dispatcher/http.rb
|
122
164
|
- lib/rpush/daemon/dispatcher/tcp.rb
|
123
165
|
- lib/rpush/daemon/dispatcher_loop.rb
|
124
|
-
- lib/rpush/daemon/
|
166
|
+
- lib/rpush/daemon/errors.rb
|
125
167
|
- lib/rpush/daemon/feeder.rb
|
126
168
|
- lib/rpush/daemon/gcm.rb
|
127
169
|
- lib/rpush/daemon/gcm/delivery.rb
|
128
170
|
- lib/rpush/daemon/interruptible_sleep.rb
|
129
171
|
- lib/rpush/daemon/loggable.rb
|
172
|
+
- lib/rpush/daemon/proc_title.rb
|
173
|
+
- lib/rpush/daemon/queue_payload.rb
|
130
174
|
- lib/rpush/daemon/reflectable.rb
|
131
175
|
- lib/rpush/daemon/retry_header_parser.rb
|
132
176
|
- lib/rpush/daemon/retryable_error.rb
|
177
|
+
- lib/rpush/daemon/ring_buffer.rb
|
133
178
|
- lib/rpush/daemon/service_config_methods.rb
|
179
|
+
- lib/rpush/daemon/signal_handler.rb
|
134
180
|
- lib/rpush/daemon/store/active_record.rb
|
135
181
|
- lib/rpush/daemon/store/active_record/reconnectable.rb
|
182
|
+
- lib/rpush/daemon/store/interface.rb
|
183
|
+
- lib/rpush/daemon/store/redis.rb
|
184
|
+
- lib/rpush/daemon/string_helpers.rb
|
185
|
+
- lib/rpush/daemon/synchronizer.rb
|
136
186
|
- lib/rpush/daemon/tcp_connection.rb
|
137
|
-
- lib/rpush/daemon/too_many_requests_error.rb
|
138
187
|
- lib/rpush/daemon/wpns.rb
|
139
188
|
- lib/rpush/daemon/wpns/delivery.rb
|
140
189
|
- lib/rpush/deprecatable.rb
|
141
190
|
- lib/rpush/deprecation.rb
|
142
191
|
- lib/rpush/embed.rb
|
143
|
-
- lib/rpush/gcm/app.rb
|
144
|
-
- lib/rpush/gcm/expiry_collapse_key_mutual_inclusion_validator.rb
|
145
|
-
- lib/rpush/gcm/notification.rb
|
146
192
|
- lib/rpush/logger.rb
|
147
193
|
- lib/rpush/multi_json_helper.rb
|
148
|
-
- lib/rpush/notification.rb
|
149
|
-
- lib/rpush/notifier.rb
|
150
|
-
- lib/rpush/payload_data_size_validator.rb
|
151
194
|
- lib/rpush/push.rb
|
152
|
-
- lib/rpush/railtie.rb
|
153
195
|
- lib/rpush/reflection.rb
|
154
|
-
- lib/rpush/registration_ids_count_validator.rb
|
155
196
|
- lib/rpush/version.rb
|
156
|
-
- lib/
|
157
|
-
- lib/rpush/wpns/notification.rb
|
158
|
-
- lib/tasks/cane.rake
|
159
|
-
- lib/tasks/rpush.rake
|
197
|
+
- lib/tasks/quality.rake
|
160
198
|
- lib/tasks/test.rake
|
199
|
+
- spec/.rubocop.yml
|
161
200
|
- spec/functional/adm_spec.rb
|
162
201
|
- spec/functional/apns_spec.rb
|
163
202
|
- spec/functional/embed_spec.rb
|
164
203
|
- spec/functional/gcm_spec.rb
|
204
|
+
- spec/functional/new_app_spec.rb
|
205
|
+
- spec/functional/retry_spec.rb
|
206
|
+
- spec/functional/synchronization_spec.rb
|
165
207
|
- spec/functional/wpns_spec.rb
|
208
|
+
- spec/functional_spec_helper.rb
|
209
|
+
- spec/integration/rpush_spec.rb
|
210
|
+
- spec/integration/support/gcm_success_response.json
|
211
|
+
- spec/spec_helper.rb
|
212
|
+
- spec/support/active_record_setup.rb
|
166
213
|
- spec/support/cert_with_password.pem
|
167
214
|
- spec/support/cert_without_password.pem
|
215
|
+
- spec/support/config/database.yml
|
168
216
|
- spec/support/install.sh
|
169
217
|
- spec/support/simplecov_helper.rb
|
170
218
|
- spec/support/simplecov_quality_formatter.rb
|
171
219
|
- spec/tmp/.gitkeep
|
172
|
-
- spec/unit/adm/app_spec.rb
|
173
|
-
- spec/unit/adm/notification_spec.rb
|
174
|
-
- spec/unit/apns/app_spec.rb
|
175
|
-
- spec/unit/apns/feedback_spec.rb
|
176
|
-
- spec/unit/apns/notification_spec.rb
|
177
220
|
- spec/unit/apns_feedback_spec.rb
|
178
|
-
- spec/unit/app_spec.rb
|
221
|
+
- spec/unit/client/active_record/adm/app_spec.rb
|
222
|
+
- spec/unit/client/active_record/adm/notification_spec.rb
|
223
|
+
- spec/unit/client/active_record/apns/app_spec.rb
|
224
|
+
- spec/unit/client/active_record/apns/feedback_spec.rb
|
225
|
+
- spec/unit/client/active_record/apns/notification_spec.rb
|
226
|
+
- spec/unit/client/active_record/app_spec.rb
|
227
|
+
- spec/unit/client/active_record/gcm/app_spec.rb
|
228
|
+
- spec/unit/client/active_record/gcm/notification_spec.rb
|
229
|
+
- spec/unit/client/active_record/notification_spec.rb
|
230
|
+
- spec/unit/client/active_record/wpns/app_spec.rb
|
231
|
+
- spec/unit/client/active_record/wpns/notification_spec.rb
|
179
232
|
- spec/unit/configuration_spec.rb
|
180
233
|
- spec/unit/daemon/adm/delivery_spec.rb
|
181
234
|
- spec/unit/daemon/apns/certificate_expired_error_spec.rb
|
182
235
|
- spec/unit/daemon/apns/delivery_spec.rb
|
183
|
-
- spec/unit/daemon/apns/disconnection_error_spec.rb
|
184
236
|
- spec/unit/daemon/apns/feedback_receiver_spec.rb
|
185
237
|
- spec/unit/daemon/app_runner_spec.rb
|
186
238
|
- spec/unit/daemon/batch_spec.rb
|
@@ -188,35 +240,28 @@ files:
|
|
188
240
|
- spec/unit/daemon/delivery_spec.rb
|
189
241
|
- spec/unit/daemon/dispatcher/http_spec.rb
|
190
242
|
- spec/unit/daemon/dispatcher/tcp_spec.rb
|
191
|
-
- spec/unit/daemon/dispatcher_loop_collection_spec.rb
|
192
243
|
- spec/unit/daemon/dispatcher_loop_spec.rb
|
193
244
|
- spec/unit/daemon/feeder_spec.rb
|
194
245
|
- spec/unit/daemon/gcm/delivery_spec.rb
|
195
|
-
- spec/unit/daemon/interruptible_sleep_spec.rb
|
196
246
|
- spec/unit/daemon/reflectable_spec.rb
|
197
247
|
- spec/unit/daemon/retryable_error_spec.rb
|
198
248
|
- spec/unit/daemon/service_config_methods_spec.rb
|
249
|
+
- spec/unit/daemon/signal_handler_spec.rb
|
199
250
|
- spec/unit/daemon/store/active_record/reconnectable_spec.rb
|
200
251
|
- spec/unit/daemon/store/active_record_spec.rb
|
201
252
|
- spec/unit/daemon/tcp_connection_spec.rb
|
202
|
-
- spec/unit/daemon/too_many_requests_error_spec.rb
|
203
253
|
- spec/unit/daemon/wpns/delivery_spec.rb
|
204
254
|
- spec/unit/daemon_spec.rb
|
205
255
|
- spec/unit/deprecatable_spec.rb
|
206
256
|
- spec/unit/deprecation_spec.rb
|
207
257
|
- spec/unit/embed_spec.rb
|
208
|
-
- spec/unit/gcm/app_spec.rb
|
209
|
-
- spec/unit/gcm/notification_spec.rb
|
210
258
|
- spec/unit/logger_spec.rb
|
211
259
|
- spec/unit/notification_shared.rb
|
212
|
-
- spec/unit/notification_spec.rb
|
213
|
-
- spec/unit/notifier_spec.rb
|
214
260
|
- spec/unit/push_spec.rb
|
215
261
|
- spec/unit/reflection_spec.rb
|
216
262
|
- spec/unit/rpush_spec.rb
|
217
|
-
- spec/unit/wpns/app_spec.rb
|
218
|
-
- spec/unit/wpns/notification_spec.rb
|
219
263
|
- spec/unit_spec_helper.rb
|
264
|
+
- bin/rpush
|
220
265
|
homepage: https://github.com/rpush/rpush
|
221
266
|
licenses:
|
222
267
|
- MIT
|
@@ -237,35 +282,48 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
237
282
|
version: '0'
|
238
283
|
requirements: []
|
239
284
|
rubyforge_project:
|
240
|
-
rubygems_version: 2.
|
285
|
+
rubygems_version: 2.1.9
|
241
286
|
signing_key:
|
242
287
|
specification_version: 4
|
243
|
-
summary:
|
288
|
+
summary: The push notification service for Ruby.
|
244
289
|
test_files:
|
245
|
-
-
|
290
|
+
- spec/.rubocop.yml
|
246
291
|
- spec/functional/adm_spec.rb
|
247
292
|
- spec/functional/apns_spec.rb
|
248
293
|
- spec/functional/embed_spec.rb
|
249
294
|
- spec/functional/gcm_spec.rb
|
295
|
+
- spec/functional/new_app_spec.rb
|
296
|
+
- spec/functional/retry_spec.rb
|
297
|
+
- spec/functional/synchronization_spec.rb
|
250
298
|
- spec/functional/wpns_spec.rb
|
299
|
+
- spec/functional_spec_helper.rb
|
300
|
+
- spec/integration/rpush_spec.rb
|
301
|
+
- spec/integration/support/gcm_success_response.json
|
302
|
+
- spec/spec_helper.rb
|
303
|
+
- spec/support/active_record_setup.rb
|
251
304
|
- spec/support/cert_with_password.pem
|
252
305
|
- spec/support/cert_without_password.pem
|
306
|
+
- spec/support/config/database.yml
|
253
307
|
- spec/support/install.sh
|
254
308
|
- spec/support/simplecov_helper.rb
|
255
309
|
- spec/support/simplecov_quality_formatter.rb
|
256
310
|
- spec/tmp/.gitkeep
|
257
|
-
- spec/unit/adm/app_spec.rb
|
258
|
-
- spec/unit/adm/notification_spec.rb
|
259
|
-
- spec/unit/apns/app_spec.rb
|
260
|
-
- spec/unit/apns/feedback_spec.rb
|
261
|
-
- spec/unit/apns/notification_spec.rb
|
262
311
|
- spec/unit/apns_feedback_spec.rb
|
263
|
-
- spec/unit/app_spec.rb
|
312
|
+
- spec/unit/client/active_record/adm/app_spec.rb
|
313
|
+
- spec/unit/client/active_record/adm/notification_spec.rb
|
314
|
+
- spec/unit/client/active_record/apns/app_spec.rb
|
315
|
+
- spec/unit/client/active_record/apns/feedback_spec.rb
|
316
|
+
- spec/unit/client/active_record/apns/notification_spec.rb
|
317
|
+
- spec/unit/client/active_record/app_spec.rb
|
318
|
+
- spec/unit/client/active_record/gcm/app_spec.rb
|
319
|
+
- spec/unit/client/active_record/gcm/notification_spec.rb
|
320
|
+
- spec/unit/client/active_record/notification_spec.rb
|
321
|
+
- spec/unit/client/active_record/wpns/app_spec.rb
|
322
|
+
- spec/unit/client/active_record/wpns/notification_spec.rb
|
264
323
|
- spec/unit/configuration_spec.rb
|
265
324
|
- spec/unit/daemon/adm/delivery_spec.rb
|
266
325
|
- spec/unit/daemon/apns/certificate_expired_error_spec.rb
|
267
326
|
- spec/unit/daemon/apns/delivery_spec.rb
|
268
|
-
- spec/unit/daemon/apns/disconnection_error_spec.rb
|
269
327
|
- spec/unit/daemon/apns/feedback_receiver_spec.rb
|
270
328
|
- spec/unit/daemon/app_runner_spec.rb
|
271
329
|
- spec/unit/daemon/batch_spec.rb
|
@@ -273,32 +331,24 @@ test_files:
|
|
273
331
|
- spec/unit/daemon/delivery_spec.rb
|
274
332
|
- spec/unit/daemon/dispatcher/http_spec.rb
|
275
333
|
- spec/unit/daemon/dispatcher/tcp_spec.rb
|
276
|
-
- spec/unit/daemon/dispatcher_loop_collection_spec.rb
|
277
334
|
- spec/unit/daemon/dispatcher_loop_spec.rb
|
278
335
|
- spec/unit/daemon/feeder_spec.rb
|
279
336
|
- spec/unit/daemon/gcm/delivery_spec.rb
|
280
|
-
- spec/unit/daemon/interruptible_sleep_spec.rb
|
281
337
|
- spec/unit/daemon/reflectable_spec.rb
|
282
338
|
- spec/unit/daemon/retryable_error_spec.rb
|
283
339
|
- spec/unit/daemon/service_config_methods_spec.rb
|
340
|
+
- spec/unit/daemon/signal_handler_spec.rb
|
284
341
|
- spec/unit/daemon/store/active_record/reconnectable_spec.rb
|
285
342
|
- spec/unit/daemon/store/active_record_spec.rb
|
286
343
|
- spec/unit/daemon/tcp_connection_spec.rb
|
287
|
-
- spec/unit/daemon/too_many_requests_error_spec.rb
|
288
344
|
- spec/unit/daemon/wpns/delivery_spec.rb
|
289
345
|
- spec/unit/daemon_spec.rb
|
290
346
|
- spec/unit/deprecatable_spec.rb
|
291
347
|
- spec/unit/deprecation_spec.rb
|
292
348
|
- spec/unit/embed_spec.rb
|
293
|
-
- spec/unit/gcm/app_spec.rb
|
294
|
-
- spec/unit/gcm/notification_spec.rb
|
295
349
|
- spec/unit/logger_spec.rb
|
296
350
|
- spec/unit/notification_shared.rb
|
297
|
-
- spec/unit/notification_spec.rb
|
298
|
-
- spec/unit/notifier_spec.rb
|
299
351
|
- spec/unit/push_spec.rb
|
300
352
|
- spec/unit/reflection_spec.rb
|
301
353
|
- spec/unit/rpush_spec.rb
|
302
|
-
- spec/unit/wpns/app_spec.rb
|
303
|
-
- spec/unit/wpns/notification_spec.rb
|
304
354
|
- spec/unit_spec_helper.rb
|
data/lib/rpush/TODO
DELETED
data/lib/rpush/adm/app.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
module Rpush
|
2
|
-
module Adm
|
3
|
-
class App < Rpush::App
|
4
|
-
validates :client_id, :client_secret, :presence => true
|
5
|
-
|
6
|
-
def access_token_expired?
|
7
|
-
self.access_token_expiration.nil? || self.access_token_expiration < Time.now
|
8
|
-
end
|
9
|
-
|
10
|
-
def service_name
|
11
|
-
'adm'
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Rpush
|
2
|
-
module Adm
|
3
|
-
class Notification < Rpush::Notification
|
4
|
-
validates :registration_ids, :presence => true
|
5
|
-
|
6
|
-
validates_with Rpush::PayloadDataSizeValidator, limit: 6144
|
7
|
-
validates_with Rpush::RegistrationIdsCountValidator, limit: 100
|
8
|
-
|
9
|
-
validates_with Rpush::Adm::DataValidator
|
10
|
-
|
11
|
-
def as_json
|
12
|
-
json = {
|
13
|
-
'data' => data
|
14
|
-
}
|
15
|
-
|
16
|
-
if collapse_key
|
17
|
-
json['consolidationKey'] = collapse_key
|
18
|
-
end
|
19
|
-
|
20
|
-
# number of seconds before message is expired
|
21
|
-
if expiry
|
22
|
-
json['expiresAfter'] = expiry
|
23
|
-
end
|
24
|
-
|
25
|
-
json
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/lib/rpush/apns/app.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
module Rpush
|
2
|
-
module Apns
|
3
|
-
class App < Rpush::App
|
4
|
-
validates :environment, :presence => true, :inclusion => { :in => %w(development production sandbox) }
|
5
|
-
validates :certificate, :presence => true
|
6
|
-
validate :certificate_has_matching_private_key
|
7
|
-
|
8
|
-
def service_name
|
9
|
-
'apns'
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
def certificate_has_matching_private_key
|
15
|
-
result = false
|
16
|
-
if certificate.present?
|
17
|
-
begin
|
18
|
-
x509 = OpenSSL::X509::Certificate.new(certificate)
|
19
|
-
pkey = OpenSSL::PKey::RSA.new(certificate, password)
|
20
|
-
result = !x509.nil? && !pkey.nil?
|
21
|
-
rescue OpenSSL::OpenSSLError
|
22
|
-
errors.add :certificate, 'Certificate value must contain a certificate and a private key.'
|
23
|
-
end
|
24
|
-
end
|
25
|
-
result
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module Rpush
|
2
|
-
module Apns
|
3
|
-
class BinaryNotificationValidator < ActiveModel::Validator
|
4
|
-
|
5
|
-
def validate(record)
|
6
|
-
if record.payload_size > 256
|
7
|
-
record.errors[:base] << "APN notification cannot be larger than 256 bytes. Try condensing your alert and device attributes."
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
data/lib/rpush/apns/feedback.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
module Rpush
|
2
|
-
module Apns
|
3
|
-
class Feedback < ActiveRecord::Base
|
4
|
-
self.table_name = 'rpush_feedback'
|
5
|
-
|
6
|
-
if Rpush.attr_accessible_available?
|
7
|
-
attr_accessible :device_token, :failed_at, :app
|
8
|
-
end
|
9
|
-
|
10
|
-
validates :device_token, :presence => true
|
11
|
-
validates :failed_at, :presence => true
|
12
|
-
|
13
|
-
validates_with Rpush::Apns::DeviceTokenFormatValidator
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|