notifiable-gcm-spacialdb 0.5.0 → 0.6.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
  SHA1:
3
- metadata.gz: d61457fbeffca641f889b92f5c8c0bd2ae7f07bd
4
- data.tar.gz: acdf05b132205e223e2dadc768d76cb284cacf46
3
+ metadata.gz: d4461f897facad949fb42c8202f5d79fc532309d
4
+ data.tar.gz: 0061dba421c1b4e99796e702caafdfd94de7d06e
5
5
  SHA512:
6
- metadata.gz: d00f13c3297670c8541a1a0758987370694424c6784f493e64fc8c297d44dc64f4c29f9906e5a4ac872a1555cba6dae708a0526abe0829d85b0c2cb6d0e00877
7
- data.tar.gz: 0b96b449d6025348f6ef84c473eb644b352c845525dd42aa0f9dc3fac6c7fe5602c81e5cbdcd1098309b5d10a2613ab5f3ea72212425330a0a8c9835ff116a03
6
+ metadata.gz: d534b04eb4ce5ffad208c64c7aaa85d988c180fc0d80bfe814cfe7bd316dacd0b5994eb23ec510aa49006bf9eb573791170042367468ff69412a9f3e5861195c
7
+ data.tar.gz: 0bab0cb2c5d73aad5e263250127fde6e2f4a6502fb182f100aa6a9841606676edcd4f9a0187c1b8551f8d895bf3abb7c967f84a3a74bf891a73437e70a15000c
data/Gemfile.lock CHANGED
@@ -1,32 +1,32 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- notifiable-gcm-spacialdb (0.5.0)
4
+ notifiable-gcm-spacialdb (0.6.0)
5
5
  gcm (~> 0.0.6)
6
- notifiable-rails (>= 0.17.0)
6
+ notifiable-rails (>= 0.18.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionmailer (4.0.4)
12
- actionpack (= 4.0.4)
11
+ actionmailer (4.0.5)
12
+ actionpack (= 4.0.5)
13
13
  mail (~> 2.5.4)
14
- actionpack (4.0.4)
15
- activesupport (= 4.0.4)
14
+ actionpack (4.0.5)
15
+ activesupport (= 4.0.5)
16
16
  builder (~> 3.1.0)
17
17
  erubis (~> 2.7.0)
18
18
  rack (~> 1.5.2)
19
19
  rack-test (~> 0.6.2)
20
- activemodel (4.0.4)
21
- activesupport (= 4.0.4)
20
+ activemodel (4.0.5)
21
+ activesupport (= 4.0.5)
22
22
  builder (~> 3.1.0)
23
- activerecord (4.0.4)
24
- activemodel (= 4.0.4)
23
+ activerecord (4.0.5)
24
+ activemodel (= 4.0.5)
25
25
  activerecord-deprecated_finders (~> 1.0.2)
26
- activesupport (= 4.0.4)
26
+ activesupport (= 4.0.5)
27
27
  arel (~> 4.0.0)
28
28
  activerecord-deprecated_finders (1.0.3)
29
- activesupport (4.0.4)
29
+ activesupport (4.0.5)
30
30
  i18n (~> 0.6, >= 0.6.9)
31
31
  minitest (~> 4.2)
32
32
  multi_json (~> 1.3)
@@ -57,23 +57,23 @@ GEM
57
57
  minitest (4.7.5)
58
58
  multi_json (1.8.4)
59
59
  multi_xml (0.5.5)
60
- notifiable-rails (0.17.0)
60
+ notifiable-rails (0.18.0)
61
61
  rails (~> 4.0.0)
62
62
  polyglot (0.3.4)
63
63
  rack (1.5.2)
64
64
  rack-test (0.6.2)
65
65
  rack (>= 1.0)
66
- rails (4.0.4)
67
- actionmailer (= 4.0.4)
68
- actionpack (= 4.0.4)
69
- activerecord (= 4.0.4)
70
- activesupport (= 4.0.4)
66
+ rails (4.0.5)
67
+ actionmailer (= 4.0.5)
68
+ actionpack (= 4.0.5)
69
+ activerecord (= 4.0.5)
70
+ activesupport (= 4.0.5)
71
71
  bundler (>= 1.3.0, < 2.0)
72
- railties (= 4.0.4)
72
+ railties (= 4.0.5)
73
73
  sprockets-rails (~> 2.0.0)
74
- railties (4.0.4)
75
- actionpack (= 4.0.4)
76
- activesupport (= 4.0.4)
74
+ railties (4.0.5)
75
+ actionpack (= 4.0.5)
76
+ activesupport (= 4.0.5)
77
77
  rake (>= 0.8.7)
78
78
  thor (>= 0.18.1, < 2.0)
79
79
  rake (10.1.1)
@@ -51,18 +51,15 @@ module Notifiable
51
51
  results.each_with_index do |result, i|
52
52
  dt = @batch[i]
53
53
 
54
- # Remove the token if it is marked NotRegistered (user deleted the App for example)
55
- if ["InvalidRegistration", "NotRegistered"].include? result["error"]
56
- dt.update_attribute('is_valid', false)
57
-
58
- # Process canonical IDs
59
- elsif result["registration_id"] && Notifiable::DeviceToken.exists?(:token => result["registration_id"])
60
- dt.update_attribute('is_valid', false)
61
- elsif result["registration_id"]
62
- dt.update_attribute('token', result["registration_id"])
63
- end
64
-
65
- processed(dt, error_code(result["error"]))
54
+ # Remove the token if it is marked NotRegistered (user deleted the App for example) or is not the canonical ID
55
+ if (["InvalidRegistration", "NotRegistered"].include? result["error"]) ||
56
+ (result["registration_id"] && Notifiable::DeviceToken.exists?(:token => result["registration_id"]))
57
+ dt.destroy
58
+ # Update the token if the canonical ID does not exist
59
+ else
60
+ dt.update_attribute('token', result["registration_id"]) if result["registration_id"]
61
+ processed(dt, error_code(result["error"]))
62
+ end
66
63
  end
67
64
  end
68
65
 
@@ -1,7 +1,7 @@
1
1
  module Notifiable
2
2
  module Gcm
3
3
  module Spacialdb
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.0"
5
5
  end
6
6
  end
7
7
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "notifiable-rails", ">=0.17.0"
21
+ spec.add_dependency "notifiable-rails", ">=0.18.0"
22
22
  spec.add_dependency "gcm", "~> 0.0.6"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
data/spec/batch_spec.rb CHANGED
@@ -31,28 +31,26 @@ describe Notifiable::Gcm::Spacialdb::Batch do
31
31
  Notifiable::NotificationStatus.first.status = 0
32
32
  end
33
33
 
34
- it "marks a unregistered token as invalid" do
34
+ it "delete an unregistered token" do
35
35
  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" }]}')
36
36
 
37
37
  n1.batch do |n|
38
38
  n.add_device_token(d)
39
39
  end
40
40
 
41
- Notifiable::NotificationStatus.count.should == 1
42
- Notifiable::NotificationStatus.first.status = 4
43
- d.is_valid.should == false
41
+ Notifiable::DeviceToken.count == 0
42
+ Notifiable::NotificationStatus.count.should == 0
44
43
  end
45
44
 
46
- it "marks an invalid token as invalid" do
45
+ it "delete an invalid token" do
47
46
  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" }]}')
48
47
 
49
48
  n1.batch do |n|
50
49
  n.add_device_token(d)
51
50
  end
52
51
 
53
- Notifiable::NotificationStatus.count.should == 1
54
- Notifiable::NotificationStatus.first.status = 2
55
- d.is_valid.should == false
52
+ Notifiable::DeviceToken.count == 0
53
+ Notifiable::NotificationStatus.count.should == 0
56
54
  end
57
55
 
58
56
  it "updates a token to the canonical ID if it does not exist" do
@@ -5,7 +5,6 @@ class CreateNotifiableDeviceTokens < ActiveRecord::Migration
5
5
  t.string :token
6
6
  t.string :provider
7
7
  t.string :device_id
8
- t.boolean :is_valid, :default => true
9
8
  t.integer :user_id
10
9
  t.references :app
11
10
 
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.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kamil Kocemba
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-03 00:00:00.000000000 Z
12
+ date: 2014-05-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: notifiable-rails
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - '>='
19
19
  - !ruby/object:Gem::Version
20
- version: 0.17.0
20
+ version: 0.18.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '>='
26
26
  - !ruby/object:Gem::Version
27
- version: 0.17.0
27
+ version: 0.18.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: gcm
30
30
  requirement: !ruby/object:Gem::Requirement