Sha256: 4ce0faf1991eedc5b61945522ecc05da0cbaebc763999dc92eb3b227d923d7ab

Contents?: true

Size: 604 Bytes

Versions: 3

Compression:

Stored size: 604 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?

        @url = "#{Atol::URL}/#{@config.group_code}/report/#{uuid}?tokenid=#{token}"
      end

      def call
        uri = URI(url)
        Net::HTTP.get_response(uri)
      end

      private

      attr_reader :url
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
atol-0.1.2 lib/atol/request/get_document_state.rb
atol-0.1.1 lib/atol/request/get_document_state.rb
atol-0.1 lib/atol/request/get_document_state.rb