notifiable-gcm-spacialdb 0.6.0 → 0.7.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 +3 -3
- data/lib/notifiable/gcm/spacialdb/batch.rb +12 -9
- data/lib/notifiable/gcm/spacialdb/version.rb +1 -1
- data/notifiable-gcm-spacialdb.gemspec +1 -1
- data/spec/batch_spec.rb +8 -6
- data/spec/support/db/migrate/20131228225139_create_notifiable_device_tokens.rb +1 -0
- 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: bf8617349fad22ba3f960775005a9cf5690f0dc2
|
4
|
+
data.tar.gz: b4b074036bedd4eda84de247260f29a7d4fceead
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9987b8e215fea1e309579aa5311a0a9e86be7df56f2c0f068b0fb57157773bc927ad8bfd342827236e99867b2c32b8f504772c3548368e35b897e91f1de72e9
|
7
|
+
data.tar.gz: dff07a33f03b9fe86681a76b490cbb3e535d3cc4bbfab3c2de3803debd5a0f4027da51c0cfd1256bafc3bf0cdccf0cfe1dd9030cbb9c9ff2c8ea3e716328c806
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
notifiable-gcm-spacialdb (0.
|
4
|
+
notifiable-gcm-spacialdb (0.7.0)
|
5
5
|
gcm (~> 0.0.6)
|
6
|
-
notifiable-rails (>= 0.
|
6
|
+
notifiable-rails (>= 0.19.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -57,7 +57,7 @@ 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.19.0)
|
61
61
|
rails (~> 4.0.0)
|
62
62
|
polyglot (0.3.4)
|
63
63
|
rack (1.5.2)
|
@@ -51,15 +51,18 @@ 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
|
56
|
-
|
57
|
-
|
58
|
-
#
|
59
|
-
|
60
|
-
dt.update_attribute('
|
61
|
-
|
62
|
-
|
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"]))
|
63
66
|
end
|
64
67
|
end
|
65
68
|
|
@@ -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.19.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,26 +31,28 @@ describe Notifiable::Gcm::Spacialdb::Batch do
|
|
31
31
|
Notifiable::NotificationStatus.first.status = 0
|
32
32
|
end
|
33
33
|
|
34
|
-
it "
|
34
|
+
it "marks a unregistered token as invalid" 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.
|
41
|
+
Notifiable::NotificationStatus.count.should == 1
|
42
|
+
Notifiable::NotificationStatus.first.status = 4
|
43
|
+
d.is_valid.should == false
|
43
44
|
end
|
44
45
|
|
45
|
-
it "
|
46
|
+
it "marks an invalid token as invalid" do
|
46
47
|
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" }]}')
|
47
48
|
|
48
49
|
n1.batch do |n|
|
49
50
|
n.add_device_token(d)
|
50
51
|
end
|
51
52
|
|
52
|
-
Notifiable::
|
53
|
-
Notifiable::NotificationStatus.
|
53
|
+
Notifiable::NotificationStatus.count.should == 1
|
54
|
+
Notifiable::NotificationStatus.first.status = 2
|
55
|
+
d.is_valid.should == false
|
54
56
|
end
|
55
57
|
|
56
58
|
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.7.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-09 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.19.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.19.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: gcm
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|