Sha256: a8b7df6984420f077503dacb4c9b8024325190992f7568a17fd3363998d2d206

Contents?: true

Size: 711 Bytes

Versions: 4

Compression:

Stored size: 711 Bytes

Contents

require 'atol'
require 'atol/errors'
require 'net/http'

module Atol
  module Request
    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?
        @token = token
        @uuid = uuid
      end

      def call
        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, 'Token' => @token)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
atol-0.5.0 lib/atol/request/get_document_state.rb
atol-0.4.2 lib/atol/request/get_document_state.rb
atol-0.4.1 lib/atol/request/get_document_state.rb
atol-0.4 lib/atol/request/get_document_state.rb