Class: Monri::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/monri/config.rb

Defined Under Namespace

Classes: InvalidConfiguration

Constant Summary collapse

SUPPORTED_ENVS =
%w[test production].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#authenticity_tokenObject

Returns the value of attribute authenticity_token.



6
7
8
# File 'lib/monri/config.rb', line 6

def authenticity_token
  @authenticity_token
end

#environmentObject

Returns the value of attribute environment.



27
28
29
# File 'lib/monri/config.rb', line 27

def environment
  @environment
end

#merchant_keyObject

Returns the value of attribute merchant_key.



5
6
7
# File 'lib/monri/config.rb', line 5

def merchant_key
  @merchant_key
end

Class Method Details

.default_configObject



21
22
23
24
25
# File 'lib/monri/config.rb', line 21

def self.default_config
  rv = Config.new
  rv.environment = :test
  rv
end

Instance Method Details

#base_api_urlString

Returns:

  • (String)


11
12
13
14
15
16
17
18
19
# File 'lib/monri/config.rb', line 11

def base_api_url
  if environment == 'test'
    'https://ipgtest.monri.com'
  elsif environment == 'production'
    'https://ipg.monri.com'
  else
    raise ArgumentError, "Environment=#{environment} not supported"
  end
end

#configured?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/monri/config.rb', line 38

def configured?
  !merchant_key.nil? && !authenticity_token.nil? && !environment.nil?
end