From 2e908524b9ad2abb4db629d72226462c893b58e2 Mon Sep 17 00:00:00 2001 From: Hector Carrillo Date: Mon, 8 Aug 2022 10:53:19 -0400 Subject: [PATCH 1/3] test httparty --- khipu-api-client.gemspec | 3 ++- lib/khipu-api-client/api_client.rb | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/khipu-api-client.gemspec b/khipu-api-client.gemspec index 10fc263..8d2d1e6 100644 --- a/khipu-api-client.gemspec +++ b/khipu-api-client.gemspec @@ -13,8 +13,9 @@ Gem::Specification.new do |s| s.description = %q{This gem maps to a swagger API} s.license = "Apache-2.0" - s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' + s.add_runtime_dependency 'httparty', '0.20.0' s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0' + s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0' s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1' diff --git a/lib/khipu-api-client/api_client.rb b/lib/khipu-api-client/api_client.rb index 2939e17..9bab0e1 100644 --- a/lib/khipu-api-client/api_client.rb +++ b/lib/khipu-api-client/api_client.rb @@ -2,11 +2,11 @@ require 'json' require 'logger' require 'tempfile' -require 'typhoeus' require 'uri' require 'net/http' require 'openssl' require 'base64' +require 'httparty' module Khipu class ApiClient @@ -64,9 +64,7 @@ def build_request(http_method, path, opts = {}) query_params = opts[:query_params] || {} form_params = opts[:form_params] || {} - update_params_for_auth! @host, path, http_method, header_params, query_params, form_params, opts[:auth_names], opts[:body] - req_opts = { :method => http_method, @@ -87,7 +85,7 @@ def build_request(http_method, path, opts = {}) end end - Typhoeus::Request.new(url, req_opts) + HTTParty.send(req_opts[:method], url, { headers: req_opts[:headers], body: req_opts[:body] }) end # Deserialize the response to the given return type. From 349827ec156007081504f8639584879107853055 Mon Sep 17 00:00:00 2001 From: Hector Carrillo Date: Mon, 8 Aug 2022 11:02:53 -0400 Subject: [PATCH 2/3] remove run method --- lib/khipu-api-client/api_client.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/khipu-api-client/api_client.rb b/lib/khipu-api-client/api_client.rb index 9bab0e1..0955e46 100644 --- a/lib/khipu-api-client/api_client.rb +++ b/lib/khipu-api-client/api_client.rb @@ -32,8 +32,7 @@ def initialize(host = nil) end def call_api(http_method, path, opts = {}) - request = build_request(http_method, path, opts) - response = request.run + response = build_request(http_method, path, opts) # record as last response @last_response = response From b327651f672020c6997b0f10181a4bf0ef3a0a58 Mon Sep 17 00:00:00 2001 From: Hector Carrillo Date: Mon, 8 Aug 2022 13:05:22 -0400 Subject: [PATCH 3/3] remove not needed dependency --- khipu-api-client.gemspec | 1 - lib/khipu-api-client/configuration.rb | 2 -- 2 files changed, 3 deletions(-) diff --git a/khipu-api-client.gemspec b/khipu-api-client.gemspec index 8d2d1e6..581eecd 100644 --- a/khipu-api-client.gemspec +++ b/khipu-api-client.gemspec @@ -15,7 +15,6 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'httparty', '0.20.0' s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0' - s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0' s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1' diff --git a/lib/khipu-api-client/configuration.rb b/lib/khipu-api-client/configuration.rb index 524e72a..51bec03 100644 --- a/lib/khipu-api-client/configuration.rb +++ b/lib/khipu-api-client/configuration.rb @@ -77,8 +77,6 @@ class Configuration # # @return [String] the path to the certificate file # - # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: - # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 attr_accessor :ssl_ca_cert # Client certificate file (for client certificate)