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 +4 -4
- data/Gemfile.lock +22 -22
- data/lib/notifiable/gcm/spacialdb/batch.rb +9 -12
- data/lib/notifiable/gcm/spacialdb/version.rb +1 -1
- data/notifiable-gcm-spacialdb.gemspec +1 -1
- data/spec/batch_spec.rb +6 -8
- data/spec/support/db/migrate/20131228225139_create_notifiable_device_tokens.rb +0 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4461f897facad949fb42c8202f5d79fc532309d
|
4
|
+
data.tar.gz: 0061dba421c1b4e99796e702caafdfd94de7d06e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
4
|
+
notifiable-gcm-spacialdb (0.6.0)
|
5
5
|
gcm (~> 0.0.6)
|
6
|
-
notifiable-rails (>= 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.
|
12
|
-
actionpack (= 4.0.
|
11
|
+
actionmailer (4.0.5)
|
12
|
+
actionpack (= 4.0.5)
|
13
13
|
mail (~> 2.5.4)
|
14
|
-
actionpack (4.0.
|
15
|
-
activesupport (= 4.0.
|
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.
|
21
|
-
activesupport (= 4.0.
|
20
|
+
activemodel (4.0.5)
|
21
|
+
activesupport (= 4.0.5)
|
22
22
|
builder (~> 3.1.0)
|
23
|
-
activerecord (4.0.
|
24
|
-
activemodel (= 4.0.
|
23
|
+
activerecord (4.0.5)
|
24
|
+
activemodel (= 4.0.5)
|
25
25
|
activerecord-deprecated_finders (~> 1.0.2)
|
26
|
-
activesupport (= 4.0.
|
26
|
+
activesupport (= 4.0.5)
|
27
27
|
arel (~> 4.0.0)
|
28
28
|
activerecord-deprecated_finders (1.0.3)
|
29
|
-
activesupport (4.0.
|
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.
|
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.
|
67
|
-
actionmailer (= 4.0.
|
68
|
-
actionpack (= 4.0.
|
69
|
-
activerecord (= 4.0.
|
70
|
-
activesupport (= 4.0.
|
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.
|
72
|
+
railties (= 4.0.5)
|
73
73
|
sprockets-rails (~> 2.0.0)
|
74
|
-
railties (4.0.
|
75
|
-
actionpack (= 4.0.
|
76
|
-
activesupport (= 4.0.
|
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
|
-
|
57
|
-
|
58
|
-
#
|
59
|
-
|
60
|
-
dt.update_attribute('
|
61
|
-
|
62
|
-
|
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
|
|
@@ -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.
|
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 "
|
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::
|
42
|
-
Notifiable::NotificationStatus.
|
43
|
-
d.is_valid.should == false
|
41
|
+
Notifiable::DeviceToken.count == 0
|
42
|
+
Notifiable::NotificationStatus.count.should == 0
|
44
43
|
end
|
45
44
|
|
46
|
-
it "
|
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::
|
54
|
-
Notifiable::NotificationStatus.
|
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
|
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.
|
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-
|
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.
|
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.
|
27
|
+
version: 0.18.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: gcm
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|