class Mondido::Credentials

Public Class Methods

merchant_id() click to toggle source
# File lib/mondido/credentials.rb, line 7
def self.merchant_id
  setup if @@merchant_id.nil?
  @@merchant_id
end
password() click to toggle source
# File lib/mondido/credentials.rb, line 17
def self.password
  setup if @@password.nil?
  @@password
end
secret() click to toggle source
# File lib/mondido/credentials.rb, line 12
def self.secret
  setup if @@secret.nil?
  @@secret
end

Private Class Methods

setup() click to toggle source
# File lib/mondido/credentials.rb, line 24
def self.setup
  config_file = File.join(Rails.root, 'config', 'mondido.yml')
  if File.exist?(config_file)
    template = ERB.new File.read(config_file)
    yaml = YAML.load template.result(binding)
    @@merchant_id = yaml['merchant_id'] 
    @@secret = yaml['secret'] 
    @@password = yaml['password'] 
  else
    raise Mondido::Exceptions::MissingFile.new 'Could not locate config/mondido.yml'
  end
end