lib/acfs/adapter/typhoeus.rb in acfs-0.42.0 vs lib/acfs/adapter/typhoeus.rb in acfs-0.43.0
- old
+ new
@@ -1,34 +1,31 @@
require 'typhoeus'
module Acfs
module Adapter
-
# Adapter for Typhoeus.
#
class Typhoeus < Base
-
def start
hydra.run
rescue
@hydra = nil
raise
end
- def abort
- hydra.abort
- end
+ delegate :abort, to: :hydra
def run(request)
convert_request(request).run
end
def queue(request)
hydra.queue convert_request request
end
- protected
+ protected
+
def hydra
@hydra ||= ::Typhoeus::Hydra.new
end
def convert_request(req)
@@ -48,12 +45,12 @@
request
end
def convert_response(request, response)
Acfs::Response.new request,
- status: response.code,
- headers: response.headers,
- body: response.body
+ status: response.code,
+ headers: response.headers,
+ body: response.body
end
end
end
end