Sha256: af5149c9eaa8c94d302d9865510a2cc5fe0e9191c99acb3b5486cd62b42ff9eb
Contents?: true
Size: 1.47 KB
Versions: 6
Compression:
Stored size: 1.47 KB
Contents
module Exact class Credentials attr_accessor :config def initialize location = ENV['LOCATION'] || 'DEV' load_configuration(location) end # obtain the credentials for the processor specified by # ENV['PROCESSOR'], defaulting to 'emergis' def current_gateway processor = ENV['PROCESSOR'] || 'emergis' self.config[processor] end def chase self.config['chase'] end def chase_batch self.config['chase_batch'] end def chase? [self.chase[:gateway_id], self.chase_batch[:gateway_id]].include?(current_gateway[:gateway_id]) end def tsys self.config['tsys'] end def tsys? current_gateway[:gateway_id] == self.tsys[:gateway_id] end def emergis self.config['emergis'] end def emergis? current_gateway[:gateway_id] == self.emergis[:gateway_id] end def moneris self.config['moneris'] end def moneris? current_gateway[:gateway_id] == self.moneris[:gateway_id] end def load_configuration(environment) config_file = File.dirname(__FILE__) + '/credentials.yml' yaml = YAML::load(IO.read(config_file)) environment ||= 'DEV' self.config = yaml[environment] if self.config.nil? abort "No credentials configured. Please create a properly-formatted credentials.yml file in #{File.dirname(__FILE__)}." end end private :load_configuration end end
Version data entries
6 entries across 6 versions & 1 rubygems