notifiable-rails 0.5.1 → 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/lib/generators/notifiable/install/templates/create_notifiable_notification_statuses.rb +11 -0
- data/lib/notifiable/notification.rb +1 -1
- data/lib/notifiable/{notification_device_token.rb → notification_status.rb} +1 -1
- data/lib/notifiable/notifier_base.rb +3 -3
- data/lib/notifiable/version.rb +1 -1
- data/lib/notifiable.rb +1 -1
- data/spec/batch_spec.rb +1 -1
- data/spec/notifiable_server_spec.rb +6 -4
- data/spec/notifiable_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- data/spec/test_app/db/migrate/20131229104039_create_notifiable_notification_statuses.rb +11 -0
- data/spec/test_app/db/schema.rb +4 -5
- data/spec/test_app/db/test.sqlite3 +0 -0
- data/spec/test_app/log/test.log +4617 -0
- metadata +5 -5
- data/lib/generators/notifiable/install/templates/create_notifiable_notification_device_tokens.rb +0 -11
- data/spec/test_app/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: 099d66d35755e715b96fbcd6cd5e54896009a483
|
4
|
+
data.tar.gz: 24d3b8bb3b7e32576ba54afc03e203b18b3ccc8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe3ede906fbcf129a02687f48fa98c7497da3e63b614e01f8a9c669d44930ed60477608e1efbae96ba1bb812f942c63731b5b80565b1f826b8f66788ca6f3c2c
|
7
|
+
data.tar.gz: 910a181c644904a8bd3126507937108623acb82aec7a91ceb8c508058fa1130efd628bbfa4db9172cd9088a5465833c8b7b01facc207ebc38f85115cea0148a2
|
@@ -20,8 +20,8 @@ module Notifiable
|
|
20
20
|
|
21
21
|
end
|
22
22
|
|
23
|
-
def processed(notification, device_token)
|
24
|
-
receipts << {:
|
23
|
+
def processed(notification, device_token, status)
|
24
|
+
receipts << {notification_id: notification.id, device_token_id: device_token.id, status: status }
|
25
25
|
|
26
26
|
if receipts.count > 10000
|
27
27
|
save_receipts
|
@@ -38,7 +38,7 @@ module Notifiable
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def save_receipts
|
41
|
-
Notifiable::
|
41
|
+
Notifiable::NotificationStatus.bulk_insert! receipts
|
42
42
|
@receipts = []
|
43
43
|
end
|
44
44
|
end
|
data/lib/notifiable/version.rb
CHANGED
data/lib/notifiable.rb
CHANGED
@@ -3,7 +3,7 @@ require 'notifiable/notifiable_concern'
|
|
3
3
|
require 'notifiable/railtie' if defined?(Rails)
|
4
4
|
require 'notifiable/engine'
|
5
5
|
require 'notifiable/notification'
|
6
|
-
require 'notifiable/
|
6
|
+
require 'notifiable/notification_status'
|
7
7
|
require 'notifiable/batch'
|
8
8
|
require 'notifiable/device_token'
|
9
9
|
require 'notifiable/notifier_base'
|
data/spec/batch_spec.rb
CHANGED
@@ -12,9 +12,9 @@ describe Notifiable do
|
|
12
12
|
b.add(notification1, user2)
|
13
13
|
end
|
14
14
|
|
15
|
-
Notifiable::
|
15
|
+
Notifiable::NotificationStatus.count.should == 2
|
16
16
|
|
17
|
-
all_notifications = Notifiable::
|
17
|
+
all_notifications = Notifiable::NotificationStatus.all
|
18
18
|
first_notification_token = all_notifications[0]
|
19
19
|
first_notification_token.notification.message.should eql "First test message"
|
20
20
|
first_notification_token.device_token.should eql user1.device_tokens[0]
|
@@ -30,14 +30,16 @@ describe Notifiable do
|
|
30
30
|
b.add(notification2, user2)
|
31
31
|
end
|
32
32
|
|
33
|
-
Notifiable::
|
33
|
+
Notifiable::NotificationStatus.count.should == 2
|
34
34
|
|
35
|
-
all_notifications = Notifiable::
|
35
|
+
all_notifications = Notifiable::NotificationStatus.all
|
36
36
|
first_notification_token = all_notifications[0]
|
37
|
+
first_notification_token.status.should == 200
|
37
38
|
first_notification_token.notification.message.should eql "First test message"
|
38
39
|
first_notification_token.device_token.should eql user1.device_tokens[0]
|
39
40
|
|
40
41
|
second_notification_token = all_notifications[1]
|
42
|
+
second_notification_token.status.should == 200
|
41
43
|
second_notification_token.notification.message.should eql "Second test message"
|
42
44
|
second_notification_token.device_token.should eql user2.device_tokens[0]
|
43
45
|
end
|
data/spec/notifiable_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe Notifiable::Concern do
|
|
8
8
|
|
9
9
|
user1.send_notification(notification)
|
10
10
|
|
11
|
-
Notifiable::
|
11
|
+
Notifiable::NotificationStatus.count.should == 1
|
12
12
|
end
|
13
13
|
|
14
14
|
it "sends zero notifications if the device is not valid" do
|
@@ -16,7 +16,7 @@ describe Notifiable::Concern do
|
|
16
16
|
|
17
17
|
user.send_notification(notification)
|
18
18
|
|
19
|
-
Notifiable::
|
19
|
+
Notifiable::NotificationStatus.count.should == 0
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/test_app/db/schema.rb
CHANGED
@@ -27,11 +27,10 @@ ActiveRecord::Schema.define(version: 20131229104039) do
|
|
27
27
|
add_index "notifiable_device_tokens", ["token"], name: "index_notifiable_device_tokens_on_token", unique: true
|
28
28
|
add_index "notifiable_device_tokens", ["user_id"], name: "index_notifiable_device_tokens_on_user_id"
|
29
29
|
|
30
|
-
create_table "
|
31
|
-
t.integer
|
32
|
-
t.integer
|
33
|
-
t.
|
34
|
-
t.datetime "updated_at"
|
30
|
+
create_table "notifiable_notification_statuses", force: true do |t|
|
31
|
+
t.integer "notification_id"
|
32
|
+
t.integer "device_token_id"
|
33
|
+
t.integer "status"
|
35
34
|
end
|
36
35
|
|
37
36
|
create_table "notifiable_notifications", force: true do |t|
|
Binary file
|