doggy 2.0.18 → 2.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8fffcdb181744f9d0f48b41877151bb8c39e4ed9
4
- data.tar.gz: 576233b7f36fe9004d89f40caaa84c2dec38e5b9
3
+ metadata.gz: 6be667ac225b597c970d76e5ecad61a39e8d1c1e
4
+ data.tar.gz: ea50d8647a1f8df3d43d5016300e4168745939f6
5
5
  SHA512:
6
- metadata.gz: d4299cf9f9f02e9649c7c4e5df28f5a32e470e3ba7f49668e4523d51b5816138d972a66446311a1c6affd5562d864f5926c0526221bdb86ac299a33f7e1225dc
7
- data.tar.gz: 8ab7493ec5d0c58b8925d393200364b457bc8fe2db40626a85a4f9c5c6e44b09cd405a1e5053d7e77cb970cb0997c54ccf6bd483806e119f971f6b5ba5f0acdb
6
+ metadata.gz: 72be3cf15ab9a796e6592983267992ca9e01bf7df4e47f57929870b6fa471f3b702203b8e0fcdb0359a6ffc31b7f507119f3d37c31bce9d649a7b55809e0eeca
7
+ data.tar.gz: 6b5dbde6cf5c502db7f176fc724074f2b897a372a1d645f2eba0428a3c612e2b490a91ac200ea2fd45334806c4c22a1abe9a6a8e37cdc3afd088b6934dbafb6e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- doggy (2.0.18)
4
+ doggy (2.0.19)
5
5
  json (~> 1.8.3)
6
6
  parallel (~> 1.6.1)
7
7
  rugged (~> 0.23.2)
data/lib/doggy/model.rb CHANGED
@@ -180,9 +180,13 @@ module Doggy
180
180
  Doggy::Model.sort_by_key(super)
181
181
  end
182
182
 
183
+ def validate
184
+ # NotImplemented
185
+ end
186
+
183
187
  def save
184
188
  ensure_managed_emoji!
185
- ensure_renotify_interval_valid
189
+ validate
186
190
 
187
191
  body = JSON.dump(to_h)
188
192
  if !id then
@@ -59,13 +59,8 @@ module Doggy
59
59
  self.name += " \xF0\x9F\x90\xB6"
60
60
  end
61
61
 
62
- def ensure_renotify_interval_valid
63
- return unless options && options.renotify_interval && options.renotify_interval.to_i > 0
64
-
65
- allowed_renotify_intervals = [10,20,30,40,50,60,90,120,180,240,300,360,720,1440] # minutes
66
- best_matching_interval = allowed_renotify_intervals.min_by { |x| (x.to_f - options.renotify_interval).abs }
67
- puts "WARN: Monitor #{self.id} uses invalid escalation interval (renotify_interval) #{options.renotify_interval}, using #{best_matching_interval} instead"
68
- options.renotify_interval = best_matching_interval
62
+ def validate
63
+ ensure_renotify_interval_valid
69
64
  end
70
65
 
71
66
  def mute
@@ -89,6 +84,17 @@ module Doggy
89
84
  def to_h
90
85
  super.merge(options: options.to_h)
91
86
  end
87
+
88
+ private
89
+
90
+ def ensure_renotify_interval_valid
91
+ return unless options && options.renotify_interval && options.renotify_interval.to_i > 0
92
+
93
+ allowed_renotify_intervals = [10,20,30,40,50,60,90,120,180,240,300,360,720,1440] # minutes
94
+ best_matching_interval = allowed_renotify_intervals.min_by { |x| (x.to_f - options.renotify_interval).abs }
95
+ puts "WARN: Monitor #{self.id} uses invalid escalation interval (renotify_interval) #{options.renotify_interval}, using #{best_matching_interval} instead"
96
+ options.renotify_interval = best_matching_interval
97
+ end
92
98
  end # Monitor
93
99
  end # Models
94
100
  end # Doggy
data/lib/doggy/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Doggy
4
- VERSION = "2.0.18"
4
+ VERSION = "2.0.19"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doggy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.18
4
+ version: 2.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vlad Gorodetsky
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-11-13 00:00:00.000000000 Z
12
+ date: 2015-11-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json