Class: Dacom::Config

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

Constant Summary collapse

CONFIG_PATH =
File::expand_path("../../../config/dacom.yml", __FILE__)

Instance Method Summary collapse

Constructor Details

#initialize(path = CONFIG_PATH) ⇒ Config

Returns a new instance of Config.



8
9
10
11
# File 'lib/dacom/config.rb', line 8

def initialize(path = CONFIG_PATH)
  @path = path
  @config = fetch_config
end

Instance Method Details

#merchant_idObject



24
25
26
27
# File 'lib/dacom/config.rb', line 24

def merchant_id
  return @config.fetch("test_mert_id") if test_mode?
  @config.fetch("mert_id")
end

#merchant_keyObject



29
30
31
32
# File 'lib/dacom/config.rb', line 29

def merchant_key
  return @config.fetch("test_mert_key") if test_mode?
  @config.fetch("mert_key")
end

#platformObject



34
35
36
37
# File 'lib/dacom/config.rb', line 34

def platform
  return "test".freeze if test_mode?
  "service".freeze
end

#urlObject



19
20
21
22
# File 'lib/dacom/config.rb', line 19

def url
  return @config.fetch("test_url") if test_mode?
  @config.fetch("url")
end

#verify_peer?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/dacom/config.rb', line 39

def verify_peer?
  verify_cert || verify_host
end