kapacitor-ruby 1.0.2 → 1.0.3

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
  SHA1:
3
- metadata.gz: 97fd28ae0c38ca2649dc1aa6caf64d93486148ab
4
- data.tar.gz: 87c38785fbf478b9c4bb5bcb1aed5f983173da63
3
+ metadata.gz: 30d665b31a22923dcfe3f323870cd2dbca608f4d
4
+ data.tar.gz: 2ade7584998c461366148de74ed744e29f111396
5
5
  SHA512:
6
- metadata.gz: 976de61620d4e124b53d5acfc26fcf711ff2fdcb0c9e936fbc85d2cd652262a94f9bf67078205ae6afb88d53fa34733373490617c2a0e7de166821710628e0c4
7
- data.tar.gz: 6c2fe44b7f27e0bf7b40b1ce636c057bf3b0fe876c17b51b7e140a3d70ce6ce03c007603401b1332fa60d4238abd0ba1279670d7aea5a12545d6049c6e2a8ca8
6
+ metadata.gz: 067d28ae1d7d640bbce58ee6304859065057d1d554a7685f08ae2703edd17504d771aac95c8cdf144554fad8060c0e74511591dea6344c67b25191a973110f2a
7
+ data.tar.gz: ae4153783f39f02933cf12f19e24c390a88bf173a6c363962aea1369ca6b9045441e377cdc84ba977053760b47c564ae1f687852b07a457152868672bbfb07f6
@@ -14,8 +14,8 @@ module Kapacitor
14
14
  # @param version [Integer] API version (defaults to `v1preview`)
15
15
  #
16
16
  def initialize(url: 'http://localhost:9092/kapacitor', version: 'v1preview')
17
- @url = URI.join(url, version)
18
17
  @http = HTTPClient.new
18
+ @url = [url, version].join('/')
19
19
  end
20
20
 
21
21
  # Define a Kapacitor template
@@ -33,7 +33,7 @@ module Kapacitor
33
33
  'script' => script
34
34
  }
35
35
 
36
- api_post(endpoint: '/templates', data: req)
36
+ api_post(endpoint: 'templates', data: req)
37
37
  end
38
38
 
39
39
  # Update a Kapacitor template
@@ -50,7 +50,7 @@ module Kapacitor
50
50
  raise ArgumentError, "Kapacitor template type can be either 'batch' or 'stream'" unless opts[:type] == 'batch' or opts[:type] == 'stream'
51
51
  end
52
52
 
53
- api_patch(endpoint: "/templates/#{id}", data: req) unless req.empty?
53
+ api_patch(endpoint: "templates/#{id}", data: req) unless req.empty?
54
54
  end
55
55
 
56
56
  # Delete a Kapacitor template
@@ -58,7 +58,7 @@ module Kapacitor
58
58
  # @param id [String] Template ID
59
59
  #
60
60
  def delete_template(id:)
61
- api_delete(endpoint: "/templates/#{id}")
61
+ api_delete(endpoint: "templates/#{id}")
62
62
  end
63
63
 
64
64
  # Retrieve Kapacitor templates
@@ -116,7 +116,7 @@ module Kapacitor
116
116
 
117
117
  req['vars'] = opts[:vars] if opts[:vars]
118
118
 
119
- api_post(endpoint: '/tasks', data: req)
119
+ api_post(endpoint: 'tasks', data: req)
120
120
  end
121
121
 
122
122
  # Update a Kapacitor task
@@ -141,7 +141,7 @@ module Kapacitor
141
141
  raise ArgumentError, "Kapacitor task status can be either 'enabled' or 'disabled'" unless opts[:status] == 'enabled' || opts[:status] == 'disabled'
142
142
  end
143
143
 
144
- api_patch(endpoint: "/tasks/#{id}", data: req) unless req.empty?
144
+ api_patch(endpoint: "tasks/#{id}", data: req) unless req.empty?
145
145
  end
146
146
 
147
147
  # Delete a Kapacitor task
@@ -149,7 +149,7 @@ module Kapacitor
149
149
  # @param id [String] Task ID
150
150
  #
151
151
  def delete_task(id:)
152
- api_delete(endpoint: "/tasks/#{id}")
152
+ api_delete(endpoint: "tasks/#{id}")
153
153
  end
154
154
 
155
155
  # Retrieve Kapacitor tasks
@@ -193,7 +193,7 @@ module Kapacitor
193
193
  end
194
194
 
195
195
  req['actions'] = actions
196
- api_post(endpoint: "/alerts/topics/#{topic}/handlers", data: req)
196
+ api_post(endpoint: "alerts/topics/#{topic}/handlers", data: req)
197
197
  end
198
198
 
199
199
  # Update a topic handler
@@ -209,7 +209,7 @@ module Kapacitor
209
209
  raise ArgumentError, "Kapacitor topic handler requires one or more actions" unless actions.size > 0
210
210
 
211
211
  req['actions'] = actions
212
- api_put(endpoint: "/alerts/topics/#{topic}/handlers/#{id}", data: req) unless req.empty?
212
+ api_put(endpoint: "alerts/topics/#{topic}/handlers/#{id}", data: req) unless req.empty?
213
213
  end
214
214
 
215
215
  # Delete a topic handler
@@ -218,7 +218,7 @@ module Kapacitor
218
218
  # @param topic [String] Topic name
219
219
  #
220
220
  def delete_topic_handler(id:, topic:)
221
- api_delete(endpoint: "/alerts/topics/#{topic}/handlers/#{id}")
221
+ api_delete(endpoint: "alerts/topics/#{topic}/handlers/#{id}")
222
222
  end
223
223
 
224
224
  # Retrieve topic's handlers
@@ -3,7 +3,7 @@
3
3
  #
4
4
 
5
5
  module Kapacitor
6
- VERSION = "1.0.2"
6
+ VERSION = "1.0.3"
7
7
 
8
8
  def self.version
9
9
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kapacitor-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Cerutti