class Dacom::Config
Public Class Methods
new(path = "~/dacom.yml")
click to toggle source
# File lib/dacom/config.rb, line 12 def initialize(path = "~/dacom.yml") @path = File.expand_path(path) @config = fetch_config end
Public Instance Methods
merchant_id()
click to toggle source
# File lib/dacom/config.rb, line 28 def merchant_id return @config.fetch("test_mert_id") if test_mode? @config.fetch("mert_id") end
merchant_key()
click to toggle source
# File lib/dacom/config.rb, line 33 def merchant_key return @config.fetch("test_mert_key") if test_mode? @config.fetch("mert_key") end
platform()
click to toggle source
# File lib/dacom/config.rb, line 38 def platform return Platform::TEST if test_mode? Platform::SERVICE end
url()
click to toggle source
# File lib/dacom/config.rb, line 23 def url return @config.fetch("test_url") if test_mode? @config.fetch("url") end
verify_peer?()
click to toggle source
# File lib/dacom/config.rb, line 43 def verify_peer? verify_cert || verify_host end
Private Instance Methods
fetch_config()
click to toggle source
# File lib/dacom/config.rb, line 53 def fetch_config return {} unless File.exist?(@path) YAML.load(ERB.new(File.read(@path)).result) end
test_mode?()
click to toggle source
# File lib/dacom/config.rb, line 49 def test_mode? @config["test_mode"] end