lib/atol/transaction/get_document_state.rb in atol-0.5.0 vs lib/atol/transaction/get_document_state.rb in atol-0.5.1
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'atol/request/get_document_state'
require 'atol/errors'
module Atol
module Transaction
@@ -11,10 +13,10 @@
end
def call
request = Atol::Request::GetDocumentState.new(@params)
response = request.call
- encoded_body = response.body.force_encoding(Atol::ENCODING)
+ encoded_body = response.body.dup.force_encoding(Atol::ENCODING)
json = JSON.parse(encoded_body)
if response.code == '200' && json['error'].nil?
json
elsif Atol::ERRORS[json['error']['code']]