3scale-api 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +0 -5
- data/lib/3scale/api/client.rb +51 -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: 67f1761515409caf851bf106a36040346d0b0d313cad3e8bace3b02d5a0ae6d0
|
4
|
+
data.tar.gz: 9f149409d6a9358c3b91112e890da79d70771cc6e109d7d2b8146a69672ee474
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: effe200f56049db818f217e1cf37345ec9162da1fe3c9a58a1a19eafed3cd43f0bd0942bcddf830eb96be6b7fcaea05dbc7a867d512de5842c0ed8e92c782fa0
|
7
|
+
data.tar.gz: d36bbf4325aa45971cfa196fc673b8ef764d23795cd28fe6d6930012b29f4a3c434223b152aa0150ba0280081040f6cb98e0c574cbcfaa22e91cfa95530aa9f6
|
data/README.md
CHANGED
@@ -55,15 +55,10 @@ For running the integration tests you will need to have a real 3scale account, y
|
|
55
55
|
```
|
56
56
|
ENDPOINT=https://your-domain-admin.3scale.net
|
57
57
|
PROVIDER_KEY=abc123
|
58
|
-
SERVICE_ID=12345
|
59
|
-
METRIC_ID=12345 # should be a numeric value, not the system name
|
60
|
-
APPLICATION_PLAN_ID=12345
|
61
58
|
VERIFY_SSL=true (by default true)
|
62
59
|
```
|
63
60
|
|
64
61
|
**Note:** for the tests to pass the following requirements need to be met:
|
65
|
-
- authorization mode of the service should be *API key*
|
66
|
-
- there should be at least 1 method for the 'hits' metric
|
67
62
|
- the field `billing_address` should be added to the Account model in **Settings > Fields Definitions**
|
68
63
|
|
69
64
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
data/lib/3scale/api/client.rb
CHANGED
@@ -51,7 +51,7 @@ module ThreeScale
|
|
51
51
|
# @return [Hash]
|
52
52
|
# @param [Fixnum] id Application ID
|
53
53
|
# @param [String] user_key Application User Key
|
54
|
-
# @param [String] application_id Application
|
54
|
+
# @param [String] application_id Application app_id
|
55
55
|
def find_application(id: nil, user_key: nil, application_id: nil)
|
56
56
|
params = { application_id: id, user_key: user_key, app_id: application_id }.reject { |_, value| value.nil? }
|
57
57
|
response = http_client.get('/admin/api/applications/find', params: params)
|
@@ -82,6 +82,15 @@ module ThreeScale
|
|
82
82
|
extract(entity: 'application_plan', from: response)
|
83
83
|
end
|
84
84
|
|
85
|
+
# @api public
|
86
|
+
# @return [Hash] a Plan
|
87
|
+
# @param [Fixnum] account_id Account ID
|
88
|
+
# @param [Fixnum] application_id Application ID
|
89
|
+
def delete_application_plan_customization(account_id, application_id)
|
90
|
+
response = http_client.put("/admin/api/accounts/#{account_id}/applications/#{application_id}/decustomize_plan")
|
91
|
+
extract(entity: 'application_plan', from: response)
|
92
|
+
end
|
93
|
+
|
85
94
|
# @api public
|
86
95
|
# @return [Hash] an Account
|
87
96
|
# @param [String] name Account Name
|
@@ -369,6 +378,47 @@ module ThreeScale
|
|
369
378
|
true
|
370
379
|
end
|
371
380
|
|
381
|
+
# @api public
|
382
|
+
# @return [Array<Hash>]
|
383
|
+
def list_accounts
|
384
|
+
response = http_client.get('/admin/api/accounts')
|
385
|
+
extract(collection: 'accounts', entity: 'account', from: response)
|
386
|
+
end
|
387
|
+
|
388
|
+
# @api public
|
389
|
+
# @param [Fixnum] account_id Account ID
|
390
|
+
# @return [Bool]
|
391
|
+
def delete_account(id)
|
392
|
+
http_client.delete("/admin/api/accounts/#{id}")
|
393
|
+
true
|
394
|
+
end
|
395
|
+
|
396
|
+
# @api public
|
397
|
+
# @param [Fixnum] account_id Account ID
|
398
|
+
# @param [Fixnum] application_id Application ID
|
399
|
+
# @return [Bool]
|
400
|
+
def delete_application(account_id, id)
|
401
|
+
http_client.delete("/admin/api/accounts/#{account_id}/applications/#{id}")
|
402
|
+
true
|
403
|
+
end
|
404
|
+
|
405
|
+
# @api public
|
406
|
+
# @param [Fixnum] id Service ID
|
407
|
+
# @return [Array<Hash>]
|
408
|
+
def show_oidc(service_id)
|
409
|
+
response = http_client.get("/admin/api/services/#{service_id}/proxy/oidc_configuration")
|
410
|
+
extract(entity: 'oidc_configuration', from: response)
|
411
|
+
end
|
412
|
+
|
413
|
+
# @api public
|
414
|
+
# @param [Fixnum] id Service ID
|
415
|
+
# @return [Hash]
|
416
|
+
def update_oidc(service_id, attributes)
|
417
|
+
response = http_client.patch("/admin/api/services/#{service_id}/proxy/oidc_configuration",
|
418
|
+
body: { oidc_configuration: attributes })
|
419
|
+
extract(entity: 'oidc_configuration', from: response)
|
420
|
+
end
|
421
|
+
|
372
422
|
protected
|
373
423
|
|
374
424
|
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.1.
|
4
|
+
version: 0.1.9
|
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-
|
12
|
+
date: 2019-03-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|