cronitor 3.0.0 → 3.1.0

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
  SHA256:
3
- metadata.gz: 1f6ea3528a80a4d2cb84314c86bb5f55431706aa46c9a5ca787860e8823f7bbd
4
- data.tar.gz: 3467ef223aafddbab324b924fdc5552922f12310f959d32b7137eedf2ea42b98
3
+ metadata.gz: f4b5bc9e1efd7fb5247f7f473195589fb4cb822c52a1ee92f1b6c784086016f7
4
+ data.tar.gz: f617431b175f6c2e9263fc48fece1af7d7bff634285d703e5d3d57d548f70236
5
5
  SHA512:
6
- metadata.gz: a54a8268d276563c0c90cc6101ccf7db4e6aa725568b08bd7581c4d7c745fee78e5245ad51e4ac3d752370048bf09151b315f5eb3c829c345f1c81e9e1ff8fbf
7
- data.tar.gz: 8db8d9075d2daf231b54dbc2d0276448e5e39e07e0a9996ff8d8087e65f20971e105344d75f4b36812fd8a549d0f477a9dc78fd6231234f4cb932f5f182d76ed
6
+ metadata.gz: 88a42cddedfea16c32fe0ab3716684343f7c6e8adcfa9cd5018a43e28c6e1e86ba9ced38cfe361e1ecc184dde146f2b8b222320ce17c2e8e1194c4d698d55e20
7
+ data.tar.gz: 5ecb82ea549bd5a5ffb5d4298f493e40d3e2569d1517365156315a30f965fbe8b46629daf3bcae9cd029b93ad14c8363d6f06e0f543d8b26a0e270567446dc61
data/README.md CHANGED
@@ -25,6 +25,31 @@ Or install it yourself as:
25
25
 
26
26
  ## Usage
27
27
 
28
+
29
+ ### Configure
30
+
31
+ You need to set Cronitor Token in order to create a monitor
32
+
33
+ #### Using configure
34
+
35
+ ```ruby
36
+ require 'cronitor'
37
+
38
+ Cronitor.configure do |cronitor|
39
+ cronitor.default_token = 'token' # default token to be re-used by cronitor
40
+ end
41
+ ```
42
+
43
+ #### Using ENV
44
+
45
+ ```
46
+ # .env
47
+ CRONITOR_TOKEN: token
48
+
49
+ # bash
50
+ export CRONITOR_TOKEN='token'
51
+ ```
52
+
28
53
  ### Creating a Monitor
29
54
 
30
55
  A Cronitor monitor (hereafter referred to only as a monitor for brevity) is created if it does not already exist, and its ID returned.
@@ -56,7 +81,7 @@ monitor_options = {
56
81
  note: 'A human-friendly description of this monitor'
57
82
  }
58
83
 
59
- # The token parameter is optional; if omittted, ENV['CRONITOR_TOKEN'] will be used
84
+ # The token parameter is optional; if omittted, ENV['CRONITOR_TOKEN'] will be used if not configured
60
85
  my_monitor = Cronitor.new token: 'api_token', opts: monitor_options
61
86
  ```
62
87
 
@@ -11,8 +11,16 @@ class Cronitor
11
11
  API_URL = 'https://cronitor.io/v3'
12
12
  PING_URL = 'https://cronitor.link'
13
13
 
14
+ class << self
15
+ attr_accessor :default_token
16
+
17
+ def configure(&block)
18
+ block.call(self)
19
+ end
20
+ end
21
+
14
22
  def initialize(token: ENV['CRONITOR_TOKEN'], opts: {}, code: nil)
15
- @token = token
23
+ @token = token || self.class.default_token
16
24
  @opts = opts
17
25
  @code = code
18
26
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Cronitor
4
- VERSION = '3.0.0'
4
+ VERSION = '3.1.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cronitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Byrnes
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-24 00:00:00.000000000 Z
11
+ date: 2020-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bump
@@ -108,7 +108,7 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '3.1'
111
- description:
111
+ description:
112
112
  email:
113
113
  - thejeffbyrnes@gmail.com
114
114
  executables: []
@@ -133,7 +133,7 @@ files:
133
133
  homepage: https://github.com/evertrue/cronitor
134
134
  licenses: []
135
135
  metadata: {}
136
- post_install_message:
136
+ post_install_message:
137
137
  rdoc_options: []
138
138
  require_paths:
139
139
  - lib
@@ -148,8 +148,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0'
150
150
  requirements: []
151
- rubygems_version: 3.1.2
152
- signing_key:
151
+ rubygems_version: 3.1.4
152
+ signing_key:
153
153
  specification_version: 4
154
154
  summary: An interface for the Cronitor API
155
155
  test_files: []