3scale-api 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 534c8d32f7f151a610d59cf1b006072ecef44df853ea9bc3598768182aef2409
4
- data.tar.gz: c756d62437992a2557953dac7aa6e8eac1d81a2c9bdd95bd844edf8bd6ffba07
3
+ metadata.gz: a193e21d894bbcbc922ecce719af6737c68b71e77ebee260ad4de038bf6676de
4
+ data.tar.gz: 7b2d0644e45a953242a700f950b268dec38d719e73c5619bef14961bc13ea672
5
5
  SHA512:
6
- metadata.gz: 6df107eed792c7b7d2d58a6aaa8badef812195a708b024c3ec8e852afe995c020f9dd4198e6ffd25b89728d3fe76de41fb206b90f551ea00feb0c2d372476019
7
- data.tar.gz: c06697d2021cfe41454f49e3eb8c2c90d7e811169fa30ab298fa6a025fd8faa8c3d04556983b843e55c43e8039fdf4852bd8dfdaf33dc0f6113fe23dcea66826
6
+ metadata.gz: e0e2b6d70e63fb1c1a4965178ba99f4ffe9cfc93f89404e4123364dc50fad56b37d89bf05243998854dd43bcefb1d93806eb0a88b32ae7b0040e7e35a38f5af0
7
+ data.tar.gz: 0de8726e6eed9011f1fe694b46a1e2b242040d137b430259b6b1d31ccc58c4a02a01a6eb969ea46c32a4764d58d74ef2bcf159b04f670fb94ba73750d0f5bc06
@@ -217,6 +217,15 @@ module ThreeScale
217
217
  extract(entity: 'mapping_rule', from: response)
218
218
  end
219
219
 
220
+ # @api public
221
+ # @param [Fixnum] service_id Service ID
222
+ # @param [Fixnum] id Metric ID
223
+ # @return [Hash]
224
+ def show_metric(service_id, id)
225
+ response = http_client.get("/admin/api/services/#{service_id}/metrics/#{id}")
226
+ extract(entity: 'metric', from: response)
227
+ end
228
+
220
229
  # @api public
221
230
  # @return [Array<Hash>]
222
231
  # @param [Fixnum] service_id Service ID
@@ -235,6 +244,51 @@ module ThreeScale
235
244
  extract(entity: 'metric', from: response)
236
245
  end
237
246
 
247
+ # @api public
248
+ # @return [Hash]
249
+ # @param [Fixnum] service_id Service ID
250
+ # @param [Fixnum] metric_id Metric ID
251
+ # @param [Hash] attributes Metric Attributes
252
+ # @option attributes [String] :friendly_name Metric Name
253
+ # @option attributes [String] :unit Metric unit
254
+ # @option attributes [String] :description Metric description
255
+ def update_metric(service_id, metric_id, attributes)
256
+ response = http_client.put("/admin/api/services/#{service_id}/metrics/#{metric_id}",
257
+ body: { metric: attributes })
258
+ extract(entity: 'metric', from: response)
259
+ end
260
+
261
+ # @api public
262
+ # @return [Bool]
263
+ # @param [Fixnum] service_id Service ID
264
+ # @param [Fixnum] metric_id Metric ID
265
+ def delete_metric(service_id, metric_id)
266
+ http_client.delete("/admin/api/services/#{service_id}/metrics/#{metric_id}")
267
+ true
268
+ end
269
+
270
+ # @api public
271
+ # @param [Fixnum] service_id Service ID
272
+ # @param [Fixnum] id Parent metric ID
273
+ # @param [Fixnum] id Method ID
274
+ # @return [Hash]
275
+ def show_method(service_id, parent_id, id)
276
+ response = http_client.get("/admin/api/services/#{service_id}/metrics/#{parent_id}/methods/#{id}")
277
+ extract(entity: 'method', from: response)
278
+ end
279
+
280
+ # @api public
281
+ # @return [Hash]
282
+ # @param [Fixnum] service_id Service ID
283
+ # @param [Fixnum] parent_id Parent metric ID
284
+ # @param [Fixnum] id Method ID
285
+ # @param [Hash] attributes Method Attributes
286
+ def update_method(service_id, parent_id, id, attributes)
287
+ response = http_client.put("/admin/api/services/#{service_id}/metrics/#{parent_id}/methods/#{id}",
288
+ body: { metric: attributes })
289
+ extract(entity: 'method', from: response)
290
+ end
291
+
238
292
  # @api public
239
293
  # @return [Array<Hash>]
240
294
  # @param [Fixnum] service_id Service ID
@@ -256,6 +310,17 @@ module ThreeScale
256
310
  extract(entity: 'method', from: response)
257
311
  end
258
312
 
313
+ # @api public
314
+ # @return [Bool]
315
+ # @param [Fixnum] service_id Service ID
316
+ # @param [Fixnum] parent_id Parent metric ID
317
+ # @param [Fixnum] metric_id Metric ID
318
+ def delete_method(service_id, parent_id, id)
319
+ http_client.delete("/admin/api/services/#{service_id}/metrics/#{parent_id}/methods/#{id}")
320
+ true
321
+ end
322
+
323
+
259
324
  # @api public
260
325
  # @param [Fixnum] application_plan_id Application Plan ID
261
326
  # @param [Fixnum] metric_id Metric ID
@@ -1,5 +1,5 @@
1
1
  module ThreeScale
2
2
  module API
3
- VERSION = '0.3.0'.freeze
3
+ VERSION = '0.4.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 3scale-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Cichra
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-05-03 00:00:00.000000000 Z
12
+ date: 2019-05-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler