Class: ZipMoney::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/zipMoney/configuration.rb

Constant Summary collapse

API_VERSION =
"1.0.8"
API_PLATFORM =
"ruby"
API_NAME =
"zipMoney Ruby SDK"
ENV_LIVE_API_URL =
"https://api.zipmoney.com.au/v1/"
ENV_TEST_API_URL =
"https://api.sandbox.zipmoney.com.au/v1/"
ATTRIBUTES =
[
  :merchant_id,
  :merchant_key,
  :environment,
]

Class Method Summary collapse

Class Method Details

.credentials_valid(merchant_id, merchant_key) ⇒ Object

Checks if passed merchant_id and merchant_key match with the one provided during setup

Parameters:

  • Merchant (merchant_id)

    Id

  • Merchant (merchant_key)

    Key

Raises:



44
45
46
# File 'lib/zipMoney/configuration.rb', line 44

def credentials_valid(merchant_id,merchant_key)
	raise ExpressError, "Invalid merchant credentials in the request" unless @merchant_id.to_i.eql?(merchant_id.to_i) && @merchant_key.to_s.eql?(merchant_key.to_s)
end

.environment=(env) ⇒ Object

Checks if passed value is valid and assigns it true

Parameters:

  • Environment (env)

    sandbox|live

Returns:

  • true|false

Raises:

  • (ArgumentError)


27
28
29
30
31
# File 'lib/zipMoney/configuration.rb', line 27

def environment=(env)
 	env = env.to_sym
 	raise ArgumentError, "#{env.inspect} is not a valid environment"   unless [:sandbox, :live].include?(env)
 	@environment = env
end

.is_sandboxObject

Returns true|false.

Returns:

  • true|false



36
37
38
# File 'lib/zipMoney/configuration.rb', line 36

def is_sandbox
	environment.to_s == "sandbox"
end