cronitor 0.4.0 → 1.0.0

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
  SHA1:
3
- metadata.gz: 62931e4f5e773ffba0710b4d89bcf0bf62c7f614
4
- data.tar.gz: 715ce68d247ee1a24dd6d81df71c17366a7b9878
3
+ metadata.gz: dfb4bc2a6d6edac6fd2f95844f1960ed7fb1386b
4
+ data.tar.gz: 95ba43106ee758681c6e681e9e0a388bbe810437
5
5
  SHA512:
6
- metadata.gz: fa1cbf980d25a4a9daab92a453f1d119070e4d444e6d68bf58b28971c60aecb86a43a74af48d5d065ce5f9ac08d7c3f77ce685ad4ad3529066de2daf742ebbe5
7
- data.tar.gz: 7134bc4c2e53f70ff0870f3159ecb816ad2ee09f171d10e4f3543561b76b28fba9d428af90f161b6fef4510d092051fc9b512f19176cb354d8f3dfe071fc1ae9
6
+ metadata.gz: 12995df33e43f2a6959b2662eb4a99c3162fa869376a09c3795ed3b2a78c5fedf8b87bac7d2d275930a6d6f6aabe1e9bfe783e5c05e9496f19f8283a394ee3cd
7
+ data.tar.gz: e237a122016b09638091f012a7a03e902310e01e8fe0aa9aacdf91e7042481cf96f1e0e584835e919fe5cc7739ecdfab711949eb6e89623f4f67b8ff0664c1dc
data/README.md CHANGED
@@ -35,7 +35,7 @@ require 'cronitor'
35
35
  monitor_options = {
36
36
  name: 'My Fancy Monitor',
37
37
  notifications: {
38
- emails: [],
38
+ emails: ['test@example.com'],
39
39
  slack: [],
40
40
  pagerduty: [],
41
41
  phones: [],
data/lib/cronitor.rb CHANGED
@@ -16,8 +16,6 @@ class Cronitor
16
16
  @opts = opts
17
17
  @code = code
18
18
 
19
- exists? opts[:name] if opts && opts.key?(:name)
20
-
21
19
  if token.nil? && @code.nil?
22
20
  fail(
23
21
  Cronitor::Error,
@@ -25,6 +23,9 @@ class Cronitor
25
23
  'provided')
26
24
  end
27
25
 
26
+ exists? opts[:name] if opts && opts.key?(:name)
27
+ human_readable opts[:rules] if opts && opts.key?(:rules)
28
+
28
29
  create if @code.nil?
29
30
  end
30
31
 
@@ -58,6 +59,15 @@ class Cronitor
58
59
  valid? response
59
60
  end
60
61
 
62
+ def human_readable(rules)
63
+ rules.each do |rule|
64
+ unless rule[:human_readable]
65
+ rule[:human_readable] = "#{rule[:rule_type]} #{rule[:duration]} " \
66
+ "#{rule[:time_unit]}"
67
+ end
68
+ end
69
+ end
70
+
61
71
  private
62
72
 
63
73
  def valid?(response)
@@ -1,3 +1,3 @@
1
1
  class Cronitor
2
- VERSION = '0.4.0'
2
+ VERSION = '1.0.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cronitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Byrnes