3scale-api 0.1.2 → 0.1.3
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 +9 -0
- data/lib/3scale/api/http_client.rb +15 -8
- data/lib/3scale/api/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9076fbdc6914551fa33773e4216b3669c080a13
|
4
|
+
data.tar.gz: 9f3dabd8c12a5fcc88c2c75f22e8d5f157617896
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 328dc5a4c07737a1eb5d573600abcf72143d9fa382048dc7dd69ad5eae850a862b3dd766e4d9ee42c3cd25a467979468b3de9c74a9036d6e6c82debada05d142
|
7
|
+
data.tar.gz: 0c4ea2c0a39b1e4c98c7c9d0434694b5f29ebc3c631c47e7cf57ad47f7086948c9422baf59c5221da004faa600b1e23dc7366541b30ea651e8bda1ecfe1fd22a
|
data/lib/3scale/api/client.rb
CHANGED
@@ -25,6 +25,15 @@ module ThreeScale
|
|
25
25
|
extract(collection: 'services', entity: 'service', from: response)
|
26
26
|
end
|
27
27
|
|
28
|
+
# @api public
|
29
|
+
# @return [Array<Hash>]
|
30
|
+
# @param [Fixnum] service_id Service ID
|
31
|
+
def list_applications(service_id: nil)
|
32
|
+
params = service_id ? { service_id: service_id } : nil
|
33
|
+
response = http_client.get("/admin/api/applications", params: params)
|
34
|
+
extract(collection: 'applications', entity: 'application', from: response)
|
35
|
+
end
|
36
|
+
|
28
37
|
# @api public
|
29
38
|
# @return [Hash]
|
30
39
|
# @param [Hash] attributes Service Attributes
|
@@ -30,20 +30,20 @@ module ThreeScale
|
|
30
30
|
@format = format
|
31
31
|
end
|
32
32
|
|
33
|
-
def get(path)
|
34
|
-
parse @http.get(
|
33
|
+
def get(path, params: nil)
|
34
|
+
parse @http.get(format_path_n_query(path, params), headers)
|
35
35
|
end
|
36
36
|
|
37
|
-
def patch(path, body: )
|
38
|
-
parse @http.patch(
|
37
|
+
def patch(path, body: , params: nil)
|
38
|
+
parse @http.patch(format_path_n_query(path, params), serialize(body), headers)
|
39
39
|
end
|
40
40
|
|
41
|
-
def post(path, body: )
|
42
|
-
parse @http.post(
|
41
|
+
def post(path, body: , params: nil)
|
42
|
+
parse @http.post(format_path_n_query(path, params), serialize(body), headers)
|
43
43
|
end
|
44
44
|
|
45
|
-
def delete(path)
|
46
|
-
parse @http.delete(
|
45
|
+
def delete(path, params: nil)
|
46
|
+
parse @http.delete(format_path_n_query(path, params), headers)
|
47
47
|
end
|
48
48
|
|
49
49
|
# @param [::Net::HTTPResponse] response
|
@@ -81,6 +81,13 @@ module ThreeScale
|
|
81
81
|
ENV.fetch('3SCALE_DEBUG', '0') == '1'
|
82
82
|
end
|
83
83
|
|
84
|
+
# Helper to create a string representing a path plus a query string
|
85
|
+
def format_path_n_query(path, params)
|
86
|
+
path = "#{path}.#{format}"
|
87
|
+
path << "?#{URI.encode_www_form(params)}" unless params.nil?
|
88
|
+
path
|
89
|
+
end
|
90
|
+
|
84
91
|
module JSONParser
|
85
92
|
module_function
|
86
93
|
|
data/lib/3scale/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Cichra
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.
|
101
|
+
rubygems_version: 2.6.4
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: API Client for 3scale APIs
|