cronitor 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -0
- data/cronitor.gemspec +1 -0
- data/lib/cronitor.rb +16 -2
- data/lib/cronitor/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62931e4f5e773ffba0710b4d89bcf0bf62c7f614
|
4
|
+
data.tar.gz: 715ce68d247ee1a24dd6d81df71c17366a7b9878
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa1cbf980d25a4a9daab92a453f1d119070e4d444e6d68bf58b28971c60aecb86a43a74af48d5d065ce5f9ac08d7c3f77ce685ad4ad3529066de2daf742ebbe5
|
7
|
+
data.tar.gz: 7134bc4c2e53f70ff0870f3159ecb816ad2ee09f171d10e4f3543561b76b28fba9d428af90f161b6fef4510d092051fc9b512f19176cb354d8f3dfe071fc1ae9
|
data/Rakefile
CHANGED
data/cronitor.gemspec
CHANGED
data/lib/cronitor.rb
CHANGED
@@ -16,14 +16,16 @@ class Cronitor
|
|
16
16
|
@opts = opts
|
17
17
|
@code = code
|
18
18
|
|
19
|
-
if
|
19
|
+
exists? opts[:name] if opts && opts.key?(:name)
|
20
|
+
|
21
|
+
if token.nil? && @code.nil?
|
20
22
|
fail(
|
21
23
|
Cronitor::Error,
|
22
24
|
'Either a Cronitor API token or an existing monitor code must be ' \
|
23
25
|
'provided')
|
24
26
|
end
|
25
27
|
|
26
|
-
create if code.nil?
|
28
|
+
create if @code.nil?
|
27
29
|
end
|
28
30
|
|
29
31
|
def create
|
@@ -36,6 +38,18 @@ class Cronitor
|
|
36
38
|
@code = response.body['code'] if valid? response
|
37
39
|
end
|
38
40
|
|
41
|
+
def exists?(name)
|
42
|
+
response = Unirest.get(
|
43
|
+
"#{API_URL}/monitors/#{URI.escape name}",
|
44
|
+
auth: { user: token }
|
45
|
+
)
|
46
|
+
return false unless response.code == 200
|
47
|
+
|
48
|
+
@code = response.body['code']
|
49
|
+
|
50
|
+
true
|
51
|
+
end
|
52
|
+
|
39
53
|
def ping(type, msg = nil)
|
40
54
|
url = "#{PING_URL}/#{code}/#{type}"
|
41
55
|
url += "?msg=#{URI.escape msg}" if type == 'fail' && !msg.nil?
|
data/lib/cronitor/version.rb
CHANGED
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: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Byrnes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unirest
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '1.4'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: bump
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.1'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.1'
|
111
125
|
description:
|
112
126
|
email:
|
113
127
|
- thejeffbyrnes@gmail.com
|