kapacitor-ruby 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kapacitor/client.rb +21 -7
- data/lib/kapacitor/version.rb +1 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82ce3690bdcf6c10b5f3470557f61812dacdf11b
|
4
|
+
data.tar.gz: bf3d8bfb1845055a22735db2450808c63c72b6e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cdf19fe98d1d673e0ca8a340a9f8f2934e4cc77cd2624f16f7cdda2f4abd6916e5896edc61df80b015fe0ac9f3579564ebf4775fc94b0155179da7431143662
|
7
|
+
data.tar.gz: 8e8f9f3bf74a98f6e67cd456a34605626d3a42b6f4ad10d83cb01303a5b9d70a630561c759c2b67bbdbabc4c55474fa16fb8da21879dbae881ddae424923d4e1
|
data/lib/kapacitor/client.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# client.rb
|
3
3
|
#
|
4
|
-
# Author: Matteo Cerutti <matteo.cerutti@hotmail.co.uk>
|
5
|
-
#
|
6
4
|
|
7
5
|
require 'net/http'
|
8
6
|
require 'json'
|
@@ -52,8 +50,17 @@ module Kapacitor
|
|
52
50
|
api_delete("/templates/#{id}")
|
53
51
|
end
|
54
52
|
|
55
|
-
def templates
|
56
|
-
|
53
|
+
def templates(offset: 0, limit: 100)
|
54
|
+
templates = []
|
55
|
+
|
56
|
+
loop do
|
57
|
+
res = api_get("/templates?offset=#{offset}&limit=#{limit}")['templates']
|
58
|
+
break unless res.size > 0
|
59
|
+
templates += res
|
60
|
+
offset += limit
|
61
|
+
end
|
62
|
+
|
63
|
+
templates
|
57
64
|
end
|
58
65
|
|
59
66
|
def define_task(id, opts = {})
|
@@ -115,11 +122,18 @@ module Kapacitor
|
|
115
122
|
api_delete("/tasks/#{id}")
|
116
123
|
end
|
117
124
|
|
118
|
-
def tasks
|
125
|
+
def tasks(offset: 0, limit: 100)
|
119
126
|
tasks = []
|
120
127
|
|
121
|
-
|
122
|
-
|
128
|
+
loop do
|
129
|
+
res = api_get("/tasks?fields=id&offset=#{offset}&limit=#{limit}")['tasks']
|
130
|
+
break unless res.size > 0
|
131
|
+
|
132
|
+
res.each do |task|
|
133
|
+
tasks << api_get("/tasks/#{task['id']}")
|
134
|
+
end
|
135
|
+
|
136
|
+
offset += limit
|
123
137
|
end
|
124
138
|
|
125
139
|
tasks
|
data/lib/kapacitor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kapacitor-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matteo Cerutti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|