rpush 4.0.1 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c92f2053a81534384b1439e958afc67fe51913fb4144abe0e0a60edda626f37f
4
- data.tar.gz: fb6d691def9b053fd6eba40244dd84adebfbb549a5d02d4310381bfadbb06bc9
3
+ metadata.gz: 0b2bd0a00817c1d763652f59881b939ede6de72a70ef13f9ee761f4143170f4f
4
+ data.tar.gz: 65d645e9b67c459908648c34ceb965e9989831dbd5e61b3d110209e47eb8b1a1
5
5
  SHA512:
6
- metadata.gz: 980046a8d527a44066937d54e32fea017d8afbd0177a027ec78a21fe31ddaf28bc075c8ddcb9ce2785b453e0d16fe011473de985bb4155882957e11067fd305a
7
- data.tar.gz: 99cac2e5c9e4d06e190f27eef97adf41f388d4e9a9116dd9e7beb8b013fe853138c1ef55fa92ea9a82ad9297db544d3d7ead18c568f43a5ced72d6ebacc2e487
6
+ metadata.gz: 61d8c34cf01ee4057fc068a69fb1f79ad3b51e9ab22b0dada132b20560f66134edb228f0085a9d9be9b3a0c608973d185ccaa762ee9282740ec17b1913c255cd
7
+ data.tar.gz: 9738e9c124d22e3bc981c889b7b6eef59f7e85bf4fd19fb4a23c0b082004107bf178ffa2c9565aaa8cf69c978a98c010dbb4151f7879004c707f630211a06b26
@@ -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
@@ -1,8 +1,8 @@
1
1
  module Rpush
2
2
  module VERSION
3
3
  MAJOR = 4
4
- MINOR = 0
5
- TINY = 1
4
+ MINOR = 1
5
+ TINY = 0
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".").freeze
@@ -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.1
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-04 00:00:00.000000000 Z
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