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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77a476fabcd236f26e54791a002e225f68f71f01
4
- data.tar.gz: f294b48f5dc30f7552bb2c5c8528894b83af0461
3
+ metadata.gz: d9076fbdc6914551fa33773e4216b3669c080a13
4
+ data.tar.gz: 9f3dabd8c12a5fcc88c2c75f22e8d5f157617896
5
5
  SHA512:
6
- metadata.gz: 8d1da34bab1586e5b83c719877cb6c509ae6c6b9d34af8b5a4e4537809ff2f7f53cbad219b68e8523e7208d08eec12b84e3631d1264d45958e74ca8579f7e52f
7
- data.tar.gz: 85d66c30ac936ce983c14eb9e53e13333b31cba3074794359c9d174c80869991b0faa5afecd2d9c1d4659c418f270cdb4c2fad1f14a2a9aa6d6a359f28e725cd
6
+ metadata.gz: 328dc5a4c07737a1eb5d573600abcf72143d9fa382048dc7dd69ad5eae850a862b3dd766e4d9ee42c3cd25a467979468b3de9c74a9036d6e6c82debada05d142
7
+ data.tar.gz: 0c4ea2c0a39b1e4c98c7c9d0434694b5f29ebc3c631c47e7cf57ad47f7086948c9422baf59c5221da004faa600b1e23dc7366541b30ea651e8bda1ecfe1fd22a
@@ -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("#{path}.#{format}", headers)
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("#{path}.#{format}", serialize(body), headers)
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("#{path}.#{format}", serialize(body), headers)
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("#{path}.#{format}", headers)
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
 
@@ -1,5 +1,5 @@
1
1
  module ThreeScale
2
2
  module API
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
  end
5
5
  end
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.2
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-03-16 00:00:00.000000000 Z
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.5.1
101
+ rubygems_version: 2.6.4
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: API Client for 3scale APIs