rpush 4.0.1 → 4.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/generators/rpush_migration_generator.rb +1 -0
- data/lib/generators/templates/rpush_4_1_0_updates.rb +9 -0
- data/lib/rpush/client/active_model/gcm/notification.rb +2 -0
- data/lib/rpush/client/redis/notification.rb +1 -0
- data/lib/rpush/version.rb +2 -2
- data/spec/support/active_record_setup.rb +3 -1
- data/spec/unit/client/active_record/gcm/notification_spec.rb +24 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b2bd0a00817c1d763652f59881b939ede6de72a70ef13f9ee761f4143170f4f
|
4
|
+
data.tar.gz: 65d645e9b67c459908648c34ceb965e9989831dbd5e61b3d110209e47eb8b1a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61d8c34cf01ee4057fc068a69fb1f79ad3b51e9ab22b0dada132b20560f66134edb228f0085a9d9be9b3a0c608973d185ccaa762ee9282740ec17b1913c255cd
|
7
|
+
data.tar.gz: 9738e9c124d22e3bc981c889b7b6eef59f7e85bf4fd19fb4a23c0b082004107bf178ffa2c9565aaa8cf69c978a98c010dbb4151f7879004c707f630211a06b26
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## 4.1.0 (2019-04-17)
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
- Functionality to use `dry_run` in FCM notifications. This is useful if you want to just validate notification sending works without actually sending a notification to the receivers, fixes #63. ([#492](https://github.com/rpush/rpush/pull/492) by [@aried3r](https://github.com/aried3r))
|
10
|
+
|
5
11
|
## 4.0.1 (2019-04-04)
|
6
12
|
|
7
13
|
### Fixed
|
@@ -50,6 +50,7 @@ class RpushMigrationGenerator < Rails::Generators::Base
|
|
50
50
|
add_rpush_migration('rpush_3_2_4_updates')
|
51
51
|
add_rpush_migration('rpush_3_3_0_updates')
|
52
52
|
add_rpush_migration('rpush_3_3_1_updates')
|
53
|
+
add_rpush_migration('rpush_4_1_0_updates')
|
53
54
|
end
|
54
55
|
|
55
56
|
protected
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class Rpush410Updates < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration["#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}"] : ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :rpush_notifications, :dry_run, :boolean, null: false, default: false
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.down
|
7
|
+
remove_column :rpush_notifications, :dry_run
|
8
|
+
end
|
9
|
+
end
|
@@ -11,6 +11,7 @@ module Rpush
|
|
11
11
|
base.instance_eval do
|
12
12
|
validates :registration_ids, presence: true
|
13
13
|
validates :priority, inclusion: { in: GCM_PRIORITIES }, allow_nil: true
|
14
|
+
validates :dry_run, inclusion: { in: [true, false] }
|
14
15
|
|
15
16
|
validates_with Rpush::Client::ActiveModel::PayloadDataSizeValidator, limit: 4096
|
16
17
|
validates_with Rpush::Client::ActiveModel::RegistrationIdsCountValidator, limit: 1000
|
@@ -42,6 +43,7 @@ module Rpush
|
|
42
43
|
}
|
43
44
|
json['collapse_key'] = collapse_key if collapse_key
|
44
45
|
json['content_available'] = content_available if content_available
|
46
|
+
json['dry_run'] = dry_run if dry_run
|
45
47
|
json['notification'] = notification if notification
|
46
48
|
json['priority'] = priority_for_notification if priority
|
47
49
|
json['time_to_live'] = expiry if expiry
|
@@ -43,6 +43,7 @@ module Rpush
|
|
43
43
|
attribute :url_args, :array
|
44
44
|
attribute :category, :string
|
45
45
|
attribute :content_available, :boolean, default: false
|
46
|
+
attribute :dry_run, :boolean, default: false
|
46
47
|
attribute :mutable_content, :boolean, default: false
|
47
48
|
attribute :notification, :hash
|
48
49
|
attribute :thread_id, :string
|
data/lib/rpush/version.rb
CHANGED
@@ -39,6 +39,7 @@ require 'generators/templates/rpush_3_2_0_add_apns_p8'
|
|
39
39
|
require 'generators/templates/rpush_3_2_4_updates'
|
40
40
|
require 'generators/templates/rpush_3_3_0_updates'
|
41
41
|
require 'generators/templates/rpush_3_3_1_updates'
|
42
|
+
require 'generators/templates/rpush_4_1_0_updates'
|
42
43
|
|
43
44
|
migrations = [
|
44
45
|
AddRpush,
|
@@ -53,7 +54,8 @@ migrations = [
|
|
53
54
|
Rpush320AddApnsP8,
|
54
55
|
Rpush324Updates,
|
55
56
|
Rpush330Updates,
|
56
|
-
Rpush331Updates
|
57
|
+
Rpush331Updates,
|
58
|
+
Rpush410Updates
|
57
59
|
]
|
58
60
|
|
59
61
|
unless ENV['TRAVIS']
|
@@ -64,4 +64,28 @@ describe Rpush::Client::ActiveRecord::Gcm::Notification do
|
|
64
64
|
it 'excludes the notification payload if undefined' do
|
65
65
|
expect(notification.as_json).not_to have_key 'notification'
|
66
66
|
end
|
67
|
+
|
68
|
+
it 'includes the dry_run payload if defined' do
|
69
|
+
notification.dry_run = true
|
70
|
+
expect(notification.as_json['dry_run']).to eq true
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'excludes the dry_run payload if undefined' do
|
74
|
+
expect(notification.as_json).not_to have_key 'dry_run'
|
75
|
+
end
|
76
|
+
|
77
|
+
# In Rails 4.2 this value casts to `false` and thus will not be included in
|
78
|
+
# the payload. This changed to match Ruby's semantics, and will casts to
|
79
|
+
# `true` in Rails 5 and above.
|
80
|
+
if ActiveRecord.version <= Gem::Version.new('5')
|
81
|
+
it 'accepts non-booleans as a falsey value' do
|
82
|
+
notification.dry_run = 'Not a boolean'
|
83
|
+
expect(notification.as_json).not_to have_key 'dry_run'
|
84
|
+
end
|
85
|
+
else
|
86
|
+
it 'accepts non-booleans as a truthy value' do
|
87
|
+
notification.dry_run = 'Not a boolean'
|
88
|
+
expect(notification.as_json['dry_run']).to eq true
|
89
|
+
end
|
90
|
+
end
|
67
91
|
end if active_record?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rpush
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Leitch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -376,6 +376,7 @@ files:
|
|
376
376
|
- lib/generators/templates/rpush_3_2_4_updates.rb
|
377
377
|
- lib/generators/templates/rpush_3_3_0_updates.rb
|
378
378
|
- lib/generators/templates/rpush_3_3_1_updates.rb
|
379
|
+
- lib/generators/templates/rpush_4_1_0_updates.rb
|
379
380
|
- lib/rpush.rb
|
380
381
|
- lib/rpush/apns_feedback.rb
|
381
382
|
- lib/rpush/cli.rb
|
@@ -595,7 +596,11 @@ homepage: https://github.com/rpush/rpush
|
|
595
596
|
licenses:
|
596
597
|
- MIT
|
597
598
|
metadata: {}
|
598
|
-
post_install_message:
|
599
|
+
post_install_message: |
|
600
|
+
When upgrading, don't forget to run `bundle exec rpush init` to get all the latest migrations.
|
601
|
+
|
602
|
+
For details on this specific release, refer to the CHANGELOG.md file.
|
603
|
+
https://github.com/rpush/rpush/blob/master/CHANGELOG.md
|
599
604
|
rdoc_options: []
|
600
605
|
require_paths:
|
601
606
|
- lib
|