rapns_rails_2 3.5.0 → 3.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 3.5.1 (May 12, 2017)
2
+ * Increased length of device_token field for iOS
3
+
1
4
  ## 3.5.0 (unreleased)
2
5
  * Fix sqlite3 support (#160).
3
6
  * Drop support for Ruby 1.8.
@@ -19,7 +19,7 @@ class AddGcm < ActiveRecord::Migration
19
19
 
20
20
  change_column :rapns_notifications, :type, :string, :null => false
21
21
  change_column :rapns_apps, :type, :string, :null => false
22
- change_column :rapns_notifications, :device_token, :string, { :null => true, :limit => 64 }
22
+ change_column :rapns_notifications, :device_token, :string, { :null => true, :limit => 256 }
23
23
  change_column :rapns_notifications, :expiry, :integer, { :null => true, :default => 1.day.to_i }
24
24
  change_column :rapns_apps, :environment, :string, :null => true
25
25
  change_column :rapns_apps, :certificate, :text, :null => true, :default => nil
@@ -60,7 +60,7 @@ class AddGcm < ActiveRecord::Migration
60
60
  remove_column :rapns_notifications, :type
61
61
  remove_column :rapns_apps, :type
62
62
 
63
- change_column :rapns_notifications, :device_token, :string, { :null => false, :limit => 64 }
63
+ change_column :rapns_notifications, :device_token, :string, { :null => false, :limit => 256 }
64
64
  change_column :rapns_notifications, :expiry, :integer, { :null => false, :default => 1.day.to_i }
65
65
  change_column :rapns_apps, :environment, :string, :null => false
66
66
  change_column :rapns_apps, :certificate, :text, :null => false
@@ -1,7 +1,7 @@
1
1
  class CreateRapnsFeedback < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :rapns_feedback do |t|
4
- t.string :device_token, :null => false, :limit => 64
4
+ t.string :device_token, :null => false, :limit => 256
5
5
  t.timestamp :failed_at, :null => false
6
6
  t.timestamps
7
7
  end
@@ -2,7 +2,7 @@ class CreateRapnsNotifications < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :rapns_notifications do |t|
4
4
  t.integer :badge, :null => true
5
- t.string :device_token, :null => false, :limit => 64
5
+ t.string :device_token, :null => false, :limit => 256
6
6
  t.string :sound, :null => true, :default => "1.aiff"
7
7
  t.string :alert, :null => true
8
8
  t.text :attributes_for_device, :null => true
@@ -3,7 +3,7 @@ module Rapns
3
3
  class DeviceTokenFormatValidator < ActiveModel::Validator
4
4
 
5
5
  def validate(record)
6
- if record.device_token !~ /^[a-z0-9]{64}$/i
6
+ if record.device_token !~ /^[a-z0-9]{64,256}$/i
7
7
  record.errors.add(:device_token, "is invalid")
8
8
  end
9
9
  end
data/lib/rapns/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rapns
2
- VERSION = '3.5.0'
2
+ VERSION = '3.5.1'
3
3
  end
@@ -18,7 +18,7 @@ describe Rapns::Apns::Notification do
18
18
  end
19
19
 
20
20
  it "should validate the length of the binary conversion of the notification" do
21
- notification.device_token = "a" * 64
21
+ notification.device_token = "a" * 256
22
22
  notification.alert = "way too long!" * 100
23
23
  notification.valid?.should be_false
24
24
  notification.errors[:base].include?("APN notification cannot be larger than 256 bytes. Try condensing your alert and device attributes.").should be_true
@@ -148,7 +148,7 @@ end
148
148
  describe Rapns::Apns::Notification, "to_binary" do
149
149
  it "should correctly convert the notification to binary" do
150
150
  notification = Rapns::Apns::Notification.new
151
- notification.device_token = "a" * 64
151
+ notification.device_token = "a" * 256
152
152
  notification.sound = "1.aiff"
153
153
  notification.badge = 3
154
154
  notification.alert = "Don't panic Mr Mainwaring, don't panic!"
@@ -179,7 +179,7 @@ end
179
179
  describe Rapns::Apns::Notification, "bug #35" do
180
180
  it "should limit payload size to 256 bytes but not the entire packet" do
181
181
  notification = Rapns::Apns::Notification.new do |n|
182
- n.device_token = "a" * 64
182
+ n.device_token = "a" * 256
183
183
  n.alert = "a" * 210
184
184
  n.app = Rapns::Apns::App.create!(:name => 'my_app', :environment => 'development', :certificate => TEST_CERT)
185
185
  end
@@ -7,7 +7,7 @@ describe Rapns::Daemon::Feeder do
7
7
  :push => false,
8
8
  :wakeup => nil) }
9
9
  let!(:app) { Rapns::Apns::App.create!(:name => 'my_app', :environment => 'development', :certificate => TEST_CERT) }
10
- let(:notification) { Rapns::Apns::Notification.create!(:device_token => "a" * 64, :app => app) }
10
+ let(:notification) { Rapns::Apns::Notification.create!(:device_token => "a" * 256, :app => app) }
11
11
  let(:logger) { double }
12
12
  let(:interruptible_sleep) { double(:sleep => nil, :interrupt_sleep => nil) }
13
13
 
@@ -3,7 +3,7 @@ require 'rapns/daemon/store/active_record'
3
3
 
4
4
  describe Rapns::Daemon::Store::ActiveRecord do
5
5
  let(:app) { Rapns::Apns::App.create!(:name => 'my_app', :environment => 'development', :certificate => TEST_CERT) }
6
- let(:notification) { Rapns::Apns::Notification.create!(:device_token => "a" * 64, :app => app) }
6
+ let(:notification) { Rapns::Apns::Notification.create!(:device_token => "a" * 256, :app => app) }
7
7
  let(:store) { Rapns::Daemon::Store::ActiveRecord.new }
8
8
  let(:now) { Time.now.utc }
9
9
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rapns_rails_2
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 5
9
- - 0
10
- version: 3.5.0
9
+ - 1
10
+ version: 3.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ian Leitch
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2013-11-20 00:00:00 Z
19
+ date: 2017-05-12 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: multi_json
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  requirements: []
198
198
 
199
199
  rubyforge_project:
200
- rubygems_version: 1.8.4
200
+ rubygems_version: 1.8.10
201
201
  signing_key:
202
202
  specification_version: 3
203
203
  summary: Professional grade APNs and GCM for Ruby