Class: MasterCard::Core::Config
- Inherits:
-
Object
- Object
- MasterCard::Core::Config
- Defined in:
- lib/mastercard/core/config.rb
Class Method Summary collapse
- .clearResourceConfig ⇒ Object
- .getAuthentication ⇒ Object
- .getEnvironment ⇒ Object
- .isDebug ⇒ Object
- .isSandbox ⇒ Object
- .registerResourceConfig(instance) ⇒ Object
- .setAuthentication(auth) ⇒ Object
- .setDebug(debug) ⇒ Object
- .setEnvironment(environment) ⇒ Object
- .setSandbox(sandbox) ⇒ Object
- .sizeResourceConfig ⇒ Object
Class Method Details
.clearResourceConfig ⇒ Object
91 92 93 |
# File 'lib/mastercard/core/config.rb', line 91 def self.clearResourceConfig @@registeredInstances = {} end |
.getAuthentication ⇒ Object
81 82 83 |
# File 'lib/mastercard/core/config.rb', line 81 def self.getAuthentication return @@authentication end |
.getEnvironment ⇒ Object
62 63 64 |
# File 'lib/mastercard/core/config.rb', line 62 def self.getEnvironment return @@environment end |
.isDebug ⇒ Object
44 45 46 |
# File 'lib/mastercard/core/config.rb', line 44 def self.isDebug() return @@debug end |
.isSandbox ⇒ Object
57 58 59 |
# File 'lib/mastercard/core/config.rb', line 57 def self.isSandbox return @@environment == Environment::SANDBOX end |
.registerResourceConfig(instance) ⇒ Object
85 86 87 88 89 |
# File 'lib/mastercard/core/config.rb', line 85 def self.registerResourceConfig(instance) if !@@registeredInstances.key?(instance.class.name) @@registeredInstances[instance.class.name] = instance end end |
.setAuthentication(auth) ⇒ Object
77 78 79 |
# File 'lib/mastercard/core/config.rb', line 77 def self.setAuthentication(auth) @@authentication = auth end |
.setDebug(debug) ⇒ Object
40 41 42 |
# File 'lib/mastercard/core/config.rb', line 40 def self.setDebug(debug) @@debug = debug end |
.setEnvironment(environment) ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/mastercard/core/config.rb', line 66 def self.setEnvironment(environment) if !environment.nil? && !environment.empty? if Environment::MAPPING.key?(environment) @@registeredInstances.values().each { |instance| instance.setEnvironment(environment) } @@environment = environment end end end |
.setSandbox(sandbox) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/mastercard/core/config.rb', line 48 def self.setSandbox(sandbox) if sandbox self.setEnvironment(Environment::SANDBOX) else self.setEnvironment(Environment::PRODUCTION) end end |
.sizeResourceConfig ⇒ Object
95 96 97 |
# File 'lib/mastercard/core/config.rb', line 95 def self.sizeResourceConfig return @@registeredInstances.length end |