diff --git a/lib/hyperwallet/api/client.rb b/lib/hyperwallet/api/client.rb index fa58c5b..f931e9d 100644 --- a/lib/hyperwallet/api/client.rb +++ b/lib/hyperwallet/api/client.rb @@ -47,8 +47,8 @@ def request_url_for(resource) base_url + "/" + resource end - def base_url - active_url + API_VERSION + def base_url + active_url + self.class.superclass.api_version end def active_url diff --git a/lib/hyperwallet/api/config.rb b/lib/hyperwallet/api/config.rb index 1ce9719..8f12a59 100644 --- a/lib/hyperwallet/api/config.rb +++ b/lib/hyperwallet/api/config.rb @@ -2,11 +2,11 @@ module Hyperwallet module Api class Config - PRODUCTION_URL = "https://api.paylution.com/rest" - UAT_URL = "https://uat-api.paylution.com/rest" - - API_VERSION = "/v3" - MODES = [:uat, :production] + PRODUCTION_URL = "https://api.paylution.com/rest" + UAT_URL = "https://uat-api.paylution.com/rest" + PRODUCTION_API_VERSION = "/v3" + UAT_API_VERSION = "/v4" + MODES = [:uat, :production] class << self attr_accessor :api_user, :api_password, :api_mode, :proxy @@ -17,6 +17,12 @@ def uat? def production? api_mode == :production end + + def api_version + return PRODUCTION_API_VERSION if production? + + UAT_API_VERSION + end end end end