3scale-api 0.2.0 → 0.3.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: cb974c3590c1ba93b7476a6cc2481cd574a0d8f20109d6905e0040303ca6b10f
4
- data.tar.gz: a5daa1c932a40111406cb662dc9fef1779c12fd05420014324bc1cef2c2afb75
3
+ metadata.gz: 534c8d32f7f151a610d59cf1b006072ecef44df853ea9bc3598768182aef2409
4
+ data.tar.gz: c756d62437992a2557953dac7aa6e8eac1d81a2c9bdd95bd844edf8bd6ffba07
5
5
  SHA512:
6
- metadata.gz: 1708abcd906dad6fa52b5050fca0cfb1f59c963e43c27e9c617b4703193fa16df98a417b48915c1515f94f6f79290ffa7c776a713f32bb4774a3afb30f003a6b
7
- data.tar.gz: d1ea6442ea56a67ec371054c9e70d4bf52d861fa7ac1d65aecab97f827d0d91d50d0130280c3f63ccf2833f214b789396ac364817d3728e4168edaaaffc9855c
6
+ metadata.gz: 6df107eed792c7b7d2d58a6aaa8badef812195a708b024c3ec8e852afe995c020f9dd4198e6ffd25b89728d3fe76de41fb206b90f551ea00feb0c2d372476019
7
+ data.tar.gz: c06697d2021cfe41454f49e3eb8c2c90d7e811169fa30ab298fa6a025fd8faa8c3d04556983b843e55c43e8039fdf4852bd8dfdaf33dc0f6113fe23dcea66826
@@ -138,7 +138,7 @@ module ThreeScale
138
138
  # @api public
139
139
  # @return [Hash]
140
140
  # @param [Fixnum] service_id Service ID
141
- # @param [String] environment. Must be 'sandbox' or 'production'
141
+ # @param [String] environment. Must be 'sandbox' or 'production'
142
142
  def proxy_config_list(service_id, environment='sandbox')
143
143
  response = http_client.get("/admin/api/services/#{service_id}/proxy/configs/#{environment}")
144
144
  extract(entity: 'proxy', from: response)
@@ -147,7 +147,7 @@ module ThreeScale
147
147
  # @api public
148
148
  # @return [Hash]
149
149
  # @param [Fixnum] service_id Service ID
150
- # @param [String] environment. Must be 'sandbox' or 'production'
150
+ # @param [String] environment. Must be 'sandbox' or 'production'
151
151
  def proxy_config_latest(service_id, environment='sandbox')
152
152
  response = http_client.get("/admin/api/services/#{service_id}/proxy/configs/#{environment}/latest")
153
153
  extract(entity: 'proxy', from: response)
@@ -256,6 +256,15 @@ module ThreeScale
256
256
  extract(entity: 'method', from: response)
257
257
  end
258
258
 
259
+ # @api public
260
+ # @param [Fixnum] application_plan_id Application Plan ID
261
+ # @param [Fixnum] metric_id Metric ID
262
+ # @return [Hash]
263
+ def list_metric_limits(application_plan_id, metric_id)
264
+ response = http_client.get("/admin/api/application_plans/#{application_plan_id}/metrics/#{metric_id}/limits")
265
+ extract(collection: 'limits', entity: 'limit', from: response)
266
+ end
267
+
259
268
  # @api public
260
269
  # @return [Array<Hash>]
261
270
  # @param [Fixnum] service_id Service ID
@@ -305,6 +314,15 @@ module ThreeScale
305
314
  true
306
315
  end
307
316
 
317
+ # @api public
318
+ # @param [Fixnum] service_id Service ID
319
+ # @param [Fixnum] application_plan_id Application Plan ID
320
+ # @return [Hash]
321
+ def application_plan_as_default(service_id, application_plan_id)
322
+ response = http_client.put("/admin/api/services/#{service_id}/application_plans/#{application_plan_id}/default")
323
+ extract(entity: 'application_plan', from: response)
324
+ end
325
+
308
326
  # @api public
309
327
  # @return [Array<Hash>]
310
328
  # @param [Fixnum] application_plan_id Application Plan ID
@@ -317,16 +335,26 @@ module ThreeScale
317
335
  # @api public
318
336
  # @return [Hash]
319
337
  # @param [Fixnum] application_plan_id Application Plan ID
320
- # @param [Hash] attributes Metric Attributes
321
338
  # @param [Fixnum] metric_id Metric ID
322
- # @option attributes [String] :period Usage Limit period
323
- # @option attributes [String] :value Usage Limit value
339
+ # @param [Hash] attributes Limit Attributes
324
340
  def create_application_plan_limit(application_plan_id, metric_id, attributes)
325
341
  response = http_client.post("/admin/api/application_plans/#{application_plan_id}/metrics/#{metric_id}/limits",
326
342
  body: { usage_limit: attributes })
327
343
  extract(entity: 'limit', from: response)
328
344
  end
329
345
 
346
+ # @api public
347
+ # @return [Hash]
348
+ # @param [Fixnum] application_plan_id Application Plan ID
349
+ # @param [Fixnum] metric_id Metric ID
350
+ # @param [Fixnum] limit_id Usage Limit ID
351
+ # @param [Hash] attributes Limit Attributes
352
+ def update_application_plan_limit(application_plan_id, metric_id, limit_id, attributes)
353
+ response = http_client.put("/admin/api/application_plans/#{application_plan_id}/metrics/#{metric_id}/limits/#{limit_id}",
354
+ body: { usage_limit: attributes })
355
+ extract(entity: 'limit', from: response)
356
+ end
357
+
330
358
  # @param [Fixnum] application_plan_id Application Plan ID
331
359
  # @param [Fixnum] metric_id Metric ID
332
360
  # @param [Fixnum] limit_id Usage Limit ID
@@ -1,5 +1,5 @@
1
1
  module ThreeScale
2
2
  module API
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.3.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.2.0
4
+ version: 0.3.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-04-16 00:00:00.000000000 Z
12
+ date: 2019-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler