lib/atol/request/post_document.rb in atol-0.2 vs lib/atol/request/post_document.rb in atol-0.3

- old
+ new

@@ -1,8 +1,7 @@ require 'atol' require 'atol/errors' -require 'net/http' require 'atol/request/post_document/item/body' require 'atol/request/post_document/sell/body' module Atol module Request @@ -19,21 +18,22 @@ @url = "#{Atol::URL}/#{@config.group_code}/#{operation}?tokenid=#{token}" @body = body @req_logger = req_logger @res_logger = res_logger + @http_client = @config.http_client end def call uri = URI(url) - req = Net::HTTP::Post.new(uri, HEADERS) + req = @http_client::Post.new(uri, HEADERS) req.body = body if req_logger.respond_to?(:call) req_logger.call(req) end - res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| + res = @http_client.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(req) end if res_logger.respond_to?(:call) res_logger.call(res)