removing httpclient due to deprecation warning

This commit is contained in:
spodlecki 2015-12-30 16:40:05 -06:00
parent aae429286d
commit b38845ac6f
3 changed files with 14 additions and 10 deletions

View File

@ -18,8 +18,6 @@ Gem::Specification.new do |s|
s.require_path = 'lib'
s.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if s.respond_to? :required_rubygems_version=
s.add_dependency 'httpclient', '~> 2.2'
s.add_dependency 'nokogiri', '~> 1.6'
s.add_development_dependency 'bundler', '~> 1.0'
end

View File

@ -1,11 +1,13 @@
require 'httpclient'
require 'timeout'
require 'net/http'
require 'nokogiri'
module Impressionist
module Bots
LIST_URL = "http://www.user-agents.org/allagents.xml"
def self.consume
response = HTTPClient.new.get_content(LIST_URL)
Timeout.timeout(4) do
response = Net::HTTP.get(URI.parse(LIST_URL))
doc = Nokogiri::XML(response)
list = []
doc.xpath('//user-agent').each do |agent|
@ -16,3 +18,4 @@ module Impressionist
end
end
end
end

View File

@ -36,6 +36,9 @@ group :development, :test do
gem 'autotest-notification'
gem 'rspec-rails', '~> 2.14.0'
gem 'spork'
# test/unit has been removed by default in Ruby 2.2.x+
gem 'test-unit'
end
group :test do