3scale-api 0.1.6 → 0.1.7

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: e3ae48b0911ac65f9a45bd02e2a378e234b2235dd9ebfd92f44cb97f6f62225f
4
- data.tar.gz: 0fac2326c5a08a52ae7a25aabd510a4d2da1a5a4ed4f2431f88f561a2e6e7eff
3
+ metadata.gz: df4b5b877c13c4884de2339922563deff07ce9ee994ea601d9288634f4cb17a1
4
+ data.tar.gz: e4a38f29ed58dbf4106caddf51bbe58e19e180a98b16c4fa34ee09ff39a330d4
5
5
  SHA512:
6
- metadata.gz: b424f617c927c6ec4e5e41d45cbbd15274bc460744b13d632a1a26163691669368148147838a50b4bc9e5c8f12ebaaa151779ba037cad688d6ce359bfc5c2ecc
7
- data.tar.gz: 1ba5fb1af0f06f9a8b83f02fc31dba8ee6abc829d34556520db4ed29a374e461d53106923c57074f2db3a93e0ceda2c022c1148eb1cce4cab2e93086420a7b0f
6
+ metadata.gz: b8c0f57918d45bfd612d96a3bf18719f0bd5b1ae1db95ec1ea8b32a72cd36cfa897510368a0e2d63fa66e6386a2604c8f67ca9572dcc342fd632a19ce6302397
7
+ data.tar.gz: f92047a44226e2ad72a603b77727dd1e4f9b86323d0ef7191ceb29deb735ee1cac1a46bd60414b9c8fc0a62218cfb4da6fbfd1f8d988e1fbd15d3fc8b2c2a5ff
@@ -24,6 +24,13 @@ module ThreeScale
24
24
  extract(collection: 'services', entity: 'service', from: response)
25
25
  end
26
26
 
27
+ # @api public
28
+ # @param [Fixnum] id Service ID
29
+ def delete_service(id)
30
+ http_client.delete("/admin/api/services/#{id}")
31
+ true
32
+ end
33
+
27
34
  # @api public
28
35
  # @return [Array<Hash>]
29
36
  # @param [Fixnum] service_id Service ID
@@ -242,6 +249,16 @@ module ThreeScale
242
249
  extract(entity: 'application_plan', from: response)
243
250
  end
244
251
 
252
+
253
+ # @api public
254
+ # @return [Bool]
255
+ # @param [Fixnum] service_id Service ID
256
+ # @param [Fixnum] application_plan_id Application Plan ID
257
+ def delete_application_plan(service_id,application_plan_id)
258
+ http_client.delete("/admin/api/services/#{service_id}/application_plans/#{application_plan_id}")
259
+ true
260
+ end
261
+
245
262
  # @api public
246
263
  # @return [Array<Hash>]
247
264
  # @param [Fixnum] application_plan_id Application Plan ID
@@ -57,16 +57,29 @@ module ThreeScale
57
57
  case response
58
58
  when Net::HTTPUnprocessableEntity, Net::HTTPSuccess then parser.decode(response.body)
59
59
  when Net::HTTPForbidden then forbidden!(response)
60
- else "Can't handle #{response.inspect}"
60
+ when Net::HTTPNotFound then notfound!(response)
61
+ else unexpected!(response.inspect)
61
62
  end
62
63
  end
63
64
 
64
65
  class ForbiddenError < StandardError; end
65
66
 
67
+ class UnexpectedResponseError < StandardError; end
68
+
69
+ class NotFoundError < StandardError; end
70
+
66
71
  def forbidden!(response)
67
72
  raise ForbiddenError, response
68
73
  end
69
74
 
75
+ def notfound!(response)
76
+ raise NotFoundError, response
77
+ end
78
+
79
+ def unexpected!(response)
80
+ raise UnexpectedResponseError, response
81
+ end
82
+
70
83
  def serialize(body)
71
84
  case body
72
85
  when nil then nil
@@ -1,5 +1,5 @@
1
1
  module ThreeScale
2
2
  module API
3
- VERSION = '0.1.6'.freeze
3
+ VERSION = '0.1.7'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,29 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 3scale-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Cichra
8
+ - Eguzki Astiz Lezaun
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2018-10-19 00:00:00.000000000 Z
12
+ date: 2018-12-05 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - "~>"
18
+ - - ">="
18
19
  - !ruby/object:Gem::Version
19
- version: '1.11'
20
+ version: '0'
20
21
  type: :development
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
- - - "~>"
25
+ - - ">="
25
26
  - !ruby/object:Gem::Version
26
- version: '1.11'
27
+ version: '0'
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: rake
29
30
  requirement: !ruby/object:Gem::Requirement
@@ -69,6 +70,7 @@ dependencies:
69
70
  description: 'API Client to access your 3scale APIs: Account Management API'
70
71
  email:
71
72
  - michal@3scale.net
73
+ - eastizle@redhat.com
72
74
  executables: []
73
75
  extensions: []
74
76
  extra_rdoc_files: []
@@ -79,7 +81,7 @@ files:
79
81
  - lib/3scale/api/http_client.rb
80
82
  - lib/3scale/api/version.rb
81
83
  - lib/three_scale/api.rb
82
- homepage: https://github.com/3scale/3scale-api-ruby.
84
+ homepage: https://github.com/3scale/3scale-api-ruby
83
85
  licenses:
84
86
  - MIT
85
87
  metadata: {}