README.md in cronitor-2.0.0 vs README.md in cronitor-3.0.0

- old
+ new

@@ -1,8 +1,8 @@ # Cronitor -[![Travis](https://img.shields.io/travis/evertrue/cronitor.svg)](https://github.com/evertrue/cronitor) +[![Travis](https://img.shields.io/travis/evertrue/cronitor.svg)](https://travis-ci.org/evertrue/cronitor) [![Gem Version](https://badge.fury.io/rb/cronitor.svg)](https://badge.fury.io/rb/cronitor) [Cronitor](https://cronitor.io/) is a service for heartbeat-style monitoring of just about anything that can send an HTTP request. This gem provides a simple abstraction for the creation and pinging of a Cronitor monitor. For a better understanding of the API this gem talks to, please see [How Cronitor Works](https://cronitor.io/help/how-cronitor-works). @@ -27,47 +27,44 @@ ### Creating a Monitor A Cronitor monitor (hereafter referred to only as a monitor for brevity) is created if it does not already exist, and its ID returned. +Please see the [Cronitor Monitor API docs](https://cronitor.io/docs/monitor-api) for details of all the possible monitor options. + +Example of creating a heartbeat monitor: + ```ruby require 'cronitor' monitor_options = { name: 'My Fancy Monitor', + type: 'heartbeat', # Optional: the gem defaults to this; the other value, 'healthcheck', is not yet supported by this gem notifications: { emails: ['test@example.com'], slack: [], pagerduty: [], phones: [], webhooks: [] }, rules: [ { - rule_type: 'not_run_in', - duration: 5 - rime_unit: 'seconds' + rule_type: 'run_ping_not_received', + value: 5, + time_unit: 'seconds' } ], note: 'A human-friendly description of this monitor' } + +# The token parameter is optional; if omittted, ENV['CRONITOR_TOKEN'] will be used my_monitor = Cronitor.new token: 'api_token', opts: monitor_options ``` -You may optionally specify a `:human_readable` value for your rule(s), otherwise one will be crafted for you: +### Updating an existing monitor -```ruby -monitor_options = { - rules: [ - { - rule_type: 'not_run_in', - duration: 5 - time_unit: 'seconds', - human_readable: 'not_run_in 5 seconds' - } - ], -``` +Currently this gem does not support updating or deleting an existing monitor. ### Pinging a Monitor 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`. @@ -77,12 +74,14 @@ my_monitor.ping 'fail', 'A short description of the failure' ``` ### Pinging a monitor when you have a Cronitor code -You may already have the code for a monitor, in which case, the expense of `Cronitor.new` may seem unnecessary (since it makes an HTTP request to check if a monitor exists, and you already know it does). +You may already have the code for a monitor, in which case, the expense of `Cronitor.create` may seem unnecessary (since it makes an HTTP request to check if a monitor exists, and you already know it does). +Cronitor does not require a token for pinging a monitor unless you have enabled Ping API authentication in your account settings. At the moment, this gem does not support Ping API auth. + In that case: ```ruby my_monitor = Cronitor.new code: 'abcd' ``` @@ -100,5 +99,12 @@ 1. Fork it ( https://github.com/evertrue/cronitor/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create a new Pull Request + +## Release a new version + +The `bump` gem makes this easy: + +1. `rake bump:(major|minor|patch|pre)` +2. `rake release`