3scale-api 1.5.0 → 1.6.0

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: 889c02fde022e3dfac63c698c05a631904181e7c5bb8b65f7a73378ede62bcd7
4
- data.tar.gz: 10756f304d8b25f242416c2cdd3d6ae5141ef73c94103aab6cc9e7674cfcd450
3
+ metadata.gz: 68347e4023104f3763ef350b355b94ce353c9678b77ef413643931e1365446ff
4
+ data.tar.gz: ebea3f4f26bf2b91f6e7479ad7d33dc2e69f49492d12604c32855dd1171c1dcc
5
5
  SHA512:
6
- metadata.gz: c029b7cafa5e81c612c2240f30c428d9be066ae9ad3d5b30f4efd1873b98c7600d5a446af4d1069978f32297ba96ffd34ba46d03afdfe34e6b79bfd40a3b66ea
7
- data.tar.gz: 964b8e3168761498f2789b2f0466d2d52c68273972495e1dffa977c98f7257ac643af7a0600a7b5aab85ba37440cb1e3e337bdfc654bfd4f6b6cb20ce9ac7088
6
+ metadata.gz: 723f245e2a3a15c1db5784be651fe49a3db0292aaec9207fc9a989ba542d58aa5baf904859525dbc24d6fac9143b097fa192168d27a0335f5f950c1a92cddfa3
7
+ data.tar.gz: 7daad7df1b7f00bb55f72c87c97a985a2041ffc3a8edcbc77a0cc244ba94fbf5bf25e21aa6f840e365a7821eb5bdf27af1b941069ac54672dc47a040522da4dc
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  module ThreeScale
2
2
  module API
3
- VERSION = '1.5.0'.freeze
3
+ VERSION = '1.6.0'.freeze
4
4
  end
5
5
  end
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 3scale-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Soriano
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-11-18 00:00:00.000000000 Z
12
+ date: 2021-11-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler