notifiable-core 0.1.4 → 0.1.5
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee5fccd800a04500a363939b090a2a9f88faa45c84a6d43af689e0036efe1191
|
4
|
+
data.tar.gz: a7bf3297962dda646bc268d9ee07a09008f89a917e0450f4c896e85ed57c6ad2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3816a57d151d68f66dce06cdf8210a773a03e965b08cb91955a6baa788ce8c04d3c7d9e5b0ba0f1495814986cf9deeee91a9a85a27f25c78691cf1bbdcbabee
|
7
|
+
data.tar.gz: 119f7f22adc594d0af15b16b5f7c2811cf256184138623c0f788573690eb8a8600f0b18f8aae952f082068116ee84d1d03d49c481d1ae09b2a2c853e5ab593bf
|
@@ -10,12 +10,20 @@ module Notifiable
|
|
10
10
|
serialize :parameters
|
11
11
|
|
12
12
|
has_many :notification_statuses, class_name: 'Notifiable::NotificationStatus', dependent: :destroy
|
13
|
+
|
14
|
+
after_initialize :set_default_status
|
15
|
+
|
16
|
+
ERROR_STATUS = -1
|
17
|
+
WAITING_STATUS = 0
|
18
|
+
SENDING_STATUS = 1
|
19
|
+
FINISHED_STATUS = 2
|
13
20
|
|
14
21
|
def batch
|
22
|
+
update(status: SENDING_STATUS)
|
15
23
|
yield(self)
|
16
|
-
|
24
|
+
update_attributes({status: FINISHED_STATUS, last_error_message: nil})
|
17
25
|
rescue => e
|
18
|
-
|
26
|
+
update_attributes({status: ERROR_STATUS, last_error_message: e.message})
|
19
27
|
raise e
|
20
28
|
ensure
|
21
29
|
close
|
@@ -41,6 +49,10 @@ module Notifiable
|
|
41
49
|
|
42
50
|
private
|
43
51
|
|
52
|
+
def set_default_status
|
53
|
+
self.status ||= WAITING_STATUS
|
54
|
+
end
|
55
|
+
|
44
56
|
def notifiers
|
45
57
|
@notifiers ||= {}
|
46
58
|
end
|
data/lib/notifiable/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notifiable-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brooke-Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -201,6 +201,7 @@ files:
|
|
201
201
|
- db/migrate/201806182135000_add_thread_id_to_notifications.rb
|
202
202
|
- db/migrate/201806242135000_add_category_to_notifications.rb
|
203
203
|
- db/migrate/201808242135000_add_error_message_to_notification_statuses.rb
|
204
|
+
- db/migrate/201808272135000_add_status_to_notifications.rb
|
204
205
|
- lib/notifiable.rb
|
205
206
|
- lib/notifiable/app.rb
|
206
207
|
- lib/notifiable/device_token.rb
|