lib/atol/transaction/post_document.rb in atol-0.3 vs lib/atol/transaction/post_document.rb in atol-0.4

- old
+ new

@@ -5,22 +5,22 @@ module Transaction class PostDocument def initialize(operation:, token:, body:, config: nil, req_logger: nil, res_logger: nil) @config = config || Atol.config raise(Atol::ConfigExpectedError) unless @config.is_a?(Atol::Config) - @params = Hash[ + @params = { operation: operation, token: token, body: body, config: config, req_logger: req_logger, res_logger: res_logger - ] + } end def call - request = Atol::Request::PostDocument.new(params) + request = Atol::Request::PostDocument.new(@params) response = request.call encoded_body = response.body.force_encoding(Atol::ENCODING) json = JSON.parse(encoded_body) if response.code == '200' && json['error'].nil? @@ -29,12 +29,8 @@ raise(ERRORS[json['error']['code']], encoded_body) else raise(encoded_body) end end - - private - - attr_reader :params end end end