3scale-api 0.1.9 → 0.2.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: 67f1761515409caf851bf106a36040346d0b0d313cad3e8bace3b02d5a0ae6d0
4
- data.tar.gz: 9f149409d6a9358c3b91112e890da79d70771cc6e109d7d2b8146a69672ee474
3
+ metadata.gz: cb974c3590c1ba93b7476a6cc2481cd574a0d8f20109d6905e0040303ca6b10f
4
+ data.tar.gz: a5daa1c932a40111406cb662dc9fef1779c12fd05420014324bc1cef2c2afb75
5
5
  SHA512:
6
- metadata.gz: effe200f56049db818f217e1cf37345ec9162da1fe3c9a58a1a19eafed3cd43f0bd0942bcddf830eb96be6b7fcaea05dbc7a867d512de5842c0ed8e92c782fa0
7
- data.tar.gz: d36bbf4325aa45971cfa196fc673b8ef764d23795cd28fe6d6930012b29f4a3c434223b152aa0150ba0280081040f6cb98e0c574cbcfaa22e91cfa95530aa9f6
6
+ metadata.gz: 1708abcd906dad6fa52b5050fca0cfb1f59c963e43c27e9c617b4703193fa16df98a417b48915c1515f94f6f79290ffa7c776a713f32bb4774a3afb30f003a6b
7
+ data.tar.gz: d1ea6442ea56a67ec371054c9e70d4bf52d861fa7ac1d65aecab97f827d0d91d50d0130280c3f63ccf2833f214b789396ac364817d3728e4168edaaaffc9855c
@@ -135,6 +135,24 @@ module ThreeScale
135
135
  extract(entity: 'proxy', from: response)
136
136
  end
137
137
 
138
+ # @api public
139
+ # @return [Hash]
140
+ # @param [Fixnum] service_id Service ID
141
+ # @param [String] environment. Must be 'sandbox' or 'production'
142
+ def proxy_config_list(service_id, environment='sandbox')
143
+ response = http_client.get("/admin/api/services/#{service_id}/proxy/configs/#{environment}")
144
+ extract(entity: 'proxy', from: response)
145
+ end
146
+
147
+ # @api public
148
+ # @return [Hash]
149
+ # @param [Fixnum] service_id Service ID
150
+ # @param [String] environment. Must be 'sandbox' or 'production'
151
+ def proxy_config_latest(service_id, environment='sandbox')
152
+ response = http_client.get("/admin/api/services/#{service_id}/proxy/configs/#{environment}/latest")
153
+ extract(entity: 'proxy', from: response)
154
+ end
155
+
138
156
  # @api public
139
157
  # @return [Hash]
140
158
  # @param [Fixnum] service_id Service ID
@@ -258,6 +276,25 @@ module ThreeScale
258
276
  extract(entity: 'application_plan', from: response)
259
277
  end
260
278
 
279
+ # @api public
280
+ # @param [Fixnum] id Service ID
281
+ # @param [Fixnum] id Application Plan ID
282
+ # @return [Hash]
283
+ def show_application_plan(service_id, id)
284
+ response = http_client.get("/admin/api/services/#{service_id}/application_plans/#{id}")
285
+ extract(entity: 'application_plan', from: response)
286
+ end
287
+
288
+ # @api public
289
+ # @param [Fixnum] service_id Service ID
290
+ # @param [Fixnum] id Application Plan ID
291
+ # @param [Hash] attributes Application Plan Attributes
292
+ # @return [Hash]
293
+ def update_application_plan(service_id, id, attributes)
294
+ response = http_client.patch("/admin/api/services/#{service_id}/application_plans/#{id}",
295
+ body: { application_plan: attributes })
296
+ extract(entity: 'application_plan', from: response)
297
+ end
261
298
 
262
299
  # @api public
263
300
  # @return [Bool]
@@ -419,6 +456,80 @@ module ThreeScale
419
456
  extract(entity: 'oidc_configuration', from: response)
420
457
  end
421
458
 
459
+ # @api public
460
+ # @param [Fixnum] application_plan_id Application Plan ID
461
+ # @return [Array<Hash>]
462
+ def list_features_per_application_plan(application_plan_id)
463
+ response = http_client.get("/admin/api/application_plans/#{application_plan_id}/features")
464
+ extract(collection: 'features', entity: 'feature', from: response)
465
+ end
466
+
467
+ # @api public
468
+ # @param [Fixnum] application_plan_id Application Plan ID
469
+ # @param [Fixnum] id Feature ID
470
+ # @return [Hash]
471
+ def create_application_plan_feature(application_plan_id, id)
472
+ response = http_client.post("/admin/api/application_plans/#{application_plan_id}/features",
473
+ body: { feature_id: id })
474
+ extract(entity: 'feature', from: response)
475
+ end
476
+
477
+ # @api public
478
+ # @param [Fixnum] application_plan_id Application Plan ID
479
+ # @param [Fixnum] id Feature ID
480
+ # @return [Boolean]
481
+ def delete_application_plan_feature(application_plan_id, id)
482
+ http_client.delete("/admin/api/application_plans/#{application_plan_id}/features/#{id}")
483
+ true
484
+ end
485
+
486
+ # @api public
487
+ # @param [Fixnum] id Service ID
488
+ # @return [Array<Hash>]
489
+ def list_service_features(id)
490
+ response = http_client.get("/admin/api/services/#{id}/features")
491
+ extract(collection: 'features', entity: 'feature', from: response)
492
+ end
493
+
494
+ # @api public
495
+ # @param [Fixnum] id Service ID
496
+ # @param [Hash] attributes Feature Attributes
497
+ # @return [Hash]
498
+ def create_service_feature(id, attributes)
499
+ response = http_client.post("/admin/api/services/#{id}/features",
500
+ body: { feature: attributes})
501
+ extract(entity: 'feature', from: response)
502
+ end
503
+
504
+ # @api public
505
+ # @param [Fixnum] service_id Service ID
506
+ # @param [Fixnum] id Feature ID
507
+ # @return [Hash]
508
+ def show_service_feature(service_id, id)
509
+ response = http_client.get("/admin/api/services/#{service_id}/features/#{id}")
510
+ extract(entity: 'feature', from: response)
511
+ end
512
+
513
+ # @api public
514
+ # @param [Fixnum] service_id Service ID
515
+ # @param [Fixnum] id Feature ID
516
+ # @param [Hash] attributes Feature Attributes
517
+ # @return [Hash]
518
+ def update_service_feature(service_id, id, attributes)
519
+ response = http_client.put("/admin/api/services/#{service_id}/features/#{id}",
520
+ body: { feature: attributes })
521
+ extract(entity: 'feature', from: response)
522
+ end
523
+
524
+ # @api public
525
+ # @param [Fixnum] service_id Service ID
526
+ # @param [Fixnum] id Feature ID
527
+ # @return [Boolean]
528
+ def delete_service_feature(service_id, id)
529
+ http_client.delete("/admin/api/services/#{service_id}/features/#{id}")
530
+ true
531
+ end
532
+
422
533
  protected
423
534
 
424
535
  def extract(collection: nil, entity:, from:)
@@ -98,7 +98,7 @@ module ThreeScale
98
98
  protected
99
99
 
100
100
  def debug?
101
- ENV.fetch('3SCALE_DEBUG', '0') == '1'
101
+ ENV.fetch('THREESCALE_DEBUG', '0') == '1'
102
102
  end
103
103
 
104
104
  # Helper to create a string representing a path plus a query string
@@ -1,5 +1,5 @@
1
1
  module ThreeScale
2
2
  module API
3
- VERSION = '0.1.9'.freeze
3
+ VERSION = '0.2.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.1.9
4
+ version: 0.2.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-03-25 00:00:00.000000000 Z
12
+ date: 2019-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler