Class: Atol::Request::GetDocumentState

Inherits:
Object
  • Object
show all
Defined in:
lib/atol/request/get_document_state.rb

Instance Method Summary collapse

Constructor Details

#initialize(uuid:, token:, config: nil) ⇒ GetDocumentState

Returns a new instance of GetDocumentState.



10
11
12
13
14
15
16
# File 'lib/atol/request/get_document_state.rb', line 10

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

Instance Method Details

#callObject



18
19
20
21
22
23
24
# File 'lib/atol/request/get_document_state.rb', line 18

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