lib/HyperPay/base.rb in HyperPay-0.1.0 vs lib/HyperPay/base.rb in HyperPay-0.1.1
- old
+ new
@@ -1,18 +1,23 @@
# frozen_string_literal: true
require "httparty"
require "HyperPay/configuration"
+require "HyperPay/response_code_interpreter"
module HyperPay
class Base
include HTTParty
def initialize
self.class.base_uri base_url
end
+ def interpret_response_code(code)
+ ResponseCodeInterpreter.interpret(code)
+ end
+
private
def get(path)
request(:get, path)
end
@@ -45,11 +50,9 @@
end
def base_url
HyperPay.configuration.environment == :sandbox ? "https://eu-test.oppwa.com" : "https://eu-prod.oppwa.com"
end
-
- private
def prepare_headers(options)
content_type = options.dig(:headers, "Content-Type") == "application/x-www-form-urlencoded" ?
"application/x-www-form-urlencoded" : "application/json"
default_headers = {