notifiable-gcm-spacialdb 0.1.3 → 0.1.4

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
  SHA1:
3
- metadata.gz: 321eec872b672eeabdae29174f48d355ed8d1dc3
4
- data.tar.gz: f09d3babfdbea46a0e0cec0896134281d8f84192
3
+ metadata.gz: 8ca653ef7b121212b7ef6166bc468c67d1f70fab
4
+ data.tar.gz: e8f7631fc7b04beaae5f43067259337dcd92342a
5
5
  SHA512:
6
- metadata.gz: f0a8ef8ddc93615e7b4ef7a79afa96a201a2b64879869f443eccfed7a12e364c5b8ee75593504c059fca4205114deed5b7c4d3de5347dcf94c24a4ff8846e3a8
7
- data.tar.gz: b9c6fcea9b8b34596842cf544dc9f59c5aadc1c7e78510fa38969a3aaac866d6da79c51f03e5feb96fc7c30909317b4a84413280c4837b35788bdaeade7d200c
6
+ metadata.gz: 7a56b0ca6d4da22e6d01da55caf45687ec61004dd702e0025e0cb55208441be156ea50217cabb9b6458e4227fbc17570c8206706d9b4c7ed8f020b64e41e866e
7
+ data.tar.gz: be6d20ec97b18b811b458e7410c1275298cc522b02f9c7be683cbe101bd4b0db40ad0828301aa60c64248cc86ac42179a7e71f6e1dd029c58af48b6cc99ae648
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- notifiable-gcm-spacialdb (0.1.3)
4
+ notifiable-gcm-spacialdb (0.1.4)
5
5
  gcm (~> 0.0.6)
6
6
  notifiable-rails
7
7
 
@@ -37,7 +37,7 @@ module Notifiable
37
37
  results = body.fetch("results", [])
38
38
  results.each_with_index do |result, idx|
39
39
  # Remove the token if it is marked NotRegistered (user deleted the App for example)
40
- if result["error"].eql? "NotRegistered"
40
+ if ["InvalidRegistration", "NotRegistered"].include? result["error"]
41
41
  device_tokens[idx].update_attribute('is_valid', false)
42
42
  else
43
43
 
@@ -1,7 +1,7 @@
1
1
  module Notifiable
2
2
  module Gcm
3
3
  module Spacialdb
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
6
6
  end
7
7
  end
data/spec/batch_spec.rb CHANGED
@@ -24,7 +24,7 @@ describe Notifiable::Gcm::Spacialdb::Batch do
24
24
  Notifiable::NotificationDeviceToken.count.should == 1
25
25
  end
26
26
 
27
- it "invalidates a token" do
27
+ it "marks a unregistered token as invalid" do
28
28
  stub_request(:post, "https://android.googleapis.com/gcm/send").to_return(:body => '{ "multicast_id": 108, "success": 0, "failure": 1, "canonical_ids": 0, "results": [{ "error": "NotRegistered" }]}')
29
29
 
30
30
  Notifiable.batch {|b| b.add(n, u)}
@@ -33,6 +33,15 @@ describe Notifiable::Gcm::Spacialdb::Batch do
33
33
  d.is_valid.should == false
34
34
  end
35
35
 
36
+ it "marks an invalid token as invalid" do
37
+ stub_request(:post, "https://android.googleapis.com/gcm/send").to_return(:body => '{ "multicast_id": 108, "success": 0, "failure": 1, "canonical_ids": 0, "results": [{ "error": "InvalidRegistration" }]}')
38
+
39
+ Notifiable.batch {|b| b.add(n, u)}
40
+
41
+ Notifiable::NotificationDeviceToken.count.should == 0
42
+ d.is_valid.should == false
43
+ end
44
+
36
45
  it "updates a token to the canonical ID" do
37
46
  stub_request(:post, "https://android.googleapis.com/gcm/send").to_return(:body => '{ "multicast_id": 108, "success": 1, "failure": 0, "canonical_ids": 1, "results": [{ "message_id": "1:08", "registration_id": "GHJ12345" }]}')
38
47
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notifiable-gcm-spacialdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kamil Kocemba