Class: MasterCard::API::Stp::ResourceConfig

Inherits:
Object
  • Object
show all
Includes:
Core
Defined in:
lib/mastercard/api/stp/resourceconfig.rb

Constant Summary collapse

@@instance =
ResourceConfig.new

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResourceConfig

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

.instanceObject



51
52
53
# File 'lib/mastercard/api/stp/resourceconfig.rb', line 51

def self.instance
	return @@instance
end

Instance Method Details

#getContentTypeOverrideObject



81
82
83
# File 'lib/mastercard/api/stp/resourceconfig.rb', line 81

def getContentTypeOverride
	return "application/hal+json"
end

#getContextObject



69
70
71
# File 'lib/mastercard/api/stp/resourceconfig.rb', line 69

def getContext
	return @context
end

#getHostObject



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

#getJsonNativeObject



77
78
79
# File 'lib/mastercard/api/stp/resourceconfig.rb', line 77

def getJsonNative
	return false
end

#getNameObject



56
57
58
# File 'lib/mastercard/api/stp/resourceconfig.rb', line 56

def getName
	return "stp"
end

#getVersionObject



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