lib/atol/request/get_token.rb in atol-0.2 vs lib/atol/request/get_token.rb in atol-0.3
- old
+ new
@@ -1,8 +1,7 @@
require 'atol'
require 'atol/errors'
-require 'net/http'
module Atol
module Request
class GetToken
PATH = '/getToken'.freeze
@@ -20,16 +19,18 @@
if @config.password.nil? || @config.login.empty?
raise(Atol::MissingConfigError, 'password missing')
else
@password = @config.password
end
+
+ @http_client = @config.http_client
end
def call
uri = URI(Atol::URL + PATH)
uri.query = URI.encode_www_form(login: login, pass: password)
- http = Net::HTTP.new(uri.host, uri.port)
+ http = @http_client.new(uri.host, uri.port)
http.use_ssl = true
http.get(uri.request_uri)
end
private