noticed 1.5.1 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/noticed/base.rb +2 -0
- data/lib/noticed/delivery_methods/ios.rb +21 -2
- data/lib/noticed/model.rb +11 -1
- data/lib/noticed/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90b43c50384068092455c10cd6686fc46cd766121c0ea5cf593bbc4c8306e8de
|
4
|
+
data.tar.gz: 23edb385b0c9981dd9c292c8f4c15ce6fadd9abb131adc1eb6440ab39c5fa186
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a5d92df6618d53f8be91ca71bdf6dfc6ff0b66279662a5690c6efaa162939f2ae4fe1868956427ff10a83fa77329c16c96af3faef9e2fa48e441f1478c91ed0
|
7
|
+
data.tar.gz: 6d485a661fe14b24811479615e125cb4bf2794808dd28b39c102e677b1a1e99a0f22807acbc75a728442764f521c498ffa884998e243dacad5ea9e4e4cd2ca19
|
data/lib/noticed/base.rb
CHANGED
@@ -81,6 +81,8 @@ module Noticed
|
|
81
81
|
def run_delivery(recipient, enqueue: true)
|
82
82
|
delivery_methods = self.class.delivery_methods.dup
|
83
83
|
|
84
|
+
self.recipient = recipient
|
85
|
+
|
84
86
|
# Run database delivery inline first if it exists so other methods have access to the record
|
85
87
|
if (index = delivery_methods.find_index { |m| m[:name] == :database })
|
86
88
|
delivery_method = delivery_methods.delete_at(index)
|
@@ -9,7 +9,7 @@ module Noticed
|
|
9
9
|
raise ArgumentError, "bundle_identifier is missing" if bundle_identifier.blank?
|
10
10
|
raise ArgumentError, "key_id is missing" if key_id.blank?
|
11
11
|
raise ArgumentError, "team_id is missing" if team_id.blank?
|
12
|
-
raise ArgumentError, "Could not find APN cert at '#{cert_path}'" unless
|
12
|
+
raise ArgumentError, "Could not find APN cert at '#{cert_path}'" unless valid_cert_path?
|
13
13
|
|
14
14
|
device_tokens.each do |device_token|
|
15
15
|
connection_pool.with do |connection|
|
@@ -78,7 +78,7 @@ module Noticed
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
if
|
81
|
+
if development?
|
82
82
|
Apnotic::ConnectionPool.development(connection_pool_options, pool_options, &handler)
|
83
83
|
else
|
84
84
|
Apnotic::ConnectionPool.new(connection_pool_options, pool_options, &handler)
|
@@ -142,6 +142,25 @@ module Noticed
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
+
def development?
|
146
|
+
option = options[:development]
|
147
|
+
case option
|
148
|
+
when Symbol
|
149
|
+
!!notification.send(option)
|
150
|
+
else
|
151
|
+
!!option
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def valid_cert_path?
|
156
|
+
case cert_path
|
157
|
+
when File, StringIO
|
158
|
+
cert_path.size > 0
|
159
|
+
else
|
160
|
+
File.exist?(cert_path)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
145
164
|
def pool_options
|
146
165
|
{
|
147
166
|
size: options.fetch(:pool_size, 5)
|
data/lib/noticed/model.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
module Noticed
|
2
2
|
module Model
|
3
|
+
DATABASE_ERROR_CLASS_NAMES = lambda {
|
4
|
+
classes = [ActiveRecord::NoDatabaseError]
|
5
|
+
classes << ActiveRecord::ConnectionNotEstablished
|
6
|
+
classes << Mysql2::Error if defined?(::Mysql2)
|
7
|
+
classes << PG::ConnectionBad if defined?(::PG)
|
8
|
+
classes
|
9
|
+
}.call.freeze
|
10
|
+
|
3
11
|
extend ActiveSupport::Concern
|
4
12
|
|
5
13
|
included do
|
@@ -32,7 +40,9 @@ module Noticed
|
|
32
40
|
else
|
33
41
|
Noticed::TextCoder
|
34
42
|
end
|
35
|
-
rescue
|
43
|
+
rescue *DATABASE_ERROR_CLASS_NAMES => _error
|
44
|
+
warn("Noticed was unable to bootstrap correctly as the database is unavailable.")
|
45
|
+
|
36
46
|
Noticed::TextCoder
|
37
47
|
end
|
38
48
|
end
|
data/lib/noticed/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noticed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Oliver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|