diff --git a/Gemfile b/Gemfile index b99352a..ba1a05b 100644 --- a/Gemfile +++ b/Gemfile @@ -17,3 +17,4 @@ gem 'excon' gem 'net-http-persistent' gem 'faraday' gem 'patron' +gem 'httparty' diff --git a/Gemfile.lock b/Gemfile.lock index 2d4cfe5..dc30aef 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -64,6 +64,8 @@ GEM domain_name (~> 0.5) http-form_data (1.0.1) http_parser.rb (0.6.0) + httparty (0.16.2) + multi_xml (>= 0.5.2) i18n (0.7.0) kgio (2.10.0) loofah (2.0.3) @@ -76,6 +78,7 @@ GEM mime-types-data (3.2016.0521) mini_portile2 (2.1.0) minitest (5.9.0) + multi_xml (0.6.0) multipart-post (2.0.0) net-http-persistent (2.9.4) netrc (0.11.0) @@ -151,6 +154,7 @@ DEPENDENCIES excon faraday http + httparty net-http-persistent patron puma @@ -161,4 +165,4 @@ DEPENDENCIES unicorn BUNDLED WITH - 1.12.5 + 1.16.1 diff --git a/lib/http-clients.rb b/lib/http-clients.rb index 7042541..156610a 100644 --- a/lib/http-clients.rb +++ b/lib/http-clients.rb @@ -8,6 +8,7 @@ require 'http-clients/faraday_net_http_client' require 'http-clients/patron_client' require 'http-clients/benchmark' +require 'http-clients/httparty_client' module HTTPClients end diff --git a/lib/http-clients/benchmark.rb b/lib/http-clients/benchmark.rb index 819c8f1..7d74b1d 100644 --- a/lib/http-clients/benchmark.rb +++ b/lib/http-clients/benchmark.rb @@ -75,6 +75,7 @@ def clients ExconClient.new(endpoint, persistent, concurrent), FaradayNetHttpClient.new(endpoint, persistent, concurrent), PatronClient.new(endpoint, persistent, concurrent), + HTTPartyClient.new(endpoint, persistent, concurrent), ] if client diff --git a/lib/http-clients/httparty_client.rb b/lib/http-clients/httparty_client.rb new file mode 100644 index 0000000..e3b4e12 --- /dev/null +++ b/lib/http-clients/httparty_client.rb @@ -0,0 +1,18 @@ +require 'httparty' + +module HTTPClients + class HTTPartyClient < BaseClient + def name + "HTTParty" + end + + def run_once + HTTParty.get(endpoint, verify: false) + end + + def response_ok?(response) + response.code == 200 + end + + end +end