3scale-api 0.1.7 → 0.1.8

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: df4b5b877c13c4884de2339922563deff07ce9ee994ea601d9288634f4cb17a1
4
- data.tar.gz: e4a38f29ed58dbf4106caddf51bbe58e19e180a98b16c4fa34ee09ff39a330d4
3
+ metadata.gz: b1445e270241502bdce63974ebc160fc1c91ddc6a6f9b82a4704b15d079fbc3e
4
+ data.tar.gz: 9e59856615750458376342fd25a1279de1afb530c897a0902b41dd48ab1def12
5
5
  SHA512:
6
- metadata.gz: b8c0f57918d45bfd612d96a3bf18719f0bd5b1ae1db95ec1ea8b32a72cd36cfa897510368a0e2d63fa66e6386a2604c8f67ca9572dcc342fd632a19ce6302397
7
- data.tar.gz: f92047a44226e2ad72a603b77727dd1e4f9b86323d0ef7191ceb29deb735ee1cac1a46bd60414b9c8fc0a62218cfb4da6fbfd1f8d988e1fbd15d3fc8b2c2a5ff
6
+ metadata.gz: fb21bf527eaa118ef88b0ad182e8d48e1f45e97425a9a721bb18fd9c8aa4355d8baf9eace6aa1040d3e5c9213fe14028bdd0c00486c51605815de88cfa324366
7
+ data.tar.gz: f3dbbfcceaf1a2b52e59b8d411b9093f9c5954cdfa4883694164baac59f762d615d7b611e674465d750158c63919741639ff433301a2c9a006529824f73c3216
@@ -289,6 +289,86 @@ module ThreeScale
289
289
  true
290
290
  end
291
291
 
292
+ # @api public
293
+ # @param [Hash] account criteria
294
+ # @return [Hash]
295
+ def find_account(criteria)
296
+ response = http_client.get('/admin/api/accounts/find', params: criteria)
297
+ extract(entity: 'account', from: response)
298
+ end
299
+
300
+ # @api public
301
+ # @return [Array]
302
+ # @param [Fixnum] id Service ID
303
+ def show_policies(id)
304
+ response = http_client.get("/admin/api/services/#{id}/proxy/policies")
305
+ extract(entity: 'policies_config', from: response)
306
+ end
307
+
308
+ # @api public
309
+ # @return [Array]
310
+ # @param [Fixnum] id Service ID
311
+ def update_policies(id, policies_config)
312
+ response = http_client.put("/admin/api/services/#{id}/proxy/policies", body: policies_config)
313
+ extract(entity: 'policies_config', from: response)
314
+ end
315
+
316
+ # @api public
317
+ # @param [Fixnum] application_plan_id Application Plan ID
318
+ # @param [Fixnum] metric_id Metric ID
319
+ # @return [Array<Hash>]
320
+ def list_pricingrules_per_metric(application_plan_id, metric_id)
321
+ response = http_client.get("/admin/api/application_plans/#{application_plan_id}/metrics/#{metric_id}/pricing_rules")
322
+ extract(collection: 'pricing_rules', entity: 'pricing_rule', from: response)
323
+ end
324
+
325
+ # @api public
326
+ # @param [Fixnum] application_plan_id Application Plan ID
327
+ # @return [Array<Hash>]
328
+ def list_pricingrules_per_application_plan(application_plan_id)
329
+ response = http_client.get("/admin/api/application_plans/#{application_plan_id}/pricing_rules")
330
+ extract(collection: 'pricing_rules', entity: 'pricing_rule', from: response)
331
+ end
332
+
333
+ # @api public
334
+ # @param [Fixnum] application_plan_id Application Plan ID
335
+ # @return [Array<Hash>]
336
+ def create_pricingrule(application_plan_id, metric_id, attributes)
337
+ response = http_client.post("/admin/api/application_plans/#{application_plan_id}/metrics/#{metric_id}/pricing_rules", body: attributes)
338
+ extract(entity: 'pricing_rule', from: response)
339
+ end
340
+
341
+ # @api public
342
+ # @return [Array<Hash>]
343
+ def list_activedocs
344
+ response = http_client.get('/admin/api/active_docs')
345
+ extract(collection: 'api_docs', entity: 'api_doc', from: response)
346
+ end
347
+
348
+ # @api public
349
+ # @param [Hash] attributes ActiveDocs attributes
350
+ # @return [Hash]
351
+ def create_activedocs(attributes)
352
+ response = http_client.post('/admin/api/active_docs', body: attributes)
353
+ extract(entity: 'api_doc', from: response)
354
+ end
355
+
356
+ # @api public
357
+ # @param [Fixnum] id ActiveDocs ID
358
+ # @param [Hash] attributes ActiveDocs attributes
359
+ # @return [Hash]
360
+ def update_activedocs(id, attributes)
361
+ response = http_client.put("/admin/api/active_docs/#{id}", body: attributes)
362
+ extract(entity: 'api_doc', from: response)
363
+ end
364
+
365
+ # @api public
366
+ # @return [Hash]
367
+ def delete_activedocs(id)
368
+ http_client.delete("/admin/api/active_docs/#{id}")
369
+ true
370
+ end
371
+
292
372
  protected
293
373
 
294
374
  def extract(collection: nil, entity:, from:)
@@ -1,5 +1,5 @@
1
1
  module ThreeScale
2
2
  module API
3
- VERSION = '0.1.7'.freeze
3
+ VERSION = '0.1.8'.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.7
4
+ version: 0.1.8
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: 2018-12-05 00:00:00.000000000 Z
12
+ date: 2019-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -45,28 +45,28 @@ dependencies:
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '3.4'
48
+ version: '3.8'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '3.4'
55
+ version: '3.8'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: webmock
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '1.24'
62
+ version: '3.4'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '1.24'
69
+ version: '3.4'
70
70
  description: 'API Client to access your 3scale APIs: Account Management API'
71
71
  email:
72
72
  - michal@3scale.net