notifiable-gcm-spacialdb 0.3.0 → 0.4.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 +28 -4
- data/lib/notifiable/gcm/spacialdb/version.rb +1 -1
- data/notifiable-gcm-spacialdb.gemspec +1 -1
- data/spec/batch_spec.rb +12 -6
- data/spec/support/db/migrate/20131229104039_create_notifiable_notification_statuses.rb +11 -0
- metadata +6 -6
- data/spec/support/db/migrate/20131229104039_create_notifiable_notification_device_tokens.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06c745533a7b21a6e1128b9dcee586ce30d0c0fd
|
4
|
+
data.tar.gz: 8603d8c79d6ecf7999527324e8d81610310be5fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbcc416c965d3ec5e449dae8067254865e6577ea58a3143601b5dafd88edf5185324417691514f94e241fb132525acb65cd4bd72664b7b1fb829510fc9d64e1f
|
7
|
+
data.tar.gz: 93bdd3344f2c702983eda3dd9446ab1d799ba7fe8e667fe8841585096907bc352509fdeb6e32ca759c9f3463dc1e0f9e94a3d17d4cd0cab8a978e962cc47130f
|
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.4.0)
|
5
5
|
gcm (~> 0.0.6)
|
6
|
-
notifiable-rails (>= 0.
|
6
|
+
notifiable-rails (>= 0.6.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -58,7 +58,7 @@ GEM
|
|
58
58
|
minitest (4.7.5)
|
59
59
|
multi_json (1.8.4)
|
60
60
|
multi_xml (0.5.5)
|
61
|
-
notifiable-rails (0.
|
61
|
+
notifiable-rails (0.6.0)
|
62
62
|
rails (~> 4.0.0)
|
63
63
|
polyglot (0.3.3)
|
64
64
|
rack (1.5.2)
|
@@ -56,15 +56,39 @@ module Notifiable
|
|
56
56
|
# Update the token if a canonical ID is returned
|
57
57
|
if result["registration_id"]
|
58
58
|
device_tokens[idx].update_attribute('token', result["registration_id"])
|
59
|
-
end
|
60
|
-
|
61
|
-
# Mark as processed
|
62
|
-
processed(notification, device_tokens[idx])
|
59
|
+
end
|
63
60
|
end
|
61
|
+
|
62
|
+
processed(notification, device_tokens[idx], error_code(result["error"]))
|
64
63
|
end
|
65
64
|
end
|
66
65
|
self.batch.delete(notification.id)
|
67
66
|
end
|
67
|
+
|
68
|
+
def error_code(error_message)
|
69
|
+
case error_message
|
70
|
+
when "MissingRegistration"
|
71
|
+
1
|
72
|
+
when "InvalidRegistration"
|
73
|
+
2
|
74
|
+
when "MismatchSenderId"
|
75
|
+
3
|
76
|
+
when "NotRegistered"
|
77
|
+
4
|
78
|
+
when "MessageTooBig"
|
79
|
+
5
|
80
|
+
when "InvalidDataKey"
|
81
|
+
6
|
82
|
+
when "InvalidTtl"
|
83
|
+
7
|
84
|
+
when "Unavailable"
|
85
|
+
8
|
86
|
+
when "InternalServerError"
|
87
|
+
9
|
88
|
+
when "InvalidPackageName"
|
89
|
+
10
|
90
|
+
end
|
91
|
+
end
|
68
92
|
end
|
69
93
|
end
|
70
94
|
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.
|
21
|
+
spec.add_dependency "notifiable-rails", ">=0.6.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
@@ -13,7 +13,8 @@ describe Notifiable::Gcm::Spacialdb::Batch do
|
|
13
13
|
g.send_notification(n, d)
|
14
14
|
g.close
|
15
15
|
|
16
|
-
Notifiable::
|
16
|
+
Notifiable::NotificationStatus.count.should == 1
|
17
|
+
Notifiable::NotificationStatus.first.status = 0
|
17
18
|
end
|
18
19
|
|
19
20
|
it "sends custom attributes" do
|
@@ -26,7 +27,8 @@ describe Notifiable::Gcm::Spacialdb::Batch do
|
|
26
27
|
g.send_notification(n, d)
|
27
28
|
g.close
|
28
29
|
|
29
|
-
Notifiable::
|
30
|
+
Notifiable::NotificationStatus.count.should == 1
|
31
|
+
Notifiable::NotificationStatus.first.status = 0
|
30
32
|
end
|
31
33
|
|
32
34
|
it "sends a single gcm notification in a batch" do
|
@@ -34,7 +36,8 @@ describe Notifiable::Gcm::Spacialdb::Batch do
|
|
34
36
|
|
35
37
|
Notifiable.batch {|b| b.add(n, u)}
|
36
38
|
|
37
|
-
Notifiable::
|
39
|
+
Notifiable::NotificationStatus.count.should == 1
|
40
|
+
Notifiable::NotificationStatus.first.status = 0
|
38
41
|
end
|
39
42
|
|
40
43
|
it "marks a unregistered token as invalid" do
|
@@ -42,7 +45,8 @@ describe Notifiable::Gcm::Spacialdb::Batch do
|
|
42
45
|
|
43
46
|
Notifiable.batch {|b| b.add(n, u)}
|
44
47
|
|
45
|
-
Notifiable::
|
48
|
+
Notifiable::NotificationStatus.count.should == 1
|
49
|
+
Notifiable::NotificationStatus.first.status = 4
|
46
50
|
d.is_valid.should == false
|
47
51
|
end
|
48
52
|
|
@@ -51,7 +55,8 @@ describe Notifiable::Gcm::Spacialdb::Batch do
|
|
51
55
|
|
52
56
|
Notifiable.batch {|b| b.add(n, u)}
|
53
57
|
|
54
|
-
Notifiable::
|
58
|
+
Notifiable::NotificationStatus.count.should == 1
|
59
|
+
Notifiable::NotificationStatus.first.status = 2
|
55
60
|
d.is_valid.should == false
|
56
61
|
end
|
57
62
|
|
@@ -60,7 +65,8 @@ describe Notifiable::Gcm::Spacialdb::Batch do
|
|
60
65
|
|
61
66
|
Notifiable.batch {|b| b.add(n, u)}
|
62
67
|
|
63
|
-
Notifiable::
|
68
|
+
Notifiable::NotificationStatus.count.should == 1
|
69
|
+
Notifiable::NotificationStatus.first.status = 0
|
64
70
|
d.token.should eql "GHJ12345"
|
65
71
|
end
|
66
72
|
|
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.4.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-02-
|
12
|
+
date: 2014-02-14 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.6.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.6.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: gcm
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -175,7 +175,7 @@ files:
|
|
175
175
|
- spec/spec_helper.rb
|
176
176
|
- spec/support/db/migrate/20131228225139_create_notifiable_device_tokens.rb
|
177
177
|
- spec/support/db/migrate/20131228225140_create_notifiable_notifications.rb
|
178
|
-
- spec/support/db/migrate/
|
178
|
+
- spec/support/db/migrate/20131229104039_create_notifiable_notification_statuses.rb
|
179
179
|
homepage: http://www.futureworkshops.com
|
180
180
|
licenses:
|
181
181
|
- Apache 2.0
|
@@ -205,4 +205,4 @@ test_files:
|
|
205
205
|
- spec/spec_helper.rb
|
206
206
|
- spec/support/db/migrate/20131228225139_create_notifiable_device_tokens.rb
|
207
207
|
- spec/support/db/migrate/20131228225140_create_notifiable_notifications.rb
|
208
|
-
- spec/support/db/migrate/
|
208
|
+
- spec/support/db/migrate/20131229104039_create_notifiable_notification_statuses.rb
|