lib/atol/request/get_document_state.rb in atol-0.3 vs lib/atol/request/get_document_state.rb in atol-0.4

- old
+ new

@@ -7,24 +7,19 @@ class GetDocumentState def initialize(uuid:, token:, config: nil) @config = config || Atol.config raise(Atol::ConfigExpectedError) unless @config.is_a?(Atol::Config) raise(Atol::MissingConfigError, 'group_code missing') if @config.group_code.nil? - - @url = "#{Atol::URL}/#{@config.group_code}/report/#{uuid}?tokenid=#{token}" - @http_client = @config.http_client + @token = token + @uuid = uuid end def call - uri = URI(url) - - http = @http_client.new(uri.host, uri.port) + http_client = @config.http_client + uri = URI("#{Atol::URL}/#{@config.group_code}/report/#{@uuid}") + http = http_client.new(uri.host, uri.port) http.use_ssl = true - http.get(uri.request_uri) + http.get(uri.request_uri, 'Token' => @token) end - - private - - attr_reader :url end end end