3scale-api 1.2.0 → 1.6.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 +24 -4
- data/lib/3scale/api/http_client.rb +14 -2
- data/lib/3scale/api/version.rb +1 -1
- data/lib/3scale/api.rb +4 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68347e4023104f3763ef350b355b94ce353c9678b77ef413643931e1365446ff
|
4
|
+
data.tar.gz: ebea3f4f26bf2b91f6e7479ad7d33dc2e69f49492d12604c32855dd1171c1dcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 723f245e2a3a15c1db5784be651fe49a3db0292aaec9207fc9a989ba542d58aa5baf904859525dbc24d6fac9143b097fa192168d27a0335f5f950c1a92cddfa3
|
7
|
+
data.tar.gz: 7daad7df1b7f00bb55f72c87c97a985a2041ffc3a8edcbc77a0cc244ba94fbf5bf25e21aa6f840e365a7821eb5bdf27af1b941069ac54672dc47a040522da4dc
|
data/lib/3scale/api/client.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
module ThreeScale
|
2
2
|
module API
|
3
|
+
MAX_BACKENDS_PER_PAGE = 500
|
4
|
+
MAX_SERVICES_PER_PAGE = 500
|
5
|
+
|
3
6
|
class Client
|
4
7
|
attr_reader :http_client
|
5
8
|
|
@@ -19,8 +22,8 @@ module ThreeScale
|
|
19
22
|
|
20
23
|
# @api public
|
21
24
|
# @return [Array<Hash>]
|
22
|
-
def list_services
|
23
|
-
response = http_client.get('/admin/api/services')
|
25
|
+
def list_services(params = nil)
|
26
|
+
response = http_client.get('/admin/api/services', params: params)
|
24
27
|
extract(collection: 'services', entity: 'service', from: response)
|
25
28
|
end
|
26
29
|
|
@@ -41,6 +44,14 @@ module ThreeScale
|
|
41
44
|
extract(collection: 'applications', entity: 'application', from: response)
|
42
45
|
end
|
43
46
|
|
47
|
+
# @api public
|
48
|
+
# @param [Fixnum] account_id Account ID
|
49
|
+
# @return [Array<Hash>]
|
50
|
+
def list_applications_by_account(account_id)
|
51
|
+
response = http_client.get("/admin/api/accounts/#{account_id}/applications")
|
52
|
+
extract(collection: 'applications', entity: 'application', from: response)
|
53
|
+
end
|
54
|
+
|
44
55
|
# @api public
|
45
56
|
# @return [Hash]
|
46
57
|
# @param [Fixnum] id Application ID
|
@@ -200,6 +211,15 @@ module ThreeScale
|
|
200
211
|
extract(entity: 'proxy', from: response)
|
201
212
|
end
|
202
213
|
|
214
|
+
# @api public
|
215
|
+
# @return [Hash]
|
216
|
+
# @param [Fixnum] service_id Service ID
|
217
|
+
def proxy_deploy(service_id)
|
218
|
+
response = http_client.post("/admin/api/services/#{service_id}/proxy/deploy",
|
219
|
+
body: nil)
|
220
|
+
extract(entity: 'proxy', from: response)
|
221
|
+
end
|
222
|
+
|
203
223
|
# @api public
|
204
224
|
# @return [Array<Hash>]
|
205
225
|
# @param [Fixnum] service_id Service ID
|
@@ -828,8 +848,8 @@ module ThreeScale
|
|
828
848
|
|
829
849
|
# @api public
|
830
850
|
# @return [List]
|
831
|
-
def list_backends
|
832
|
-
response = http_client.get('/admin/api/backend_apis')
|
851
|
+
def list_backends(params = nil)
|
852
|
+
response = http_client.get('/admin/api/backend_apis', params: params)
|
833
853
|
extract(collection: 'backend_apis', entity: 'backend_api', from: response)
|
834
854
|
end
|
835
855
|
|
@@ -6,9 +6,9 @@ require 'openssl'
|
|
6
6
|
module ThreeScale
|
7
7
|
module API
|
8
8
|
class HttpClient
|
9
|
-
attr_reader :endpoint, :admin_domain, :provider_key, :headers, :format
|
9
|
+
attr_reader :endpoint, :admin_domain, :provider_key, :headers, :format, :keep_alive
|
10
10
|
|
11
|
-
def initialize(endpoint:, provider_key:, format: :json, verify_ssl: true)
|
11
|
+
def initialize(endpoint:, provider_key:, format: :json, verify_ssl: true, keep_alive: false)
|
12
12
|
@endpoint = URI(endpoint).freeze
|
13
13
|
@admin_domain = @endpoint.host.freeze
|
14
14
|
@provider_key = provider_key.freeze
|
@@ -30,25 +30,37 @@ module ThreeScale
|
|
30
30
|
@headers.freeze
|
31
31
|
|
32
32
|
@format = format
|
33
|
+
|
34
|
+
@keep_alive = keep_alive
|
33
35
|
end
|
34
36
|
|
35
37
|
def get(path, params: nil)
|
38
|
+
@http.start if keep_alive && !@http.started?
|
39
|
+
|
36
40
|
parse @http.get(format_path_n_query(path, params), headers)
|
37
41
|
end
|
38
42
|
|
39
43
|
def patch(path, body:, params: nil)
|
44
|
+
@http.start if keep_alive && !@http.started?
|
45
|
+
|
40
46
|
parse @http.patch(format_path_n_query(path, params), serialize(body), headers)
|
41
47
|
end
|
42
48
|
|
43
49
|
def post(path, body:, params: nil)
|
50
|
+
@http.start if keep_alive && !@http.started?
|
51
|
+
|
44
52
|
parse @http.post(format_path_n_query(path, params), serialize(body), headers)
|
45
53
|
end
|
46
54
|
|
47
55
|
def put(path, body: nil, params: nil)
|
56
|
+
@http.start if keep_alive && !@http.started?
|
57
|
+
|
48
58
|
parse @http.put(format_path_n_query(path, params), serialize(body), headers)
|
49
59
|
end
|
50
60
|
|
51
61
|
def delete(path, params: nil)
|
62
|
+
@http.start if keep_alive && !@http.started?
|
63
|
+
|
52
64
|
parse @http.delete(format_path_n_query(path, params), headers)
|
53
65
|
end
|
54
66
|
|
data/lib/3scale/api/version.rb
CHANGED
data/lib/3scale/api.rb
CHANGED
@@ -6,10 +6,12 @@ module ThreeScale
|
|
6
6
|
autoload :Client, '3scale/api/client'
|
7
7
|
autoload :HttpClient, '3scale/api/http_client'
|
8
8
|
|
9
|
-
def self.new(endpoint:, provider_key:, verify_ssl: true)
|
9
|
+
def self.new(endpoint:, provider_key:, verify_ssl: true, keep_alive: false)
|
10
10
|
http_client = HttpClient.new(endpoint: endpoint,
|
11
11
|
provider_key: provider_key,
|
12
|
-
verify_ssl: verify_ssl
|
12
|
+
verify_ssl: verify_ssl,
|
13
|
+
keep_alive: keep_alive,
|
14
|
+
)
|
13
15
|
Client.new(http_client)
|
14
16
|
end
|
15
17
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: 3scale-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Miguel Soriano
|
8
8
|
- Eguzki Astiz Lezaun
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-11-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -69,7 +69,7 @@ dependencies:
|
|
69
69
|
version: '3.4'
|
70
70
|
description: 'API Client to access your 3scale APIs: Account Management API'
|
71
71
|
email:
|
72
|
-
-
|
72
|
+
- msoriano@redhat.com
|
73
73
|
- eastizle@redhat.com
|
74
74
|
executables: []
|
75
75
|
extensions: []
|
@@ -94,14 +94,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
94
|
requirements:
|
95
95
|
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '
|
97
|
+
version: '2.6'
|
98
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
requirements: []
|
104
|
-
rubygems_version: 3.
|
104
|
+
rubygems_version: 3.0.3
|
105
105
|
signing_key:
|
106
106
|
specification_version: 4
|
107
107
|
summary: API Client for 3scale APIs
|