Skip to content

Commit 69608d8

Browse files
committed
Switching HTTP adapter
1 parent 4636c34 commit 69608d8

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 7.19.0.exp.0.1.0
2+
3+
* An experimental pre-release. This version switches the HTTP adapter from `Net::HTTP` to `Net::HTTP::Persistent` for all standard requests.
4+
15
# 7.19.0
26

37
* Adds Video API functionality. [#297](https://github.com/Vonage/vonage-ruby-sdk/pull/297)

lib/vonage/namespace.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# frozen_string_literal: true
33

44
require 'net/http'
5+
require 'net/http/persistent'
56
require 'net/http/post/multipart'
67
require 'json'
78

@@ -12,8 +13,7 @@ def initialize(config)
1213

1314
@host = set_host
1415

15-
@http = Net::HTTP.new(@host, Net::HTTP.https_default_port, p_addr = nil)
16-
@http.use_ssl = true
16+
@http = Net::HTTP::Persistent.new
1717

1818
@config.http.set(@http) unless @config.http.nil?
1919
end
@@ -94,7 +94,8 @@ def build_request(path:, type: Get, params: {})
9494
def make_request!(request, &block)
9595
logger.log_request_info(request)
9696

97-
response = @http.request(request, &block)
97+
uri = URI("https://" + @host + request.path)
98+
response = @http.request(uri, request, &block)
9899

99100
logger.log_response_info(response, @host)
100101

@@ -143,7 +144,7 @@ def multipart_post_request(path, filepath:, file_name:, mime_type:, params: {},
143144

144145
uri = override_uri ? URI(override_uri) : URI('https://' + @host + path)
145146

146-
http = override_uri ? Net::HTTP.new(uri.host, Net::HTTP.https_default_port, p_addr = nil) : @http
147+
http = Net::HTTP.new(uri.host, Net::HTTP.https_default_port, p_addr = nil)
147148
http.use_ssl = true
148149
http.set_debug_output($stdout)
149150

lib/vonage/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# typed: strong
22

33
module Vonage
4-
VERSION = '7.19.0'
4+
VERSION = '7.19.0.exp.0.1.0'
55
end

vonage.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
1616
s.add_dependency('zeitwerk', '~> 2', '>= 2.2')
1717
s.add_dependency('sorbet-runtime', '~> 0.5')
1818
s.add_dependency('multipart-post', '~> 2.0')
19+
s.add_dependency('net-http-persistent', '~> 4.0', '>= 4.0.2')
1920
s.add_runtime_dependency('rexml')
2021
s.add_runtime_dependency('phonelib')
2122
s.require_path = 'lib'

0 commit comments

Comments
 (0)