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 +4 -4
- data/lib/3scale/api/client.rb +111 -0
- data/lib/3scale/api/http_client.rb +1 -1
- data/lib/3scale/api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb974c3590c1ba93b7476a6cc2481cd574a0d8f20109d6905e0040303ca6b10f
|
4
|
+
data.tar.gz: a5daa1c932a40111406cb662dc9fef1779c12fd05420014324bc1cef2c2afb75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1708abcd906dad6fa52b5050fca0cfb1f59c963e43c27e9c617b4703193fa16df98a417b48915c1515f94f6f79290ffa7c776a713f32bb4774a3afb30f003a6b
|
7
|
+
data.tar.gz: d1ea6442ea56a67ec371054c9e70d4bf52d861fa7ac1d65aecab97f827d0d91d50d0130280c3f63ccf2833f214b789396ac364817d3728e4168edaaaffc9855c
|
data/lib/3scale/api/client.rb
CHANGED
@@ -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:)
|
data/lib/3scale/api/version.rb
CHANGED
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.
|
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-
|
12
|
+
date: 2019-04-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|