cronitor 1.0.0 → 1.1.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: dfb4bc2a6d6edac6fd2f95844f1960ed7fb1386b
4
- data.tar.gz: 95ba43106ee758681c6e681e9e0a388bbe810437
3
+ metadata.gz: 97f852a88bb9a1d55729161521e841a533198f5b
4
+ data.tar.gz: f8202fa60a98954c8d45c66e00aecdb0e67e449e
5
5
  SHA512:
6
- metadata.gz: 12995df33e43f2a6959b2662eb4a99c3162fa869376a09c3795ed3b2a78c5fedf8b87bac7d2d275930a6d6f6aabe1e9bfe783e5c05e9496f19f8283a394ee3cd
7
- data.tar.gz: e237a122016b09638091f012a7a03e902310e01e8fe0aa9aacdf91e7042481cf96f1e0e584835e919fe5cc7739ecdfab711949eb6e89623f4f67b8ff0664c1dc
6
+ metadata.gz: d4a60d0d6c8de4afd286d00e9869e0f5a26bd593c630521869e84dc5c04f833f1ed92c0231709a80675e80176e381755f7c821857205bcd5b36a062ec0321993
7
+ data.tar.gz: 9d667dcc744903d1324b11ec824c7d2d387a18effd5cc93ed7a8b4cf45c920a8741f4b6f8a3b4b32edf993d13fa2649b5cfcf934903654431150b1068a4cb68f
data/README.md CHANGED
@@ -33,26 +33,40 @@ A Cronitor monitor (hereafter referred to only as a monitor for brevity) is crea
33
33
  require 'cronitor'
34
34
 
35
35
  monitor_options = {
36
- name: 'My Fancy Monitor',
37
- notifications: {
38
- emails: ['test@example.com'],
39
- slack: [],
40
- pagerduty: [],
41
- phones: [],
42
- webhooks: []
43
- },
44
- rules: [
45
- {
46
- rule_type: 'not_run_in',
47
- duration: 5
48
- time_unit: 'seconds'
49
- }
50
- ],
51
- note: 'A human-friendly description of this monitor'
36
+ name: 'My Fancy Monitor',
37
+ notifications: {
38
+ emails: ['test@example.com'],
39
+ slack: [],
40
+ pagerduty: [],
41
+ phones: [],
42
+ webhooks: []
43
+ },
44
+ rules: [
45
+ {
46
+ rule_type: 'not_run_in',
47
+ duration: 5
48
+ rime_unit: 'seconds'
49
+ }
50
+ ],
51
+ note: 'A human-friendly description of this monitor'
52
52
  }
53
53
  my_monitor = Cronitor.new token: 'api_token', opts: monitor_options
54
54
  ```
55
55
 
56
+ You may optionally specify a `:human_readable` value for your rule(s), otherwise one will be crafted for you:
57
+
58
+ ```ruby
59
+ monitor_options = {
60
+ rules: [
61
+ {
62
+ rule_type: 'not_run_in',
63
+ duration: 5
64
+ time_unit: 'seconds',
65
+ human_readable: 'not_run_in 5 seconds'
66
+ }
67
+ ],
68
+ ```
69
+
56
70
  ### Pinging a Monitor
57
71
 
58
72
  Once you’ve created a monitor, you can continue to use the existing instance of the object to ping the monitor that your task status: `run`, `complete`, or `fail`.
data/lib/cronitor.rb CHANGED
@@ -51,6 +51,18 @@ class Cronitor
51
51
  true
52
52
  end
53
53
 
54
+ def run
55
+ ping 'run'
56
+ end
57
+
58
+ def complete
59
+ ping 'complete'
60
+ end
61
+
62
+ def fail(msg = nil)
63
+ ping 'fail', msg
64
+ end
65
+
54
66
  def ping(type, msg = nil)
55
67
  url = "#{PING_URL}/#{code}/#{type}"
56
68
  url += "?msg=#{URI.escape msg}" if type == 'fail' && !msg.nil?
@@ -1,3 +1,3 @@
1
1
  class Cronitor
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.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: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Byrnes