Class: MasterCard::API::Stp::ResourceConfig
- Inherits:
-
Object
- Object
- MasterCard::API::Stp::ResourceConfig
- Includes:
- Core
- Defined in:
- lib/mastercard/api/stp/resourceconfig.rb
Constant Summary collapse
- @@instance =
ResourceConfig.new
Class Method Summary collapse
Instance Method Summary collapse
- #getContentTypeOverride ⇒ Object
- #getContext ⇒ Object
- #getHost ⇒ Object
- #getJsonNative ⇒ Object
- #getName ⇒ Object
- #getVersion ⇒ Object
-
#initialize ⇒ ResourceConfig
constructor
A new instance of ResourceConfig.
- #setCustomEnvironment(host, context) ⇒ Object
- #setEnvironment(environmet) ⇒ Object
Constructor Details
#initialize ⇒ ResourceConfig
Returns a new instance of ResourceConfig.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/mastercard/api/stp/resourceconfig.rb', line 39 def initialize @override = nil @host = nil @context = nil Config.registerResourceConfig(self) currentEnvironment = Config.getEnvironment() self.setEnvironment(currentEnvironment) end |
Class Method Details
.instance ⇒ Object
51 52 53 |
# File 'lib/mastercard/api/stp/resourceconfig.rb', line 51 def self.instance return @@instance end |
Instance Method Details
#getContentTypeOverride ⇒ Object
81 82 83 |
# File 'lib/mastercard/api/stp/resourceconfig.rb', line 81 def getContentTypeOverride return "application/hal+json" end |
#getContext ⇒ Object
69 70 71 |
# File 'lib/mastercard/api/stp/resourceconfig.rb', line 69 def getContext return @context end |
#getHost ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/mastercard/api/stp/resourceconfig.rb', line 61 def getHost unless @override.nil? || @override == 0 return @override else return @host end end |
#getJsonNative ⇒ Object
77 78 79 |
# File 'lib/mastercard/api/stp/resourceconfig.rb', line 77 def getJsonNative return false end |
#getName ⇒ Object
56 57 58 |
# File 'lib/mastercard/api/stp/resourceconfig.rb', line 56 def getName return "stp" end |
#getVersion ⇒ Object
73 74 75 |
# File 'lib/mastercard/api/stp/resourceconfig.rb', line 73 def getVersion return "stp:1.0.0" end |
#setCustomEnvironment(host, context) ⇒ Object
93 94 95 96 |
# File 'lib/mastercard/api/stp/resourceconfig.rb', line 93 def setCustomEnvironment(host,context) @host = host @context = context end |
#setEnvironment(environmet) ⇒ Object
85 86 87 88 89 90 91 |
# File 'lib/mastercard/api/stp/resourceconfig.rb', line 85 def setEnvironment(environmet) if Environment::MAPPING.key?(environmet) tuple = Environment::MAPPING[environmet] @host = tuple[0] @context = tuple[1] end end |